diff options
author | Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> | 2016-05-13 13:31:14 +0200 |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> | 2016-05-25 06:18:55 +0000 |
commit | d3cc25ef52d0b2b7ba1cb06609f7c205ee19c2d6 (patch) | |
tree | ff902c67105d8cb005511103a63d44ec761629b7 /tests | |
parent | 3d21634fb693634b7d41a152287d29afb80ac5e2 (diff) |
add $$num_add() (numeric addition) function
amazing how we managed to do without it for so long. ^^
the name is intentionally somewhat obscure to avoid clashes, and some
namespacing is good anyway.
[ChangeLog][qmake] Added $$num_add() function.
Change-Id: Ib7648b1f425ef096a87b51f158d0f1409e5c4daa
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/tools/qmakelib/evaltest.cpp | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/auto/tools/qmakelib/evaltest.cpp b/tests/auto/tools/qmakelib/evaltest.cpp index 69ccf4858f..a516f91070 100644 --- a/tests/auto/tools/qmakelib/evaltest.cpp +++ b/tests/auto/tools/qmakelib/evaltest.cpp @@ -954,6 +954,48 @@ void tst_qmakelib::addReplaceFunctions(const QString &qindir) << "##:1: format_number(): invalid format option foo=bar." << true; + QTest::newRow("$$num_add(): one") + << "VAR = $$num_add(10)" + << "VAR = 10" + << "" + << true; + + QTest::newRow("$$num_add(): two") + << "VAR = $$num_add(1, 2)" + << "VAR = 3" + << "" + << true; + + QTest::newRow("$$num_add(): three") + << "VAR = $$num_add(1, 3, 5)" + << "VAR = 9" + << "" + << true; + + QTest::newRow("$$num_add(): negative") + << "VAR = $$num_add(7, -13)" + << "VAR = -6" + << "" + << true; + + QTest::newRow("$$num_add(): bad number of arguments") + << "VAR = $$num_add()" + << "VAR = " + << "##:1: num_add(num, ...) requires at least one argument." + << true; + + QTest::newRow("$$num_add(): bad number: float") + << "VAR = $$num_add(1.1)" + << "VAR =" + << "##:1: num_add(): floats are currently not supported." + << true; + + QTest::newRow("$$num_add(): bad number: malformed") + << "VAR = $$num_add(fail)" + << "VAR =" + << "##:1: num_add(): malformed number fail." + << true; + QTest::newRow("$$join(): empty") << "IN = \nVAR = $$join(IN, //)" << "VAR =" |