summaryrefslogtreecommitdiffstats
path: root/tests/auto/tools/qmakelib/evaltest.cpp
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>2016-06-29 16:56:57 +0200
committerOswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>2016-07-13 14:26:46 +0000
commit339b9706ccbed4063a92337c9994731793558b0a (patch)
treea0c897531f010aaed01a5213bcfb071800852925 /tests/auto/tools/qmakelib/evaltest.cpp
parentb27d4835c2ae0d8767ca914acb72a4bdcea6fc85 (diff)
make error() propagate from custom replace functions
it didn't, which is rather unexpected. Change-Id: I8cdb7b1490a8c2207809812b93cc65fbe23a1b98 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'tests/auto/tools/qmakelib/evaltest.cpp')
-rw-r--r--tests/auto/tools/qmakelib/evaltest.cpp66
1 files changed, 66 insertions, 0 deletions
diff --git a/tests/auto/tools/qmakelib/evaltest.cpp b/tests/auto/tools/qmakelib/evaltest.cpp
index f172cda865..b7acf70e88 100644
--- a/tests/auto/tools/qmakelib/evaltest.cpp
+++ b/tests/auto/tools/qmakelib/evaltest.cpp
@@ -641,6 +641,72 @@ void tst_qmakelib::addControlStructs()
<< "VAR = final"
<< ""
<< true;
+
+ QTest::newRow("error() from replace function (assignment)")
+ << "defineReplace(func) {\nerror(error)\n}\n"
+ "VAR = $$func()\n"
+ "OKE = 1"
+ << "VAR = UNDEF\nOKE = UNDEF"
+ << "Project ERROR: error"
+ << false;
+
+ QTest::newRow("error() from replace function (replacement)")
+ << "defineReplace(func) {\nerror(error)\n}\n"
+ "VAR = $$func()\n"
+ "OKE = 1"
+ << "VAR = UNDEF\nOKE = UNDEF"
+ << "Project ERROR: error"
+ << false;
+
+ QTest::newRow("error() from replace function (LHS)")
+ << "defineReplace(func) {\nerror(error)\nreturn(VAR)\n}\n"
+ "$$func() = 1\n"
+ "OKE = 1"
+ << "VAR = UNDEF\nOKE = UNDEF"
+ << "Project ERROR: error"
+ << false;
+
+ QTest::newRow("error() from replace function (loop variable)")
+ << "defineReplace(func) {\nerror(error)\nreturn(BLAH)\n}\n"
+ "for($$func()) {\nVAR = $$BLAH\nbreak()\n}\n"
+ "OKE = 1"
+ << "VAR = UNDEF\nOKE = UNDEF"
+ << "Project ERROR: error"
+ << false;
+
+ QTest::newRow("error() from replace function (built-in test arguments)")
+ << "defineReplace(func) {\nerror(error)\n}\n"
+ "message($$func()): VAR = 1\n"
+ "OKE = 1"
+ << "VAR = UNDEF\nOKE = UNDEF"
+ << "Project ERROR: error"
+ << false;
+
+ QTest::newRow("error() from replace function (built-in replace arguments)")
+ << "defineReplace(func) {\nerror(error)\n}\n"
+ "VAR = $$upper($$func())\n"
+ "OKE = 1"
+ << "VAR = UNDEF\nOKE = UNDEF"
+ << "Project ERROR: error"
+ << false;
+
+ QTest::newRow("error() from replace function (custom test arguments)")
+ << "defineReplace(func) {\nerror(error)\n}\n"
+ "defineTest(custom) {\n}\n"
+ "custom($$func()): VAR = 1\n"
+ "OKE = 1"
+ << "VAR = UNDEF\nOKE = UNDEF"
+ << "Project ERROR: error"
+ << false;
+
+ QTest::newRow("error() from replace function (custom replace arguments)")
+ << "defineReplace(func) {\nerror(error)\nreturn(1)\n}\n"
+ "defineReplace(custom) {\nreturn($$1)\n}\n"
+ "VAR = $$custom($$func(1))\n"
+ "OKE = 1"
+ << "VAR = UNDEF\nOKE = UNDEF"
+ << "Project ERROR: error"
+ << false;
}
void tst_qmakelib::addReplaceFunctions(const QString &qindir)