From 12bb328bb0be8efe54aae750c21938aab4d17539 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 23 Aug 2016 14:05:54 +0200 Subject: add discard_from() function this function discards all values that come from a specific file. it will be needed for configure bootstrapping, but is too obscure to document it for general use. Change-Id: I62c18aeb1847712e33d0599dbb0b90ffa1722438 Reviewed-by: Lars Knoll --- tests/auto/tools/qmakelib/evaltest.cpp | 15 ++++++++++++++- tests/auto/tools/qmakelib/testdata/include/inc.pri | 2 ++ 2 files changed, 16 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/auto/tools/qmakelib/evaltest.cpp b/tests/auto/tools/qmakelib/evaltest.cpp index 1cd5c71531..62fcedddb9 100644 --- a/tests/auto/tools/qmakelib/evaltest.cpp +++ b/tests/auto/tools/qmakelib/evaltest.cpp @@ -2325,6 +2325,18 @@ void tst_qmakelib::addTestFunctions(const QString &qindir) << "##:1: load(feature) requires one or two arguments." << true; + QTest::newRow("discard_from()") + << "HERE = 1\nPLUS = one\ninclude(include/inc.pri)\ndiscard_from(include/inc.pri): OK = 1" + << "OK = 1\nHERE = 1\nPLUS = one\nVAR = UNDEF" + << "" + << true; + + QTest::newRow("discard_from(): bad number of arguments") + << "discard_from(1, 2): OK = 1" + << "OK = UNDEF" + << "##:1: discard_from(file) requires one argument." + << true; + // We don't test debug() and log(), because they print directly to stderr. QTest::newRow("message()") @@ -2744,7 +2756,8 @@ void tst_qmakelib::proEval() QMakeTestHandler handler; handler.setExpectedMessages(msgs.replace("##:", infile + ':').split('\n', QString::SkipEmptyParts)); QMakeVfs vfs; - QMakeParser parser(0, &vfs, &handler); + ProFileCache cache; + QMakeParser parser(&cache, &vfs, &handler); QMakeGlobals globals; globals.do_cache = false; globals.xqmakespec = "fake-g++"; diff --git a/tests/auto/tools/qmakelib/testdata/include/inc.pri b/tests/auto/tools/qmakelib/testdata/include/inc.pri index 1f1b3a287f..f9a4ec1bfa 100644 --- a/tests/auto/tools/qmakelib/testdata/include/inc.pri +++ b/tests/auto/tools/qmakelib/testdata/include/inc.pri @@ -1,6 +1,8 @@ VAR = val .VAR = nope +PLUS += more + fake-*: MATCH = 1 defineTest(func) { -- cgit v1.2.3