diff options
author | Jake Petroules <jake.petroules@theqtcompany.com> | 2016-03-23 17:37:49 -0700 |
---|---|---|
committer | Jake Petroules <jake.petroules@qt.io> | 2016-04-14 12:35:48 +0000 |
commit | 9eac02487ef5b8c94b08901b223b1d572642a68a (patch) | |
tree | ba51229d5779943841a697ede699d9b6617f709d /tests/auto/blackbox/testdata/error-info | |
parent | a235900a7368fd2edf269454016c7577cb674323 (diff) |
Display proper file paths and line numbers for errors in more places.
Rule.outputArtifacts, Rule.prepare, and Artifact.filePath will now
display the correct file paths and line numbers for errors thrown from
those locations (including in imported JavaScript files).
Change-Id: I4e3c8e60f30791f5aa4de9e3813d4890c46c09fb
Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
Diffstat (limited to 'tests/auto/blackbox/testdata/error-info')
-rw-r--r-- | tests/auto/blackbox/testdata/error-info/helper.js | 9 | ||||
-rw-r--r-- | tests/auto/blackbox/testdata/error-info/project.qbs | 71 |
2 files changed, 80 insertions, 0 deletions
diff --git a/tests/auto/blackbox/testdata/error-info/helper.js b/tests/auto/blackbox/testdata/error-info/helper.js new file mode 100644 index 000000000..18323df4a --- /dev/null +++ b/tests/auto/blackbox/testdata/error-info/helper.js @@ -0,0 +1,9 @@ +var x; + +function doSomethingBad() { + nothinghere.works; +} + +function doSomethingEvil() { + throw "OUCH!"; +} diff --git a/tests/auto/blackbox/testdata/error-info/project.qbs b/tests/auto/blackbox/testdata/error-info/project.qbs new file mode 100644 index 000000000..f2c65597f --- /dev/null +++ b/tests/auto/blackbox/testdata/error-info/project.qbs @@ -0,0 +1,71 @@ +import qbs +import "helper.js" as Helper + +Project { + property bool fail1: false + property bool fail2: false + property bool fail3: false + property bool fail4: false + property bool fail5: false + property bool fail6: false + property bool fail7: false + + Product { + type: ["foo", "bar"] + + Rule { + inputs: ["qbs"] + + Artifact { + fileTags: ["foo"] + filePath: { + var path = "foo"; + if (project.fail1) + throw "fail1"; + return path; + } + } + + prepare: { + var cmd = new JavaScriptCommand(); + cmd.sourceCode = function () { + + }; + cmd.silent = true; + if (project.fail2) + generate.an.error; + if (project.fail6) + Helper.doSomethingEvil(); + return cmd; + } + } + + Rule { + inputs: ["qbs"] + + outputFileTags: ["bar"] + outputArtifacts: { + var list = []; + list.push({ fileTags: ["bar"], filePath: "bar" }); + if (project.fail3) + throw "fail3"; + if (project.fail5) + Helper.doSomethingBad(); + return list; + } + + prepare: { + var cmd = new JavaScriptCommand(); + cmd.fail7 = project.fail7; + cmd.sourceCode = function () { + if (fail7) + will.fail; + }; + cmd.silent = true; + if (project.fail4) + generate.an.error; + return cmd; + } + } + } +} |