forked from qt-creator/qt-creator
fix ProWriter test
finally ...
This commit is contained in:
@@ -10,7 +10,7 @@ SUBDIRS += \
|
|||||||
fakevim \
|
fakevim \
|
||||||
generichighlighter \
|
generichighlighter \
|
||||||
# icheckbuild \
|
# icheckbuild \
|
||||||
# profilewriter \
|
profilewriter \
|
||||||
ioutils \
|
ioutils \
|
||||||
qtcprocess \
|
qtcprocess \
|
||||||
utils_stringutils \
|
utils_stringutils \
|
||||||
|
@@ -1,3 +1,4 @@
|
|||||||
|
include(../qttest.pri)
|
||||||
include(../../../src/shared/proparser/proparser.pri)
|
include(../../../src/shared/proparser/proparser.pri)
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
|
@@ -31,14 +31,33 @@
|
|||||||
**
|
**
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#include "profileevaluator.h"
|
#include <profileparser.h>
|
||||||
#include "prowriter.h"
|
#include <prowriter.h>
|
||||||
|
|
||||||
#include <QtTest/QtTest>
|
#include <QtTest/QtTest>
|
||||||
//#include <QtCore/QSet>
|
|
||||||
|
|
||||||
#define BASE_DIR "/some/stuff"
|
#define BASE_DIR "/some/stuff"
|
||||||
|
|
||||||
|
///////////// callbacks for parser/evaluator
|
||||||
|
|
||||||
|
static void print(const QString &fileName, int lineNo, const QString &msg)
|
||||||
|
{
|
||||||
|
if (lineNo)
|
||||||
|
qWarning("%s(%d): %s", qPrintable(fileName), lineNo, qPrintable(msg));
|
||||||
|
else
|
||||||
|
qWarning("%s", qPrintable(msg));
|
||||||
|
}
|
||||||
|
|
||||||
|
class ParseHandler : public ProFileParserHandler {
|
||||||
|
public:
|
||||||
|
virtual void parseError(const QString &fileName, int lineNo, const QString &msg)
|
||||||
|
{ print(fileName, lineNo, msg); }
|
||||||
|
};
|
||||||
|
|
||||||
|
static ParseHandler parseHandler;
|
||||||
|
|
||||||
|
//////////////// the actual autotest
|
||||||
|
|
||||||
class tst_ProFileWriter : public QObject
|
class tst_ProFileWriter : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -259,12 +278,11 @@ void tst_ProFileWriter::edit()
|
|||||||
QStringList lines = input.split(QLatin1String("\n"));
|
QStringList lines = input.split(QLatin1String("\n"));
|
||||||
QStringList vars; vars << QLatin1String("SOURCES");
|
QStringList vars; vars << QLatin1String("SOURCES");
|
||||||
|
|
||||||
ProFileOption option;
|
ProFileParser parser(0, &parseHandler);
|
||||||
ProFileEvaluator reader(&option);
|
ProFile *proFile = parser.parsedProFile(QLatin1String(BASE_DIR "/test.pro"), false, &input);
|
||||||
ProFile *proFile = reader.parsedProFile(BASE_DIR "/test.pro", input);
|
|
||||||
QVERIFY(proFile);
|
QVERIFY(proFile);
|
||||||
if (add)
|
if (add)
|
||||||
Qt4ProjectManager::Internal::ProWriter::addFiles(proFile, &lines, baseDir, files, vars);
|
Qt4ProjectManager::Internal::ProWriter::addFiles(proFile, &lines, baseDir, files, vars.at(0));
|
||||||
else
|
else
|
||||||
Qt4ProjectManager::Internal::ProWriter::removeFiles(proFile, &lines, baseDir, files, vars);
|
Qt4ProjectManager::Internal::ProWriter::removeFiles(proFile, &lines, baseDir, files, vars);
|
||||||
|
|
||||||
@@ -290,9 +308,8 @@ void tst_ProFileWriter::multiVar()
|
|||||||
<< QString::fromLatin1(BASE_DIR "/bak");
|
<< QString::fromLatin1(BASE_DIR "/bak");
|
||||||
QStringList vars; vars << QLatin1String("SOURCES") << QLatin1String("HEADERS");
|
QStringList vars; vars << QLatin1String("SOURCES") << QLatin1String("HEADERS");
|
||||||
|
|
||||||
ProFileOption option;
|
ProFileParser parser(0, &parseHandler);
|
||||||
ProFileEvaluator reader(&option);
|
ProFile *proFile = parser.parsedProFile(QLatin1String(BASE_DIR "/test.pro"), false, &input);
|
||||||
ProFile *proFile = reader.parsedProFile(BASE_DIR "/test.pro", input);
|
|
||||||
QVERIFY(proFile);
|
QVERIFY(proFile);
|
||||||
Qt4ProjectManager::Internal::ProWriter::removeFiles(proFile, &lines, baseDir, files, vars);
|
Qt4ProjectManager::Internal::ProWriter::removeFiles(proFile, &lines, baseDir, files, vars);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user