Commit 64bba7ed authored by Tobias Hunger's avatar Tobias Hunger

Add simple unit tests for abld parser

parent deaa0cc1
......@@ -134,7 +134,6 @@ void OutputParserTester::stdError(const QString &line)
void OutputParserTester::appendOutputParser(IOutputParser *parser)
{
Q_ASSERT(!childParser());
Q_ASSERT(!parser->childParser());
IOutputParser::appendOutputParser(parser);
parser->appendOutputParser(this);
......
......@@ -33,6 +33,7 @@
#if defined(WITH_TESTS)
#include "projectexplorer_export.h"
#include "metatypedeclarations.h"
#include "ioutputparser.h"
namespace ProjectExplorer {
......
......@@ -174,3 +174,53 @@ void AbldParser::stdError(const QString &line)
}
IOutputParser::stdError(line);
}
// Unit tests:
#ifdef WITH_TESTS
# include <QTest>
# include "qt4projectmanagerplugin.h"
# include "projectexplorer/outputparser_test.h"
using namespace Qt4ProjectManager::Internal;
void Qt4ProjectManagerPlugin::testAbldOutputParsers_data()
{
QTest::addColumn<QString>("input");
QTest::addColumn<OutputParserTester::Channel>("inputChannel");
QTest::addColumn<QString>("childStdOutLines");
QTest::addColumn<QString>("childStdErrLines");
QTest::addColumn<QList<ProjectExplorer::Task> >("tasks");
QTest::addColumn<QString>("outputLines");
QTest::newRow("pass-through stdout")
<< QString::fromLatin1("Sometext") << OutputParserTester::STDOUT
<< QString::fromLatin1("Sometext") << QString()
<< QList<ProjectExplorer::Task>()
<< QString();
QTest::newRow("pass-through stderr")
<< QString::fromLatin1("Sometext") << OutputParserTester::STDERR
<< QString() << QString::fromLatin1("Sometext")
<< QList<ProjectExplorer::Task>()
<< QString();
}
void Qt4ProjectManagerPlugin::testAbldOutputParsers()
{
OutputParserTester testbench;
testbench.appendOutputParser(new AbldParser);
QFETCH(QString, input);
QFETCH(OutputParserTester::Channel, inputChannel);
QFETCH(QList<Task>, tasks);
QFETCH(QString, childStdOutLines);
QFETCH(QString, childStdErrLines);
QFETCH(QString, outputLines);
testbench.testParsing(input, inputChannel,
tasks, childStdOutLines, childStdErrLines,
outputLines);
}
#endif
......@@ -27,7 +27,6 @@ HEADERS += qt4projectmanagerplugin.h \
wizards/modulespage.h \
wizards/filespage.h \
wizards/qtwizard.h \
wizards/targetspage.h \
wizards/targetsetuppage.h \
qt4projectmanagerconstants.h \
makestep.h \
......@@ -69,7 +68,6 @@ SOURCES += qt4projectmanagerplugin.cpp \
wizards/modulespage.cpp \
wizards/filespage.cpp \
wizards/qtwizard.cpp \
wizards/targetspage.cpp \
wizards/targetsetuppage.cpp \
makestep.cpp \
qmakestep.cpp \
......
......@@ -266,11 +266,6 @@ void Qt4ProjectManagerPlugin::testBasicProjectLoading()
QVERIFY(qt4project->rootProjectNode()->projectType() == ApplicationTemplate);
QVERIFY(m_projectExplorer->currentProject() != 0);
}
void Qt4ProjectManagerPlugin::testNotYetImplemented()
{
QCOMPARE(1+1, 2);
}
#endif
Q_EXPORT_PLUGIN(Qt4ProjectManagerPlugin)
......@@ -76,7 +76,9 @@ private slots:
#ifdef WITH_TESTS
void testBasicProjectLoading();
void testNotYetImplemented();
void testAbldOutputParsers_data();
void testAbldOutputParsers();
#endif
private:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment