From 48c38aae10e5fe9c85e0e045916f6abfed936463 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 15 May 2015 21:05:44 +0200 Subject: move parser test to a separate file for better structure. Change-Id: I16bd1ca245640e92ffe167241a5a565e7a550e1d Reviewed-by: Joerg Bornemann --- tests/auto/tools/qmakelib/tst_qmakelib.h | 77 ++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 tests/auto/tools/qmakelib/tst_qmakelib.h (limited to 'tests/auto/tools/qmakelib/tst_qmakelib.h') diff --git a/tests/auto/tools/qmakelib/tst_qmakelib.h b/tests/auto/tools/qmakelib/tst_qmakelib.h new file mode 100644 index 0000000000..1ae408bfc1 --- /dev/null +++ b/tests/auto/tools/qmakelib/tst_qmakelib.h @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include + +#include +#include + +class tst_qmakelib : public QObject +{ + Q_OBJECT + +public: + tst_qmakelib() {} + virtual ~tst_qmakelib() {} + +private slots: + void quoteArgUnix_data(); + void quoteArgUnix(); + void quoteArgWin_data(); + void quoteArgWin(); + void pathUtils(); + + void proString(); + void proStringList(); + + void proParser_data(); + void proParser(); +}; + +class QMakeHandler : public QMakeParserHandler { +public: + QMakeHandler() : QMakeParserHandler(), printed(false) {} + virtual void message(int type, const QString &msg, const QString &fileName, int lineNo) + { print(fileName, lineNo, type, msg); } + + void setExpectedMessages(const QStringList &msgs) { expected = msgs; } + QStringList expectedMessages() const { return expected; } + + bool printedMessages() const { return printed; } + +private: + void print(const QString &fileName, int lineNo, int type, const QString &msg); + + QStringList expected; + bool printed; +}; -- cgit v1.2.3 From ef50e244cd293394eeec7f7d410f1a6f6320c3e5 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 15 May 2015 21:22:14 +0200 Subject: 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 --- tests/auto/tools/qmakelib/tst_qmakelib.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tests/auto/tools/qmakelib/tst_qmakelib.h') 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 { -- cgit v1.2.3 From 5ddc16b5df1c95140124430553f91dcc4789f831 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 15 May 2015 20:58:50 +0200 Subject: add qmake evaluator test Change-Id: I31b95daede5edef245dd1ba447f2937a0db34232 Reviewed-by: Joerg Bornemann --- tests/auto/tools/qmakelib/tst_qmakelib.h | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) (limited to 'tests/auto/tools/qmakelib/tst_qmakelib.h') diff --git a/tests/auto/tools/qmakelib/tst_qmakelib.h b/tests/auto/tools/qmakelib/tst_qmakelib.h index e84b1319d0..c4716ca65e 100644 --- a/tests/auto/tools/qmakelib/tst_qmakelib.h +++ b/tests/auto/tools/qmakelib/tst_qmakelib.h @@ -31,9 +31,10 @@ ** ****************************************************************************/ -#include +#include #include +#include #include class tst_qmakelib : public QObject @@ -45,6 +46,9 @@ public: virtual ~tst_qmakelib() {} private slots: + void initTestCase(); + void cleanupTestCase(); + void quoteArgUnix_data(); void quoteArgUnix(); void quoteArgWin_data(); @@ -57,6 +61,9 @@ private slots: void proParser_data(); void proParser(); + void proEval_data(); + void proEval(); + private: void addParseOperators(); void addParseValues(); @@ -65,14 +72,30 @@ private: void addParseBraces(); void addParseCustomFunctions(); void addParseAbuse(); + + void addAssignments(); + void addExpansions(); + void addControlStructs(); + void addReplaceFunctions(const QString &qindir); + void addTestFunctions(const QString &qindir); + + QProcessEnvironment m_env; + QHash m_prop; + QString m_indir, m_outdir; }; -class QMakeHandler : public QMakeParserHandler { +class QMakeTestHandler : public QMakeHandler { public: - QMakeHandler() : QMakeParserHandler(), printed(false) {} + QMakeTestHandler() : QMakeHandler(), printed(false) {} virtual void message(int type, const QString &msg, const QString &fileName, int lineNo) { print(fileName, lineNo, type, msg); } + virtual void fileMessage(const QString &msg) + { doPrint(msg); } + + virtual void aboutToEval(ProFile *, ProFile *, EvalFileType) {} + virtual void doneWithEval(ProFile *) {} + void setExpectedMessages(const QStringList &msgs) { expected = msgs; } QStringList expectedMessages() const { return expected; } @@ -80,7 +103,9 @@ public: private: void print(const QString &fileName, int lineNo, int type, const QString &msg); + void doPrint(const QString &msg); QStringList expected; bool printed; }; + -- cgit v1.2.3