aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/blackbox/testdata/jsextensions-file
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@theqtcompany.com>2015-06-02 16:32:26 +0200
committerChristian Kandeler <christian.kandeler@theqtcompany.com>2015-06-02 14:58:40 +0000
commita90ad9128c188dc590ef5586b6f0d7f8a32b4c4f (patch)
tree231d064f9d5c8ebc80d777e2c64a293ab69987b5 /tests/auto/blackbox/testdata/jsextensions-file
parente7fb9493051ca111a12380e3040f3a914e61ccfb (diff)
Refactor the JSExtensions tests.
Use a proper Transformer instead of putting all the code in the "type" property. Change-Id: I6d74a749dc701e96ed9ff56a977eedc48d3fbb57 Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Diffstat (limited to 'tests/auto/blackbox/testdata/jsextensions-file')
-rw-r--r--tests/auto/blackbox/testdata/jsextensions-file/file.qbs43
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/auto/blackbox/testdata/jsextensions-file/file.qbs b/tests/auto/blackbox/testdata/jsextensions-file/file.qbs
new file mode 100644
index 000000000..83a5bfae5
--- /dev/null
+++ b/tests/auto/blackbox/testdata/jsextensions-file/file.qbs
@@ -0,0 +1,43 @@
+import qbs
+import qbs.File
+import qbs.FileInfo
+import qbs.TextFile
+
+Product {
+ type: ["dummy"]
+ Transformer {
+ Artifact {
+ filePath: "dummy.txt"
+ fileTags: ["dummy"]
+ }
+ prepare: {
+ var cmd = new JavaScriptCommand();
+ cmd.silent = true;
+ cmd.sourceCode = function() {
+ var origPath = FileInfo.joinPaths(product.sourceDirectory, "original.txt");
+ var copyPath = FileInfo.joinPaths(product.sourceDirectory, "copy.txt");
+ print("copy path: "+copyPath);
+ var original = new TextFile(origPath, TextFile.WriteOnly);
+ original.close();
+ File.copy(origPath, copyPath);
+ var origTimestamp = File.lastModified(origPath);
+ var copyTimestamp = File.lastModified(copyPath);
+ if (origTimestamp > copyTimestamp)
+ throw new Error("Older file has newer timestamp.");
+ File.remove(origPath);
+ var copy = new TextFile(copyPath, TextFile.WriteOnly);
+ copy.writeLine(File.exists(origPath));
+ copy.writeLine(File.exists(copyPath));
+ copy.close();
+ var zePath = FileInfo.joinPaths(product.sourceDirectory, "zePath");
+ if (File.exists(zePath))
+ throw new Error(zePath + " already exists.");
+ var created = File.makePath(zePath);
+ if (!created || !File.exists(zePath))
+ throw new Error("zePath was not created.");
+
+ };
+ return [cmd];
+ }
+ }
+}