diff options
author | Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> | 2016-05-12 20:38:54 +0200 |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> | 2016-05-25 06:18:50 +0000 |
commit | 3d21634fb693634b7d41a152287d29afb80ac5e2 (patch) | |
tree | 39fcb51366074ead0085e8872e2ebbc8144a64a6 /tests | |
parent | 8bd0c3d4fc335ae39a02821a066a39f0fd6b0311 (diff) |
add $$take_first() and $$take_last() functions
while implementing stacks and queues was possible before with the help
of $$member(), these functions make it much more straight-forward.
[ChangeLog][qmake] Added $$take_first() and $$take_last() functions.
Change-Id: I4922a5331780e468a42c663c9ad3c6456a95a6bf
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/tools/qmakelib/evaltest.cpp | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/tests/auto/tools/qmakelib/evaltest.cpp b/tests/auto/tools/qmakelib/evaltest.cpp index 4642c822bc..69ccf4858f 100644 --- a/tests/auto/tools/qmakelib/evaltest.cpp +++ b/tests/auto/tools/qmakelib/evaltest.cpp @@ -742,6 +742,30 @@ void tst_qmakelib::addReplaceFunctions(const QString &qindir) << "##:1: first(var) requires one argument." << true; + QTest::newRow("$$take_first(): empty") + << "IN = \nVAR = $$take_first(IN)" + << "VAR =\nIN =" + << "" + << true; + + QTest::newRow("$$take_first(): one") + << "IN = one\nVAR = $$take_first(IN)" + << "VAR = one\nIN =" + << "" + << true; + + QTest::newRow("$$take_first(): multiple") + << "IN = one two three\nVAR = $$take_first(IN)" + << "VAR = one\nIN = two three" + << "" + << true; + + QTest::newRow("$$take_first(): bad number of arguments") + << "VAR = $$take_first(1, 2)" + << "VAR =" + << "##:1: take_first(var) requires one argument." + << true; + QTest::newRow("$$last(): empty") << "IN = \nVAR = $$last(IN)" << "VAR =" @@ -766,6 +790,30 @@ void tst_qmakelib::addReplaceFunctions(const QString &qindir) << "##:1: last(var) requires one argument." << true; + QTest::newRow("$$take_last(): empty") + << "IN = \nVAR = $$take_last(IN)" + << "VAR =\nIN =" + << "" + << true; + + QTest::newRow("$$take_last(): one") + << "IN = one\nVAR = $$take_last(IN)" + << "VAR = one\nIN =" + << "" + << true; + + QTest::newRow("$$take_last(): multiple") + << "IN = one two three\nVAR = $$take_last(IN)" + << "VAR = three\nIN = one two" + << "" + << true; + + QTest::newRow("$$take_last(): bad number of arguments") + << "VAR = $$take_last(1, 2)" + << "VAR =" + << "##:1: take_last(var) requires one argument." + << true; + QTest::newRow("$$size()") << "IN = one two three\nVAR = $$size(IN)" << "VAR = 3" |