summaryrefslogtreecommitdiffstats
path: root/tests/auto/tools
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>2015-05-13 19:34:19 +0200
committerOswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>2015-05-20 18:11:05 +0000
commita3fac538645e0c672ac7c8d5e86f8cfbb1ec8426 (patch)
treef0443bc1981b6368b927a54423fde50067776f51 /tests/auto/tools
parent79de60f38b36ec06b343c91f2301030259352425 (diff)
add parser tests for use of 'else' after bad conditionals
Change-Id: I9885f629a2f6511574eebd81896a1d9f258e55cb Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Diffstat (limited to 'tests/auto/tools')
-rw-r--r--tests/auto/tools/qmakelib/tst_qmakelib.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/auto/tools/qmakelib/tst_qmakelib.cpp b/tests/auto/tools/qmakelib/tst_qmakelib.cpp
index 0667b67300..441a36e34d 100644
--- a/tests/auto/tools/qmakelib/tst_qmakelib.cpp
+++ b/tests/auto/tools/qmakelib/tst_qmakelib.cpp
@@ -1373,6 +1373,29 @@ void tst_qmakelib::proParser_data()
<< "in:1: Unexpected 'else'."
<< false;
+ QTest::newRow("double-test-else")
+ << "foo bar\nelse"
+ << TS(
+ /* 0 */ << H(TokBranch)
+ /* 1 */ /* then branch */ << I(0)
+ /* 3 */ /* else branch */ << I(1) // This seems weird
+ /* 5 */ << H(TokTerminator))
+ << "in:1: Extra characters after test expression."
+ << false;
+
+ QTest::newRow("test-function-else")
+ << "foo bar()\nelse"
+ << TS(
+ /* 0 */ << H(TokLine) << H(1)
+ /* 2 */ << H(TokTestCall) // This seems pointless
+ /* 3 */ << H(TokFuncTerminator)
+ /* 4 */ << H(TokBranch)
+ /* 5 */ /* then branch */ << I(0)
+ /* 7 */ /* else branch */ << I(1) // This seems weird
+ /* 9 */ << H(TokTerminator))
+ << "in:1: Extra characters after test expression."
+ << false;
+
// Braces
QTest::newRow("{}")