Commit 15bb1b0c authored by Tobias Hunger's avatar Tobias Hunger
Browse files

Parser: Make parser test engine more strict

 * Fix unit tests to work with this stricter version

Change-Id: Iaf6d333e4b4df54ddc340d261ce28538bfa1f3cf
parent 58dac308
......@@ -152,12 +152,12 @@ void ProjectExplorerPlugin::testGccOutputParsers_data()
QTest::newRow("pass-through stdout")
<< QString::fromLatin1("Sometext") << OutputParserTester::STDOUT
<< QString::fromLatin1("Sometext") << QString()
<< QString::fromLatin1("Sometext\n") << QString()
<< QList<ProjectExplorer::Task>()
<< QString();
QTest::newRow("pass-through stderr")
<< QString::fromLatin1("Sometext") << OutputParserTester::STDERR
<< QString() << QString::fromLatin1("Sometext")
<< QString() << QString::fromLatin1("Sometext\n")
<< QList<ProjectExplorer::Task>()
<< QString();
......@@ -337,7 +337,7 @@ void ProjectExplorerPlugin::testGccOutputParsers_data()
"distcc[73168] (dcc_build_somewhere) Warning: failed to distribute, running locally instead")
<< OutputParserTester::STDERR
<< QString() << QString::fromLatin1("distcc[73168] (dcc_get_hostlist) Warning: no hostlist is set; can't distribute work\n"
"distcc[73168] (dcc_build_somewhere) Warning: failed to distribute, running locally instead")
"distcc[73168] (dcc_build_somewhere) Warning: failed to distribute, running locally instead\n")
<< QList<ProjectExplorer::Task>()
<< QString();
QTest::newRow("ld warning (QTCREATORBUG-905)")
......@@ -363,7 +363,7 @@ void ProjectExplorerPlugin::testGccOutputParsers_data()
QTest::newRow("Teambuilder issues")
<< QString::fromLatin1("TeamBuilder Client:: error: could not find Scheduler, running Job locally...")
<< OutputParserTester::STDERR
<< QString() << QString::fromLatin1("TeamBuilder Client:: error: could not find Scheduler, running Job locally...")
<< QString() << QString::fromLatin1("TeamBuilder Client:: error: could not find Scheduler, running Job locally...\n")
<< QList<ProjectExplorer::Task>()
<< QString();
QTest::newRow("note")
......@@ -394,13 +394,13 @@ void ProjectExplorerPlugin::testGccOutputParsers_data()
QTest::newRow("rm false positive")
<< QString::fromLatin1("rm: cannot remove `release/moc_mainwindow.cpp': No such file or directory")
<< OutputParserTester::STDERR
<< QString() << QString("rm: cannot remove `release/moc_mainwindow.cpp': No such file or directory")
<< QString() << QString("rm: cannot remove `release/moc_mainwindow.cpp': No such file or directory\n")
<< QList<ProjectExplorer::Task>()
<< QString();
QTest::newRow("ranlib false positive")
<< QString::fromLatin1("ranlib: file: libSupport.a(HashTable.o) has no symbols")
<< OutputParserTester::STDERR
<< QString() << QString("ranlib: file: libSupport.a(HashTable.o) has no symbols")
<< QString() << QString("ranlib: file: libSupport.a(HashTable.o) has no symbols\n")
<< QList<ProjectExplorer::Task>()
<< QString();
QTest::newRow("ld: missing library")
......
......@@ -204,14 +204,14 @@ void ProjectExplorerPlugin::testGnuMakeParserParsing_data()
QTest::newRow("pass-through stdout")
<< QStringList()
<< QString::fromLatin1("Sometext") << OutputParserTester::STDOUT
<< QString::fromLatin1("Sometext") << QString()
<< QString::fromLatin1("Sometext\n") << QString()
<< QList<Task>()
<< QString()
<< QStringList();
QTest::newRow("pass-through stderr")
<< QStringList()
<< QString::fromLatin1("Sometext") << OutputParserTester::STDERR
<< QString() << QString::fromLatin1("Sometext")
<< QString() << QString::fromLatin1("Sometext\n")
<< QList<Task>()
<< QString()
<< QStringList();
......@@ -221,7 +221,7 @@ void ProjectExplorerPlugin::testGnuMakeParserParsing_data()
"../../scriptbug/main.cpp: At global scope:\n"
"../../scriptbug/main.cpp: In instantiation of void bar(i) [with i = double]:\n"
"../../scriptbug/main.cpp:8: instantiated from void foo(i) [with i = double]\n"
"../../scriptbug/main.cpp:22: instantiated from here\n")
"../../scriptbug/main.cpp:22: instantiated from here")
<< OutputParserTester::STDERR
<< QString()
<< QString::fromLatin1("/temp/test/untitled8/main.cpp: In function `int main(int, char**)':\n"
......@@ -237,7 +237,7 @@ void ProjectExplorerPlugin::testGnuMakeParserParsing_data()
QTest::newRow("entering directory")
<< (QStringList() << QString::fromLatin1("/test/dir") )
<< QString::fromLatin1("make[4]: Entering directory `/home/code/build/qt/examples/opengl/grabber'\n"
"make[4]: Entering directory `/home/code/build/qt/examples/opengl/grabber'\n")
"make[4]: Entering directory `/home/code/build/qt/examples/opengl/grabber'")
<< OutputParserTester::STDOUT
<< QString() << QString()
<< QList<Task>()
......@@ -320,7 +320,7 @@ void ProjectExplorerPlugin::testGnuMakeParserParsing_data()
<< QStringList()
<< QString::fromLatin1("/home/dev/creator/share/qtcreator/gdbmacros/gdbmacros.cpp:1079: note: initialized from here")
<< OutputParserTester::STDERR
<< QString() << QString::fromLatin1("/home/dev/creator/share/qtcreator/gdbmacros/gdbmacros.cpp:1079: note: initialized from here")
<< QString() << QString::fromLatin1("/home/dev/creator/share/qtcreator/gdbmacros/gdbmacros.cpp:1079: note: initialized from here\n")
<< QList<ProjectExplorer::Task>()
<< QString()
<< QStringList();
......
......@@ -131,12 +131,12 @@ void ProjectExplorerPlugin::testLinuxIccOutputParsers_data()
QTest::newRow("pass-through stdout")
<< QString::fromLatin1("Sometext") << OutputParserTester::STDOUT
<< QString::fromLatin1("Sometext") << QString()
<< QString::fromLatin1("Sometext\n") << QString()
<< QList<ProjectExplorer::Task>()
<< QString();
QTest::newRow("pass-through stderr")
<< QString::fromLatin1("Sometext") << OutputParserTester::STDERR
<< QString() << QString::fromLatin1("Sometext")
<< QString() << QString::fromLatin1("Sometext\n")
<< QList<ProjectExplorer::Task>()
<< QString();
......@@ -146,7 +146,7 @@ void ProjectExplorerPlugin::testLinuxIccOutputParsers_data()
" ^\n"
"\n")
<< OutputParserTester::STDERR
<< QString() << QString()
<< QString() << QString::fromLatin1("\n")
<< (QList<ProjectExplorer::Task>()
<< Task(Task::Error,
QLatin1String("identifier \"f\" is undefined\nf(0);"),
......@@ -160,7 +160,7 @@ void ProjectExplorerPlugin::testLinuxIccOutputParsers_data()
" ^\n"
"\n")
<< OutputParserTester::STDERR
<< QString() << QString()
<< QString() << QString::fromLatin1("\n")
<< (QList<ProjectExplorer::Task>()
<< Task(Task::Error,
QLatin1String("function \"AClass::privatefunc\" (declared at line 4 of \"main.h\") is inaccessible\nb.privatefunc();"),
......@@ -174,7 +174,7 @@ void ProjectExplorerPlugin::testLinuxIccOutputParsers_data()
" ^\n"
"\n")
<< OutputParserTester::STDERR
<< QString() << QString()
<< QString() << QString::fromLatin1("\n")
<< (QList<ProjectExplorer::Task>()
<< Task(Task::Warning,
QLatin1String("use of \"=\" where \"==\" may have been intended\nwhile (a = true)"),
......
......@@ -163,12 +163,12 @@ void ProjectExplorerPlugin::testMsvcOutputParsers_data()
QTest::newRow("pass-through stdout")
<< QString::fromLatin1("Sometext") << OutputParserTester::STDOUT
<< QString::fromLatin1("Sometext") << QString()
<< QString::fromLatin1("Sometext\n") << QString()
<< QList<ProjectExplorer::Task>()
<< QString();
QTest::newRow("pass-through stderr")
<< QString::fromLatin1("Sometext") << OutputParserTester::STDERR
<< QString() << QString::fromLatin1("Sometext")
<< QString() << QString::fromLatin1("Sometext\n")
<< QList<ProjectExplorer::Task>()
<< QString();
......
......@@ -63,9 +63,9 @@ void OutputParserTester::testParsing(const QString &lines,
QStringList inputLines = lines.split(QChar('\n'));
foreach (const QString &input, inputLines) {
if (inputChannel == STDOUT)
childParser()->stdOutput(input);
childParser()->stdOutput(input + QLatin1Char('\n'));
else
childParser()->stdError(input);
childParser()->stdError(input + QLatin1Char('\n'));
}
// first disconnect ourselves from the end of the parser chain again
IOutputParser * parser = this;
......@@ -91,7 +91,7 @@ void OutputParserTester::testParsing(const QString &lines,
QCOMPARE(m_receivedTasks.at(i).description, tasks.at(i).description);
QCOMPARE(m_receivedTasks.at(i).file, tasks.at(i).file);
QCOMPARE(m_receivedTasks.at(i).line, tasks.at(i).line);
QCOMPARE(m_receivedTasks.at(i).type, tasks.at(i).type);
QCOMPARE(static_cast<int>(m_receivedTasks.at(i).type), static_cast<int>(tasks.at(i).type));
}
}
}
......@@ -135,15 +135,13 @@ void OutputParserTester::setDebugEnabled(bool debug)
void OutputParserTester::stdOutput(const QString &line)
{
if (!m_receivedStdOutChildLine.isEmpty())
m_receivedStdOutChildLine.append(QChar('\n'));
QVERIFY(line.endsWith(QLatin1Char('\n')));
m_receivedStdOutChildLine.append(line);
}
void OutputParserTester::stdError(const QString &line)
{
if (!m_receivedStdErrChildLine.isEmpty())
m_receivedStdErrChildLine.append(QChar('\n'));
QVERIFY(line.endsWith(QLatin1Char('\n')));
m_receivedStdErrChildLine.append(line);
}
......
......@@ -224,6 +224,9 @@ private slots:
void testGccOutputParsers_data();
void testGccOutputParsers();
void testClangOutputParser_data();
void testClangOutputParser();
void testLinuxIccOutputParsers_data();
void testLinuxIccOutputParsers();
......
......@@ -116,12 +116,12 @@ void Qt4ProjectManagerPlugin::testQmakeOutputParsers_data()
QTest::newRow("pass-through stdout")
<< QString::fromLatin1("Sometext") << OutputParserTester::STDOUT
<< QString::fromLatin1("Sometext") << QString()
<< QString::fromLatin1("Sometext\n") << QString()
<< QList<ProjectExplorer::Task>()
<< QString();
QTest::newRow("pass-through stderr")
<< QString::fromLatin1("Sometext") << OutputParserTester::STDERR
<< QString() << QString::fromLatin1("Sometext")
<< QString() << QString::fromLatin1("Sometext\n")
<< QList<ProjectExplorer::Task>()
<< QString();
......
......@@ -210,12 +210,12 @@ void Qt4ProjectManagerPlugin::testAbldOutputParsers_data()
QTest::newRow("pass-through stdout")
<< QString::fromLatin1("Sometext") << OutputParserTester::STDOUT
<< QString::fromLatin1("Sometext") << QString()
<< QString::fromLatin1("Sometext\n") << QString()
<< QList<ProjectExplorer::Task>()
<< QString();
QTest::newRow("pass-through stderr")
<< QString::fromLatin1("Sometext") << OutputParserTester::STDERR
<< QString() << QString::fromLatin1("Sometext")
<< QString() << QString::fromLatin1("Sometext\n")
<< QList<ProjectExplorer::Task>()
<< QString();
}
......
......@@ -157,12 +157,12 @@ void Qt4ProjectManagerPlugin::testRvctOutputParser_data()
QTest::newRow("pass-through stdout")
<< QString::fromLatin1("Sometext") << OutputParserTester::STDOUT
<< QString::fromLatin1("Sometext") << QString()
<< QString::fromLatin1("Sometext\n") << QString()
<< QList<ProjectExplorer::Task>()
<< QString();
QTest::newRow("pass-through stderr")
<< QString::fromLatin1("Sometext") << OutputParserTester::STDERR
<< QString() << QString::fromLatin1("Sometext")
<< QString() << QString::fromLatin1("Sometext\n")
<< QList<ProjectExplorer::Task>()
<< QString();
......
......@@ -98,12 +98,12 @@ void Qt4ProjectManagerPlugin::testQtOutputParser_data()
QTest::newRow("pass-through stdout")
<< QString::fromLatin1("Sometext") << OutputParserTester::STDOUT
<< QString::fromLatin1("Sometext") << QString()
<< QString::fromLatin1("Sometext\n") << QString()
<< QList<ProjectExplorer::Task>()
<< QString();
QTest::newRow("pass-through stderr")
<< QString::fromLatin1("Sometext") << OutputParserTester::STDERR
<< QString() << QString::fromLatin1("Sometext")
<< QString() << QString::fromLatin1("Sometext\n")
<< QList<ProjectExplorer::Task>()
<< QString();
QTest::newRow("pass-through gcc infos")
......@@ -111,7 +111,7 @@ void Qt4ProjectManagerPlugin::testQtOutputParser_data()
"../../scriptbug/main.cpp: At global scope:\n"
"../../scriptbug/main.cpp: In instantiation of void bar(i) [with i = double]:\n"
"../../scriptbug/main.cpp:8: instantiated from void foo(i) [with i = double]\n"
"../../scriptbug/main.cpp:22: instantiated from here\n")
"../../scriptbug/main.cpp:22: instantiated from here")
<< OutputParserTester::STDERR
<< QString()
<< QString::fromLatin1("/temp/test/untitled8/main.cpp: In function `int main(int, char**)':\n"
......
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