2015-05-15 19:05:44 +00:00
|
|
|
/****************************************************************************
|
|
|
|
**
|
2016-01-15 12:36:27 +00:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2015-05-15 19:05:44 +00:00
|
|
|
**
|
|
|
|
** This file is part of the test suite of the Qt Toolkit.
|
|
|
|
**
|
2016-01-15 12:36:27 +00:00
|
|
|
** $QT_BEGIN_LICENSE:GPL-EXCEPT$
|
2015-05-15 19:05:44 +00:00
|
|
|
** 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
|
2016-01-15 12:36:27 +00:00
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2015-05-15 19:05:44 +00:00
|
|
|
**
|
2016-01-15 12:36:27 +00:00
|
|
|
** GNU General Public License Usage
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
2015-05-15 19:05:44 +00:00
|
|
|
**
|
|
|
|
** $QT_END_LICENSE$
|
|
|
|
**
|
|
|
|
****************************************************************************/
|
|
|
|
|
2015-05-15 18:58:50 +00:00
|
|
|
#include <qmakeevaluator.h>
|
2015-05-15 19:05:44 +00:00
|
|
|
|
|
|
|
#include <QObject>
|
2015-05-15 18:58:50 +00:00
|
|
|
#include <QProcessEnvironment>
|
2015-05-15 19:05:44 +00:00
|
|
|
#include <QtTest/QtTest>
|
|
|
|
|
|
|
|
class tst_qmakelib : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
tst_qmakelib() {}
|
|
|
|
virtual ~tst_qmakelib() {}
|
|
|
|
|
|
|
|
private slots:
|
2015-05-15 18:58:50 +00:00
|
|
|
void initTestCase();
|
|
|
|
void cleanupTestCase();
|
|
|
|
|
2015-05-15 19:05:44 +00:00
|
|
|
void quoteArgUnix_data();
|
|
|
|
void quoteArgUnix();
|
|
|
|
void quoteArgWin_data();
|
|
|
|
void quoteArgWin();
|
2017-07-28 11:25:27 +00:00
|
|
|
|
2015-05-15 19:05:44 +00:00
|
|
|
void pathUtils();
|
2017-07-28 11:25:27 +00:00
|
|
|
void ioUtilRelativity_data();
|
|
|
|
void ioUtilRelativity();
|
|
|
|
void ioUtilResolve_data();
|
|
|
|
void ioUtilResolve();
|
2015-05-15 19:05:44 +00:00
|
|
|
|
|
|
|
void proString();
|
|
|
|
void proStringList();
|
|
|
|
|
|
|
|
void proParser_data();
|
|
|
|
void proParser();
|
2015-05-15 19:22:14 +00:00
|
|
|
|
2015-05-15 18:58:50 +00:00
|
|
|
void proEval_data();
|
|
|
|
void proEval();
|
|
|
|
|
2015-05-15 19:22:14 +00:00
|
|
|
private:
|
|
|
|
void addParseOperators();
|
|
|
|
void addParseValues();
|
|
|
|
void addParseConditions();
|
|
|
|
void addParseControlStatements();
|
|
|
|
void addParseBraces();
|
|
|
|
void addParseCustomFunctions();
|
|
|
|
void addParseAbuse();
|
2015-05-15 18:58:50 +00:00
|
|
|
|
|
|
|
void addAssignments();
|
|
|
|
void addExpansions();
|
|
|
|
void addControlStructs();
|
|
|
|
void addReplaceFunctions(const QString &qindir);
|
|
|
|
void addTestFunctions(const QString &qindir);
|
|
|
|
|
|
|
|
QProcessEnvironment m_env;
|
|
|
|
QHash<ProKey, ProString> m_prop;
|
|
|
|
QString m_indir, m_outdir;
|
2015-05-15 19:05:44 +00:00
|
|
|
};
|
|
|
|
|
2015-05-15 18:58:50 +00:00
|
|
|
class QMakeTestHandler : public QMakeHandler {
|
2015-05-15 19:05:44 +00:00
|
|
|
public:
|
2015-05-15 18:58:50 +00:00
|
|
|
QMakeTestHandler() : QMakeHandler(), printed(false) {}
|
2015-05-15 19:05:44 +00:00
|
|
|
virtual void message(int type, const QString &msg, const QString &fileName, int lineNo)
|
|
|
|
{ print(fileName, lineNo, type, msg); }
|
|
|
|
|
2013-09-02 14:43:49 +00:00
|
|
|
virtual void fileMessage(int type, const QString &msg)
|
|
|
|
{ Q_UNUSED(type) doPrint(msg); }
|
2015-05-15 18:58:50 +00:00
|
|
|
|
|
|
|
virtual void aboutToEval(ProFile *, ProFile *, EvalFileType) {}
|
|
|
|
virtual void doneWithEval(ProFile *) {}
|
|
|
|
|
2015-05-15 19:05:44 +00:00
|
|
|
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);
|
2015-05-15 18:58:50 +00:00
|
|
|
void doPrint(const QString &msg);
|
2015-05-15 19:05:44 +00:00
|
|
|
|
|
|
|
QStringList expected;
|
|
|
|
bool printed;
|
|
|
|
};
|
2015-05-15 18:58:50 +00:00
|
|
|
|