Skip to content
Snippets Groups Projects
Commit 64bba7ed authored by Tobias Hunger's avatar Tobias Hunger
Browse files

Add simple unit tests for abld parser

parent deaa0cc1
No related branches found
No related tags found
No related merge requests found
...@@ -134,7 +134,6 @@ void OutputParserTester::stdError(const QString &line) ...@@ -134,7 +134,6 @@ void OutputParserTester::stdError(const QString &line)
void OutputParserTester::appendOutputParser(IOutputParser *parser) void OutputParserTester::appendOutputParser(IOutputParser *parser)
{ {
Q_ASSERT(!childParser()); Q_ASSERT(!childParser());
Q_ASSERT(!parser->childParser());
IOutputParser::appendOutputParser(parser); IOutputParser::appendOutputParser(parser);
parser->appendOutputParser(this); parser->appendOutputParser(this);
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#if defined(WITH_TESTS) #if defined(WITH_TESTS)
#include "projectexplorer_export.h" #include "projectexplorer_export.h"
#include "metatypedeclarations.h"
#include "ioutputparser.h" #include "ioutputparser.h"
namespace ProjectExplorer { namespace ProjectExplorer {
......
...@@ -174,3 +174,53 @@ void AbldParser::stdError(const QString &line) ...@@ -174,3 +174,53 @@ void AbldParser::stdError(const QString &line)
} }
IOutputParser::stdError(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 \ ...@@ -27,7 +27,6 @@ HEADERS += qt4projectmanagerplugin.h \
wizards/modulespage.h \ wizards/modulespage.h \
wizards/filespage.h \ wizards/filespage.h \
wizards/qtwizard.h \ wizards/qtwizard.h \
wizards/targetspage.h \
wizards/targetsetuppage.h \ wizards/targetsetuppage.h \
qt4projectmanagerconstants.h \ qt4projectmanagerconstants.h \
makestep.h \ makestep.h \
...@@ -69,7 +68,6 @@ SOURCES += qt4projectmanagerplugin.cpp \ ...@@ -69,7 +68,6 @@ SOURCES += qt4projectmanagerplugin.cpp \
wizards/modulespage.cpp \ wizards/modulespage.cpp \
wizards/filespage.cpp \ wizards/filespage.cpp \
wizards/qtwizard.cpp \ wizards/qtwizard.cpp \
wizards/targetspage.cpp \
wizards/targetsetuppage.cpp \ wizards/targetsetuppage.cpp \
makestep.cpp \ makestep.cpp \
qmakestep.cpp \ qmakestep.cpp \
......
...@@ -266,11 +266,6 @@ void Qt4ProjectManagerPlugin::testBasicProjectLoading() ...@@ -266,11 +266,6 @@ void Qt4ProjectManagerPlugin::testBasicProjectLoading()
QVERIFY(qt4project->rootProjectNode()->projectType() == ApplicationTemplate); QVERIFY(qt4project->rootProjectNode()->projectType() == ApplicationTemplate);
QVERIFY(m_projectExplorer->currentProject() != 0); QVERIFY(m_projectExplorer->currentProject() != 0);
} }
void Qt4ProjectManagerPlugin::testNotYetImplemented()
{
QCOMPARE(1+1, 2);
}
#endif #endif
Q_EXPORT_PLUGIN(Qt4ProjectManagerPlugin) Q_EXPORT_PLUGIN(Qt4ProjectManagerPlugin)
...@@ -76,7 +76,9 @@ private slots: ...@@ -76,7 +76,9 @@ private slots:
#ifdef WITH_TESTS #ifdef WITH_TESTS
void testBasicProjectLoading(); void testBasicProjectLoading();
void testNotYetImplemented();
void testAbldOutputParsers_data();
void testAbldOutputParsers();
#endif #endif
private: private:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment