diff options
author | Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> | 2015-05-15 21:22:14 +0200 |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> | 2015-05-20 18:11:32 +0000 |
commit | ef50e244cd293394eeec7f7d410f1a6f6320c3e5 (patch) | |
tree | e4ddaf004cc2496ad133e5090bc97e65aff39dc0 /tests/auto/tools | |
parent | 48c38aae10e5fe9c85e0e045916f6abfed936463 (diff) |
split parser test initialization
the idea was to speed up optimized msvc compilation, but it didn't help.
still, it's better structured that way.
Change-Id: I4b2108d02a47ef8ef704b0b542b0f281bff20165
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Diffstat (limited to 'tests/auto/tools')
-rw-r--r-- | tests/auto/tools/qmakelib/parsertest.cpp | 85 | ||||
-rw-r--r-- | tests/auto/tools/qmakelib/tst_qmakelib.h | 9 |
2 files changed, 62 insertions, 32 deletions
diff --git a/tests/auto/tools/qmakelib/parsertest.cpp b/tests/auto/tools/qmakelib/parsertest.cpp index 2fe8e90b51..35c0d8261a 100644 --- a/tests/auto/tools/qmakelib/parsertest.cpp +++ b/tests/auto/tools/qmakelib/parsertest.cpp @@ -62,27 +62,8 @@ private: QT_WARNING_PUSH QT_WARNING_DISABLE_MSVC(4003) // "not enough actual parameters for macro TS()" -void tst_qmakelib::proParser_data() +void tst_qmakelib::addParseOperators() { - QTest::addColumn<QString>("in"); - QTest::addColumn<QString>("out"); - QTest::addColumn<QString>("msgs"); - QTest::addColumn<bool>("ok"); - - QTest::newRow("empty") - << "" - << TS() - << "" - << true; - - QTest::newRow("empty (whitespace)") - << " \t \t" - << TS() - << "" - << true; - - // Variable operators - QTest::newRow("assign none") << "VAR =" << TS( @@ -150,9 +131,10 @@ void tst_qmakelib::proParser_data() /* 4 */ << H(TokValueTerminator)) << "in:1: Assignment needs exactly one word on the left hand side." << false; +} - // Values - +void tst_qmakelib::addParseValues() +{ #define ASSIGN_VAR(h) \ H(TokLine) << H(1) \ << H(TokHashLiteral) << HS(L"VAR") \ @@ -601,9 +583,10 @@ void tst_qmakelib::proParser_data() /* 20 */ << H(TokValueTerminator)) << "" << true; +} - // Conditionals ("Tests") - +void tst_qmakelib::addParseConditions() +{ QTest::newRow("one test") << "foo" << TS( @@ -1055,9 +1038,10 @@ void tst_qmakelib::proParser_data() /* 20 */ << H(TokFuncTerminator)) << "" << true; +} - // Control statements - +void tst_qmakelib::addParseControlStatements() +{ QTest::newRow("for(VAR, LIST) loop") << "for(VAR, LIST)" << TS( @@ -1226,9 +1210,10 @@ void tst_qmakelib::proParser_data() /* 9 */ << H(TokTerminator)) << "in:1: Extra characters after test expression." << false; +} - // Braces - +void tst_qmakelib::addParseBraces() +{ QTest::newRow("{}") << "{ }" << TS() @@ -1613,9 +1598,10 @@ void tst_qmakelib::proParser_data() /* 62 */ /* else branch */ << I(0)) << "" << true; +} - // Custom functions - +void tst_qmakelib::addParseCustomFunctions() +{ QTest::newRow("defineTest-{newlines}") << "defineTest(test) {\n}" << TS( @@ -1703,9 +1689,10 @@ void tst_qmakelib::proParser_data() /* 22 */ << H(TokTerminator)) << "" << true; +} - // Operator abuse - +void tst_qmakelib::addParseAbuse() +{ QTest::newRow("!") << "" << TS() @@ -1885,6 +1872,40 @@ void tst_qmakelib::proParser_data() /* 24 */ /* else branch */ << I(0)) << "in:1: OR operator without prior condition." << false; +} + +void tst_qmakelib::proParser_data() +{ + QTest::addColumn<QString>("in"); + QTest::addColumn<QString>("out"); + QTest::addColumn<QString>("msgs"); + QTest::addColumn<bool>("ok"); + + QTest::newRow("empty") + << "" + << TS() + << "" + << true; + + QTest::newRow("empty (whitespace)") + << " \t \t" + << TS() + << "" + << true; + + addParseOperators(); // Variable operators + + addParseValues(); + + addParseConditions(); // "Tests" + + addParseControlStatements(); + + addParseBraces(); + + addParseCustomFunctions(); + + addParseAbuse(); // Mostly operator abuse // option() (these produce no tokens) diff --git a/tests/auto/tools/qmakelib/tst_qmakelib.h b/tests/auto/tools/qmakelib/tst_qmakelib.h index 1ae408bfc1..e84b1319d0 100644 --- a/tests/auto/tools/qmakelib/tst_qmakelib.h +++ b/tests/auto/tools/qmakelib/tst_qmakelib.h @@ -56,6 +56,15 @@ private slots: void proParser_data(); void proParser(); + +private: + void addParseOperators(); + void addParseValues(); + void addParseConditions(); + void addParseControlStatements(); + void addParseBraces(); + void addParseCustomFunctions(); + void addParseAbuse(); }; class QMakeHandler : public QMakeParserHandler { |