summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@qt.io>2016-11-11 11:40:24 +0100
committerOswald Buddenhagen <oswald.buddenhagen@qt.io>2016-12-13 18:56:20 +0000
commitb6b44b368c6fc2df168195eaee57a2f925a29646 (patch)
treed7768d5a0f89bd9a63e6d19e4046ce994b58c696 /tests
parent169a40d511165f6c3c9a71cd5c079786c22d2aca (diff)
qmake: introduce magic bypassNesting() scope
will be needed by configure. Change-Id: If14e6944fe84767bd67604ecde98076f873749ef Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/tools/qmakelib/evaltest.cpp25
-rw-r--r--tests/auto/tools/qmakelib/parsertest.cpp69
2 files changed, 94 insertions, 0 deletions
diff --git a/tests/auto/tools/qmakelib/evaltest.cpp b/tests/auto/tools/qmakelib/evaltest.cpp
index e3be294e5f..4e215b8570 100644
--- a/tests/auto/tools/qmakelib/evaltest.cpp
+++ b/tests/auto/tools/qmakelib/evaltest.cpp
@@ -633,6 +633,31 @@ void tst_qmakelib::addControlStructs()
<< ""
<< true;
+ QTest::newRow("bypassNesting()")
+ << "defineTest(func) {\n"
+ "LOCAL = 1\n"
+ "bypassNesting() {\n"
+ "OUT = 1\n"
+ "!isEmpty(GLOBAL): OUT1 = 1\n"
+ "!isEmpty(LOCAL): OUT2 = 1\n"
+ "}\n"
+ "}\n"
+ "GLOBAL = 1\n"
+ "func()"
+ << "GLOBAL = 1\nLOCAL = UNDEF\nOUT = 1\nOUT1 = 1\nOUT2 = UNDEF"
+ << ""
+ << true;
+
+ QTest::newRow("error() from bypassNesting()")
+ << "defineTest(func) {\n"
+ "bypassNesting() { error(error) }\n"
+ "}\n"
+ "func()\n"
+ "OKE = 1"
+ << "OKE = UNDEF"
+ << "Project ERROR: error"
+ << false;
+
QTest::newRow("top-level return()")
<< "VAR = good\nreturn()\nVAR = bad"
<< "VAR = good"
diff --git a/tests/auto/tools/qmakelib/parsertest.cpp b/tests/auto/tools/qmakelib/parsertest.cpp
index dc92f98f45..70f1be5fc3 100644
--- a/tests/auto/tools/qmakelib/parsertest.cpp
+++ b/tests/auto/tools/qmakelib/parsertest.cpp
@@ -1684,6 +1684,57 @@ void tst_qmakelib::addParseCustomFunctions()
/* 22 */ << H(TokTerminator))
<< ""
<< true;
+
+ QTest::newRow("bypassNesting()-{return}")
+ << "defineTest(test) { bypassNesting() { return(true) } }"
+ << TS(
+ /* 0 */ << H(TokLine) << H(1)
+ /* 2 */ << H(TokTestDef) << HS(L"test")
+ /* 10 */ /* body */ << I(16)
+ /* 12 */ << H(TokLine) << H(1)
+ /* 14 */ << H(TokBypassNesting)
+ /* 15 */ /* block */ << I(10)
+ /* 17 */ << H(TokLine) << H(1)
+ /* 19 */ << H(TokLiteral | TokNewStr) << S(L"true")
+ /* 25 */ << H(TokReturn)
+ /* 26 */ << H(TokTerminator)
+ /* 27 */ << H(TokTerminator))
+ << ""
+ << true;
+
+ QTest::newRow("test-AND-bypassNesting()-{}")
+ << "defineTest(test) { test: bypassNesting() {} }"
+ << TS(
+ /* 0 */ << H(TokLine) << H(1)
+ /* 2 */ << H(TokTestDef) << HS(L"test")
+ /* 10 */ /* body */ << I(17)
+ /* 12 */ << H(TokLine) << H(1)
+ /* 14 */ << H(TokHashLiteral) << HS(L"test")
+ /* 22 */ << H(TokCondition)
+ /* 23 */ << H(TokAnd)
+ /* 24 */ << H(TokBypassNesting)
+ /* 25 */ /* block */ << I(1)
+ /* 27 */ << H(TokTerminator)
+ /* 28 */ << H(TokTerminator))
+ << ""
+ << true;
+
+ QTest::newRow("test-OR-bypassNesting()-{}")
+ << "defineTest(test) { test| bypassNesting() {} }"
+ << TS(
+ /* 0 */ << H(TokLine) << H(1)
+ /* 2 */ << H(TokTestDef) << HS(L"test")
+ /* 10 */ /* body */ << I(17)
+ /* 12 */ << H(TokLine) << H(1)
+ /* 14 */ << H(TokHashLiteral) << HS(L"test")
+ /* 22 */ << H(TokCondition)
+ /* 23 */ << H(TokOr)
+ /* 24 */ << H(TokBypassNesting)
+ /* 25 */ /* block */ << I(1)
+ /* 27 */ << H(TokTerminator)
+ /* 28 */ << H(TokTerminator))
+ << ""
+ << true;
}
void tst_qmakelib::addParseAbuse()
@@ -1736,6 +1787,24 @@ void tst_qmakelib::addParseAbuse()
<< "in:1: Unexpected NOT operator in front of function definition."
<< false;
+ QTest::newRow("outer-bypassNesting()-{}")
+ << "bypassNesting() {}"
+ << TS()
+ << "in:1: Unexpected bypassNesting()."
+ << false;
+
+ QTest::newRow("bypassNesting(arg)-{}")
+ << "defineTest(test) { bypassNesting(arg) {} }"
+ << TS()
+ << "in:1: bypassNesting() requires zero arguments."
+ << false;
+
+ QTest::newRow("NOT-bypassNesting()-{}")
+ << "defineTest(test) { !bypassNesting() {} }"
+ << TS()
+ << "in:1: Unexpected NOT operator in front of bypassNesting()."
+ << false;
+
QTest::newRow("AND-test")
<< ":test"
<< TS(