Commit 90fe72ca authored by David Schulz's avatar David Schulz Committed by Christian Stenger

ProjectExplorer: fix Xcodebuild parser test.

Change-Id: Ic33d771c00c5e3afe53d217316a1fe91387ac989
Reviewed-by: default avatarChristian Stenger <christian.stenger@digia.com>
parent eebd4579
...@@ -122,6 +122,11 @@ XcodebuildParserTester::XcodebuildParserTester(XcodebuildParser *p, QObject *par ...@@ -122,6 +122,11 @@ XcodebuildParserTester::XcodebuildParserTester(XcodebuildParser *p, QObject *par
parser(p) parser(p)
{ } { }
void XcodebuildParserTester::onAboutToDeleteParser()
{
QCOMPARE(parser->m_xcodeBuildParserState, expectedFinalState);
}
void ProjectExplorerPlugin::testXcodebuildParserParsing_data() void ProjectExplorerPlugin::testXcodebuildParserParsing_data()
{ {
QTest::addColumn<ProjectExplorer::XcodebuildParser::XcodebuildStatus>("initialStatus"); QTest::addColumn<ProjectExplorer::XcodebuildParser::XcodebuildStatus>("initialStatus");
...@@ -243,6 +248,8 @@ void ProjectExplorerPlugin::testXcodebuildParserParsing() ...@@ -243,6 +248,8 @@ void ProjectExplorerPlugin::testXcodebuildParserParsing()
XcodebuildParser *childParser = new XcodebuildParser; XcodebuildParser *childParser = new XcodebuildParser;
XcodebuildParserTester *tester = new XcodebuildParserTester(childParser); XcodebuildParserTester *tester = new XcodebuildParserTester(childParser);
connect(&testbench, SIGNAL(aboutToDeleteParser()), tester, SLOT(onAboutToDeleteParser()));
testbench.appendOutputParser(childParser); testbench.appendOutputParser(childParser);
QFETCH(ProjectExplorer::XcodebuildParser::XcodebuildStatus, initialStatus); QFETCH(ProjectExplorer::XcodebuildParser::XcodebuildStatus, initialStatus);
QFETCH(QString, input); QFETCH(QString, input);
...@@ -253,11 +260,11 @@ void ProjectExplorerPlugin::testXcodebuildParserParsing() ...@@ -253,11 +260,11 @@ void ProjectExplorerPlugin::testXcodebuildParserParsing()
QFETCH(QString, outputLines); QFETCH(QString, outputLines);
QFETCH(ProjectExplorer::XcodebuildParser::XcodebuildStatus, finalStatus); QFETCH(ProjectExplorer::XcodebuildParser::XcodebuildStatus, finalStatus);
tester->expectedFinalState = finalStatus;
childParser->m_xcodeBuildParserState = initialStatus; childParser->m_xcodeBuildParserState = initialStatus;
testbench.testParsing(input, inputChannel, testbench.testParsing(input, inputChannel,
tasks, childStdOutLines, childStdErrLines, tasks, childStdOutLines, childStdErrLines,
outputLines); outputLines);
QCOMPARE(childParser->m_xcodeBuildParserState, finalStatus);
delete tester; delete tester;
} }
......
...@@ -62,6 +62,7 @@ private: ...@@ -62,6 +62,7 @@ private:
QString m_lastTarget; QString m_lastTarget;
QString m_lastProject; QString m_lastProject;
#if defined WITH_TESTS #if defined WITH_TESTS
friend class XcodebuildParserTester;
friend class ProjectExplorerPlugin; friend class ProjectExplorerPlugin;
#endif #endif
}; };
...@@ -74,6 +75,10 @@ public: ...@@ -74,6 +75,10 @@ public:
explicit XcodebuildParserTester(XcodebuildParser *parser, QObject *parent = 0); explicit XcodebuildParserTester(XcodebuildParser *parser, QObject *parent = 0);
XcodebuildParser *parser; XcodebuildParser *parser;
XcodebuildParser::XcodebuildStatus expectedFinalState;
public slots:
void onAboutToDeleteParser();
}; };
#endif #endif
......
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