forked from qt-creator/qt-creator
CustomParser: Modernize
Change-Id: I07b512ac1ecb3c07c33859892d06f4b1bbc0b69f Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
committed by
André Hartmann
parent
d7a0750a7f
commit
35844008e2
@@ -113,7 +113,7 @@ bool CustomParserSettings::operator ==(const CustomParserSettings &other) const
|
||||
|
||||
CustomParser::CustomParser(const CustomParserSettings &settings)
|
||||
{
|
||||
setObjectName(QLatin1String("CustomParser"));
|
||||
setObjectName("CustomParser");
|
||||
|
||||
setSettings(settings);
|
||||
}
|
||||
@@ -205,8 +205,8 @@ void ProjectExplorerPlugin::testCustomOutputParsers_data()
|
||||
QTest::addColumn<QString>("outputLines");
|
||||
|
||||
const Core::Id categoryCompile = Constants::TASK_CATEGORY_COMPILE;
|
||||
const QString simplePattern = QLatin1String("^([a-z]+\\.[a-z]+):(\\d+): error: ([^\\s].+)$");
|
||||
const FileName fileName = FileName::fromUserInput(QLatin1String("main.c"));
|
||||
const QString simplePattern = "^([a-z]+\\.[a-z]+):(\\d+): error: ([^\\s].+)$";
|
||||
const FileName fileName = FileName::fromUserInput("main.c");
|
||||
|
||||
QTest::newRow("empty patterns")
|
||||
<< QString::fromLatin1("Sometext")
|
||||
@@ -238,9 +238,9 @@ void ProjectExplorerPlugin::testCustomOutputParsers_data()
|
||||
<< QList<Task>()
|
||||
<< QString();
|
||||
|
||||
const QString simpleError = QLatin1String("main.c:9: error: `sfasdf' undeclared (first use this function)");
|
||||
const QString simpleErrorPassThrough = simpleError + QLatin1Char('\n');
|
||||
const QString message = QLatin1String("`sfasdf' undeclared (first use this function)");
|
||||
const QString simpleError = "main.c:9: error: `sfasdf' undeclared (first use this function)";
|
||||
const QString simpleErrorPassThrough = simpleError + '\n';
|
||||
const QString message = "`sfasdf' undeclared (first use this function)";
|
||||
|
||||
QTest::newRow("simple error")
|
||||
<< simpleError
|
||||
@@ -249,9 +249,7 @@ void ProjectExplorerPlugin::testCustomOutputParsers_data()
|
||||
<< simplePattern << 1 << 2 << 3
|
||||
<< QString() << 0 << 0 << 0
|
||||
<< QString() << QString()
|
||||
<< (QList<Task>()
|
||||
<< Task(Task::Error, message, fileName, 9, categoryCompile)
|
||||
)
|
||||
<< QList<Task>{Task(Task::Error, message, fileName, 9, categoryCompile)}
|
||||
<< QString();
|
||||
|
||||
QTest::newRow("simple error on wrong channel")
|
||||
@@ -274,8 +272,8 @@ void ProjectExplorerPlugin::testCustomOutputParsers_data()
|
||||
<< QList<Task>()
|
||||
<< QString();
|
||||
|
||||
const QString simpleError2 = QLatin1String("Error: Line 19 in main.c: `sfasdf' undeclared (first use this function)");
|
||||
const QString simplePattern2 = QLatin1String("^Error: Line (\\d+) in ([a-z]+\\.[a-z]+): ([^\\s].+)$");
|
||||
const QString simpleError2 = "Error: Line 19 in main.c: `sfasdf' undeclared (first use this function)";
|
||||
const QString simplePattern2 = "^Error: Line (\\d+) in ([a-z]+\\.[a-z]+): ([^\\s].+)$";
|
||||
const int lineNumber2 = 19;
|
||||
|
||||
QTest::newRow("another simple error on stderr")
|
||||
@@ -285,9 +283,7 @@ void ProjectExplorerPlugin::testCustomOutputParsers_data()
|
||||
<< simplePattern2 << 2 << 1 << 3
|
||||
<< QString() << 1 << 2 << 3
|
||||
<< QString() << QString()
|
||||
<< (QList<Task>()
|
||||
<< Task(Task::Error, message, fileName, lineNumber2, categoryCompile)
|
||||
)
|
||||
<< QList<Task>{Task(Task::Error, message, fileName, lineNumber2, categoryCompile)}
|
||||
<< QString();
|
||||
|
||||
QTest::newRow("another simple error on stdout")
|
||||
@@ -297,14 +293,12 @@ void ProjectExplorerPlugin::testCustomOutputParsers_data()
|
||||
<< simplePattern2 << 2 << 1 << 3
|
||||
<< QString() << 1 << 2 << 3
|
||||
<< QString() << QString()
|
||||
<< (QList<Task>()
|
||||
<< Task(Task::Error, message, fileName, lineNumber2, categoryCompile)
|
||||
)
|
||||
<< QList<Task>{Task(Task::Error, message, fileName, lineNumber2, categoryCompile)}
|
||||
<< QString();
|
||||
|
||||
const QString simpleWarningPattern = QLatin1String("^([a-z]+\\.[a-z]+):(\\d+): warning: ([^\\s].+)$");
|
||||
const QString simpleWarning = QLatin1String("main.c:1234: warning: `helloWorld' declared but not used");
|
||||
const QString warningMessage = QLatin1String("`helloWorld' declared but not used");
|
||||
const QString simpleWarningPattern = "^([a-z]+\\.[a-z]+):(\\d+): warning: ([^\\s].+)$";
|
||||
const QString simpleWarning = "main.c:1234: warning: `helloWorld' declared but not used";
|
||||
const QString warningMessage = "`helloWorld' declared but not used";
|
||||
|
||||
QTest::newRow("simple warning")
|
||||
<< simpleWarning
|
||||
@@ -313,14 +307,12 @@ void ProjectExplorerPlugin::testCustomOutputParsers_data()
|
||||
<< QString() << 1 << 2 << 3
|
||||
<< simpleWarningPattern << 1 << 2 << 3
|
||||
<< QString() << QString()
|
||||
<< (QList<Task>()
|
||||
<< Task(Task::Warning, warningMessage, fileName, 1234, categoryCompile)
|
||||
)
|
||||
<< QList<Task>{Task(Task::Warning, warningMessage, fileName, 1234, categoryCompile)}
|
||||
<< QString();
|
||||
|
||||
const QString simpleWarning2 = QLatin1String("Warning: `helloWorld' declared but not used (main.c:19)");
|
||||
const QString simpleWarningPassThrough2 = simpleWarning2 + QLatin1Char('\n');
|
||||
const QString simpleWarningPattern2 = QLatin1String("^Warning: (.*) \\(([a-z]+\\.[a-z]+):(\\d+)\\)$");
|
||||
const QString simpleWarning2 = "Warning: `helloWorld' declared but not used (main.c:19)";
|
||||
const QString simpleWarningPassThrough2 = simpleWarning2 + '\n';
|
||||
const QString simpleWarningPattern2 = "^Warning: (.*) \\(([a-z]+\\.[a-z]+):(\\d+)\\)$";
|
||||
|
||||
QTest::newRow("another simple warning on stdout")
|
||||
<< simpleWarning2
|
||||
@@ -329,9 +321,7 @@ void ProjectExplorerPlugin::testCustomOutputParsers_data()
|
||||
<< simplePattern2 << 1 << 2 << 3
|
||||
<< simpleWarningPattern2 << 2 << 3 << 1
|
||||
<< QString() << QString()
|
||||
<< (QList<Task>()
|
||||
<< Task(Task::Warning, warningMessage, fileName, lineNumber2, categoryCompile)
|
||||
)
|
||||
<< QList<Task>{Task(Task::Warning, warningMessage, fileName, lineNumber2, categoryCompile)}
|
||||
<< QString();
|
||||
|
||||
QTest::newRow("warning on wrong channel")
|
||||
@@ -361,9 +351,7 @@ void ProjectExplorerPlugin::testCustomOutputParsers_data()
|
||||
<< simplePattern << 1 << 2 << 3
|
||||
<< simpleWarningPattern << 1 << 2 << 3
|
||||
<< QString() << QString()
|
||||
<< (QList<Task>()
|
||||
<< Task(Task::Warning, warningMessage, fileName, 1234, categoryCompile)
|
||||
)
|
||||
<< QList<Task>{Task(Task::Warning, warningMessage, fileName, 1234, categoryCompile)}
|
||||
<< QString();
|
||||
|
||||
QTest::newRow("*error* when equal pattern")
|
||||
@@ -373,15 +361,13 @@ void ProjectExplorerPlugin::testCustomOutputParsers_data()
|
||||
<< simplePattern << 1 << 2 << 3
|
||||
<< simplePattern << 1 << 2 << 3
|
||||
<< QString() << QString()
|
||||
<< (QList<Task>()
|
||||
<< Task(Task::Error, message, fileName, 9, categoryCompile)
|
||||
)
|
||||
<< QList<Task>{Task(Task::Error, message, fileName, 9, categoryCompile)}
|
||||
<< QString();
|
||||
|
||||
const QString unitTestError = QLatin1String("../LedDriver/LedDriverTest.c:63: FAIL: Expected 0x0080 Was 0xffff");
|
||||
const FileName unitTestFileName = FileName::fromUserInput(QLatin1String("../LedDriver/LedDriverTest.c"));
|
||||
const QString unitTestMessage = QLatin1String("Expected 0x0080 Was 0xffff");
|
||||
const QString unitTestPattern = QLatin1String("^([^:]+):(\\d+): FAIL: ([^\\s].+)$");
|
||||
const QString unitTestError = "../LedDriver/LedDriverTest.c:63: FAIL: Expected 0x0080 Was 0xffff";
|
||||
const FileName unitTestFileName = FileName::fromUserInput("../LedDriver/LedDriverTest.c");
|
||||
const QString unitTestMessage = "Expected 0x0080 Was 0xffff";
|
||||
const QString unitTestPattern = "^([^:]+):(\\d+): FAIL: ([^\\s].+)$";
|
||||
const int unitTestLineNumber = 63;
|
||||
|
||||
QTest::newRow("unit test error")
|
||||
@@ -391,9 +377,7 @@ void ProjectExplorerPlugin::testCustomOutputParsers_data()
|
||||
<< unitTestPattern << 1 << 2 << 3
|
||||
<< QString() << 1 << 2 << 3
|
||||
<< QString() << QString()
|
||||
<< (QList<Task>()
|
||||
<< Task(Task::Error, unitTestMessage, unitTestFileName, unitTestLineNumber, categoryCompile)
|
||||
)
|
||||
<< QList<Task>{Task(Task::Error, unitTestMessage, unitTestFileName, unitTestLineNumber, categoryCompile)}
|
||||
<< QString();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user