aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/projectexplorer/outputparser_test.cpp
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2020-04-08 17:45:39 +0200
committerChristian Kandeler <christian.kandeler@qt.io>2020-04-09 14:49:32 +0000
commit45ba9fcd535e4cfd5f057149b1ca4bb4dfed5bdb (patch)
tree3e3246ccf3d971e69004182007bd1b726b88b8bf /src/plugins/projectexplorer/outputparser_test.cpp
parentfa517bd72aa21ea82072af27ce98030c4ff028f2 (diff)
Output parsers: Replace the chaining approach
Use "flat" aggregation instead. This is another step towards the formatter/parser merger. Along the way, also fix some some subclasses (mostly in BareMetal) that erroneously forwarded handled output to other parsers. Task-number: QTCREATORBUG-22665 Change-Id: I12947349ca663d2e6bbfc99efd069d69e2b54969 Reviewed-by: hjk <hjk@qt.io>
Diffstat (limited to 'src/plugins/projectexplorer/outputparser_test.cpp')
-rw-r--r--src/plugins/projectexplorer/outputparser_test.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/plugins/projectexplorer/outputparser_test.cpp b/src/plugins/projectexplorer/outputparser_test.cpp
index 8a2bebf09d..5ae0c46aed 100644
--- a/src/plugins/projectexplorer/outputparser_test.cpp
+++ b/src/plugins/projectexplorer/outputparser_test.cpp
@@ -53,12 +53,11 @@ void OutputParserTester::testParsing(const QString &lines,
const QString &childStdErrLines,
const QString &outputLines)
{
- if (!m_terminator) {
- m_terminator = new TestTerminator(this);
- appendOutputParser(m_terminator);
- }
+ const auto terminator = new TestTerminator(this);
+ if (!lineParsers().isEmpty())
+ terminator->setRedirectionDetector(lineParsers().last());
+ addLineParser(terminator);
reset();
- Q_ASSERT(childParser());
if (inputChannel == STDOUT)
handleStdout(lines + '\n');
@@ -68,7 +67,7 @@ void OutputParserTester::testParsing(const QString &lines,
// delete the parser(s) to test
emit aboutToDeleteParser();
- setChildParser(nullptr);
+ setLineParsers({});
QCOMPARE(m_receivedOutput, outputLines);
QCOMPARE(m_receivedStdErrChildLine, childStdErrLines);
@@ -103,13 +102,14 @@ TestTerminator::TestTerminator(OutputParserTester *t) :
m_tester(t)
{ }
-void TestTerminator::handleLine(const QString &line, Utils::OutputFormat type)
+IOutputParser::Status TestTerminator::doHandleLine(const QString &line, Utils::OutputFormat type)
{
- QVERIFY(line.endsWith('\n'));
+ QTC_CHECK(line.endsWith('\n'));
if (type == Utils::StdOutFormat)
m_tester->m_receivedStdOutChildLine.append(line);
else
m_tester->m_receivedStdErrChildLine.append(line);
+ return Status::Done;
}
} // namespace ProjectExplorer