diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2020-03-31 11:55:48 +0200 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2020-04-03 10:57:06 +0000 |
commit | cddaecfe216bccc970c225cc83b532c2c420cae8 (patch) | |
tree | ec060f804f78f63acc5c4c341713c97acbc993cf /src/plugins/projectexplorer/outputparser_test.cpp | |
parent | cced9c95eaac742c76e6aff3d9f7acb453baf3b1 (diff) |
ProjectExplorer: Clean up IOutputParser interface
- Remove unneeded/unused functions.
- De-virtualize where possible.
In particular, after untangling a number of self-referential
redirections, it became apparent that the outputAdded()
infrastructure was entirely unused.
Change-Id: I51e1beed008df2727b42494b087efa476342397e
Reviewed-by: hjk <hjk@qt.io>
Diffstat (limited to 'src/plugins/projectexplorer/outputparser_test.cpp')
-rw-r--r-- | src/plugins/projectexplorer/outputparser_test.cpp | 46 |
1 files changed, 5 insertions, 41 deletions
diff --git a/src/plugins/projectexplorer/outputparser_test.cpp b/src/plugins/projectexplorer/outputparser_test.cpp index 17834ff5c8..5c477dd42f 100644 --- a/src/plugins/projectexplorer/outputparser_test.cpp +++ b/src/plugins/projectexplorer/outputparser_test.cpp @@ -38,8 +38,6 @@ static inline QByteArray msgFileComparisonFail(const Utils::FilePath &f1, const return result.toLocal8Bit(); } -OutputParserTester::OutputParserTester() = default; - // test functions: void OutputParserTester::testParsing(const QString &lines, Channel inputChannel, @@ -48,6 +46,10 @@ void OutputParserTester::testParsing(const QString &lines, const QString &childStdErrLines, const QString &outputLines) { + if (!m_terminator) { + m_terminator = new TestTerminator(this); + appendOutputParser(m_terminator); + } reset(); Q_ASSERT(childParser()); @@ -60,18 +62,8 @@ void OutputParserTester::testParsing(const QString &lines, } childParser()->flush(); - // first disconnect ourselves from the end of the parser chain again - IOutputParser *parser = this; - while ( (parser = parser->childParser()) ) { - if (parser->childParser() == this) { - childParser()->takeOutputParserChain(); - break; - } - } - parser = nullptr; + // delete the parser(s) to test emit aboutToDeleteParser(); - - // then delete the parser(s) to test setChildParser(nullptr); QCOMPARE(m_receivedOutput, outputLines); @@ -110,39 +102,11 @@ void OutputParserTester::testTaskMangling(const Task &input, } } -void OutputParserTester::testOutputMangling(const QString &input, - const QString &output) -{ - reset(); - - childParser()->outputAdded(input, BuildStep::OutputFormat::Stdout); - - QCOMPARE(m_receivedOutput, output); - QVERIFY(m_receivedStdErrChildLine.isNull()); - QVERIFY(m_receivedStdOutChildLine.isNull()); - QVERIFY(m_receivedTasks.isEmpty()); -} - void OutputParserTester::setDebugEnabled(bool debug) { m_debug = debug; } -void OutputParserTester::appendOutputParser(IOutputParser *parser) -{ - Q_ASSERT(!childParser()); - parser->appendOutputParser(new TestTerminator(this)); - IOutputParser::appendOutputParser(parser); -} - -void OutputParserTester::outputAdded(const QString &line, BuildStep::OutputFormat format) -{ - Q_UNUSED(format) - if (!m_receivedOutput.isEmpty()) - m_receivedOutput.append('\n'); - m_receivedOutput.append(line); -} - void OutputParserTester::taskAdded(const Task &task, int linkedLines, int skipLines) { Q_UNUSED(linkedLines) |