aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Kandeler <[email protected]>2025-06-27 12:30:02 +0200
committerChristian Kandeler <[email protected]>2025-06-30 08:59:53 +0000
commitc1f917ee490b6e504c31e23da4b95efcf734cae6 (patch)
tree0b1123790dc56830b3a964b47b346fcb43548f15
parent7cb29488ac169d2b5e034d0fb8efae9f32ea7666 (diff)
ProjectExplorer: Add dedicated test classesHEADmaster
... for MSVC and ClangCl output parsers. Change-Id: I6a6f5bf0e90072d214f5538a126fe238062609bf Reviewed-by: Christian Stenger <[email protected]>
-rw-r--r--src/plugins/projectexplorer/msvcparser.cpp327
-rw-r--r--src/plugins/projectexplorer/msvcparser.h5
-rw-r--r--src/plugins/projectexplorer/projectexplorer.cpp3
-rw-r--r--src/plugins/projectexplorer/projectexplorer_test.h6
4 files changed, 186 insertions, 155 deletions
diff --git a/src/plugins/projectexplorer/msvcparser.cpp b/src/plugins/projectexplorer/msvcparser.cpp
index be82fcb13d4..2487be3cc34 100644
--- a/src/plugins/projectexplorer/msvcparser.cpp
+++ b/src/plugins/projectexplorer/msvcparser.cpp
@@ -10,8 +10,15 @@
#include <numeric>
+#ifdef WITH_TESTS
+#include "outputparser_test.h"
+#include <QTest>
+#endif
+
using namespace Utils;
+namespace ProjectExplorer {
+
// As of MSVC 2015: "foo.cpp(42) :" -> "foo.cpp(42):"
static const char FILE_POS_PATTERN[] = "^(?:\\d+>)?(cl|LINK|.+?[^ ]) ?: ";
@@ -42,8 +49,6 @@ static QPair<FilePath, int> parseFileName(const QString &input)
return {FilePath::fromUserInput(normalized), linenumber};
}
-using namespace ProjectExplorer;
-
// nmake/jom messages.
static Task handleNmakeJomMessage(const QString &line)
{
@@ -256,49 +261,50 @@ OutputLineParser::Result ClangClParser::handleLine(const QString &line, OutputFo
// Unit tests:
#ifdef WITH_TESTS
-# include <QTest>
-# include "projectexplorer_test.h"
-# include "projectexplorer/outputparser_test.h"
-
-namespace ProjectExplorer::Internal {
-void ProjectExplorerTest::testMsvcOutputParsers_data()
+namespace Internal {
+class MsvcParserTest : public QObject
{
- QTest::addColumn<QString>("input");
- QTest::addColumn<OutputParserTester::Channel>("inputChannel");
- QTest::addColumn<QStringList>("childStdOutLines");
- QTest::addColumn<QStringList>("childStdErrLines");
- QTest::addColumn<Tasks >("tasks");
-
- auto compileTask = [](Task::TaskType type,
- const QString &description,
- const Utils::FilePath &file,
- int line,
- const QList<QTextLayout::FormatRange> formats)
- {
- CompileTask task(type, description, file, line);
- task.setFormats(formats);
- return task;
- };
+ Q_OBJECT
- auto formatRange = [](int start, int length, const QString &anchorHref = QString())
+private slots:
+ void test_data()
{
- QTextCharFormat format;
- format.setAnchorHref(anchorHref);
-
- return QTextLayout::FormatRange{start, length, format};
- };
-
- QTest::newRow("pass-through stdout")
+ QTest::addColumn<QString>("input");
+ QTest::addColumn<OutputParserTester::Channel>("inputChannel");
+ QTest::addColumn<QStringList>("childStdOutLines");
+ QTest::addColumn<QStringList>("childStdErrLines");
+ QTest::addColumn<Tasks >("tasks");
+
+ auto compileTask = [](Task::TaskType type,
+ const QString &description,
+ const Utils::FilePath &file,
+ int line,
+ const QList<QTextLayout::FormatRange> formats)
+ {
+ CompileTask task(type, description, file, line);
+ task.setFormats(formats);
+ return task;
+ };
+
+ auto formatRange = [](int start, int length, const QString &anchorHref = QString())
+ {
+ QTextCharFormat format;
+ format.setAnchorHref(anchorHref);
+
+ return QTextLayout::FormatRange{start, length, format};
+ };
+
+ QTest::newRow("pass-through stdout")
<< "Sometext" << OutputParserTester::STDOUT
<< QStringList("Sometext") << QStringList()
<< Tasks();
- QTest::newRow("pass-through stderr")
+ QTest::newRow("pass-through stderr")
<< "Sometext" << OutputParserTester::STDERR
<< QStringList() << QStringList("Sometext")
<< Tasks();
- QTest::newRow("labeled error")
+ QTest::newRow("labeled error")
<< "qmlstandalone\\main.cpp(54) : error C4716: 'findUnresolvedModule' : must return a value"
<< OutputParserTester::STDOUT
<< QStringList() << QStringList()
@@ -307,7 +313,7 @@ void ProjectExplorerTest::testMsvcOutputParsers_data()
"C4716: 'findUnresolvedModule' : must return a value",
FilePath::fromUserInput("qmlstandalone\\main.cpp"), 54));
- QTest::newRow("labeled error-2015")
+ QTest::newRow("labeled error-2015")
<< "qmlstandalone\\main.cpp(54): error C4716: 'findUnresolvedModule' : must return a value"
<< OutputParserTester::STDOUT
<< QStringList() << QStringList()
@@ -316,7 +322,7 @@ void ProjectExplorerTest::testMsvcOutputParsers_data()
"C4716: 'findUnresolvedModule' : must return a value",
FilePath::fromUserInput("qmlstandalone\\main.cpp"), 54));
- QTest::newRow("labeled error with number prefix")
+ QTest::newRow("labeled error with number prefix")
<< "1>qmlstandalone\\main.cpp(54) : error C4716: 'findUnresolvedModule' : must return a value"
<< OutputParserTester::STDOUT
<< QStringList() << QStringList()
@@ -325,7 +331,7 @@ void ProjectExplorerTest::testMsvcOutputParsers_data()
"C4716: 'findUnresolvedModule' : must return a value",
FilePath::fromUserInput("qmlstandalone\\main.cpp"), 54));
- QTest::newRow("labeled warning")
+ QTest::newRow("labeled warning")
<< "x:\\src\\plugins\\projectexplorer\\msvcparser.cpp(69) : warning C4100: 'something' : unreferenced formal parameter"
<< OutputParserTester::STDOUT
<< QStringList() << QStringList()
@@ -334,7 +340,7 @@ void ProjectExplorerTest::testMsvcOutputParsers_data()
"C4100: 'something' : unreferenced formal parameter",
FilePath::fromUserInput("x:\\src\\plugins\\projectexplorer\\msvcparser.cpp"), 69));
- QTest::newRow("labeled warning with number prefix")
+ QTest::newRow("labeled warning with number prefix")
<< "1>x:\\src\\plugins\\projectexplorer\\msvcparser.cpp(69) : warning C4100: 'something' : unreferenced formal parameter"
<< OutputParserTester::STDOUT
<< QStringList() << QStringList()
@@ -343,7 +349,7 @@ void ProjectExplorerTest::testMsvcOutputParsers_data()
"C4100: 'something' : unreferenced formal parameter",
FilePath::fromUserInput("x:\\src\\plugins\\projectexplorer\\msvcparser.cpp"), 69));
- QTest::newRow("labeled chained warning")
+ QTest::newRow("labeled chained warning")
<< "x:\\src\\libs\\narf\\stringutils.cpp(155): warning C4996: "
"'std::wstring_convert<std::codecvt_utf8_utf16<wchar_t,1114111,(std::codecvt_mode)0>"
",wchar_t,std::allocator<wchar_t>,std::allocator<char>>::from_bytes': "
@@ -360,7 +366,7 @@ void ProjectExplorerTest::testMsvcOutputParsers_data()
"C++17. more blabla",
FilePath::fromUserInput("x:\\src\\libs\\narf\\stringutils.cpp"), 155));
- QTest::newRow("additional information")
+ QTest::newRow("additional information")
<< "x:\\src\\plugins\\texteditor\\icompletioncollector.h(50) : warning C4099: 'TextEditor::CompletionItem' : type name first seen using 'struct' now seen using 'class'\n"
" x:\\src\\plugins\\texteditor\\completionsupport.h(39) : see declaration of 'TextEditor::CompletionItem'"
<< OutputParserTester::STDOUT
@@ -373,7 +379,7 @@ void ProjectExplorerTest::testMsvcOutputParsers_data()
"see declaration of 'TextEditor::CompletionItem'",
FilePath::fromUserInput("x:\\src\\plugins\\texteditor\\completionsupport.h"), 39));
- QTest::newRow("additional information with prefix")
+ QTest::newRow("additional information with prefix")
<< "2>x:\\src\\plugins\\texteditor\\icompletioncollector.h(50) : warning C4099: 'TextEditor::CompletionItem' : type name first seen using 'struct' now seen using 'class'\n"
" x:\\src\\plugins\\texteditor\\completionsupport.h(39) : see declaration of 'TextEditor::CompletionItem'"
<< OutputParserTester::STDOUT
@@ -386,7 +392,7 @@ void ProjectExplorerTest::testMsvcOutputParsers_data()
"see declaration of 'TextEditor::CompletionItem'",
FilePath::fromUserInput("x:\\src\\plugins\\texteditor\\completionsupport.h"), 39));
- QTest::newRow("fatal linker error")
+ QTest::newRow("fatal linker error")
<< "LINK : fatal error LNK1146: no argument specified with option '/LIBPATH:'"
<< OutputParserTester::STDOUT
<< QStringList() << QStringList()
@@ -394,8 +400,8 @@ void ProjectExplorerTest::testMsvcOutputParsers_data()
<< CompileTask(Task::Error,
"LNK1146: no argument specified with option '/LIBPATH:'"));
- // This actually comes through stderr!
- QTest::newRow("command line warning")
+ // This actually comes through stderr!
+ QTest::newRow("command line warning")
<< "cl : Command line warning D9002 : ignoring unknown option '-fopenmp'"
<< OutputParserTester::STDERR
<< QStringList() << QStringList()
@@ -403,7 +409,7 @@ void ProjectExplorerTest::testMsvcOutputParsers_data()
<< CompileTask(Task::Warning,
"D9002 : ignoring unknown option '-fopenmp'"));
- QTest::newRow("complex error")
+ QTest::newRow("complex error")
<< "..\\untitled\\main.cpp(19) : error C2440: 'initializing' : cannot convert from 'int' to 'std::_Tree<_Traits>::iterator'\n"
" with\n"
" [\n"
@@ -426,7 +432,7 @@ void ProjectExplorerTest::testMsvcOutputParsers_data()
QList<QTextLayout::FormatRange>()
<< formatRange(85, 365)));
- QTest::newRow("Linker error 1")
+ QTest::newRow("Linker error 1")
<< "main.obj : error LNK2019: unresolved external symbol \"public: void __thiscall Data::doit(void)\" (?doit@Data@@QAEXXZ) referenced in function _main"
<< OutputParserTester::STDOUT
<< QStringList() << QStringList()
@@ -435,7 +441,7 @@ void ProjectExplorerTest::testMsvcOutputParsers_data()
"LNK2019: unresolved external symbol \"public: void __thiscall Data::doit(void)\" (?doit@Data@@QAEXXZ) referenced in function _main",
FilePath::fromUserInput("main.obj"), -1));
- QTest::newRow("Linker error 2")
+ QTest::newRow("Linker error 2")
<< "debug\\Experimentation.exe : fatal error LNK1120: 1 unresolved externals"
<< OutputParserTester::STDOUT
<< QStringList() << QStringList()
@@ -444,7 +450,7 @@ void ProjectExplorerTest::testMsvcOutputParsers_data()
"LNK1120: 1 unresolved externals",
FilePath::fromUserInput("debug\\Experimentation.exe")));
- QTest::newRow("nmake error")
+ QTest::newRow("nmake error")
<< "Error: dependent '..\\..\\..\\..\\creator-2.5\\src\\plugins\\coreplugin\\ifile.h' does not exist."
<< OutputParserTester::STDOUT
<< QStringList() << QStringList()
@@ -452,7 +458,7 @@ void ProjectExplorerTest::testMsvcOutputParsers_data()
<< CompileTask(Task::Error,
"dependent '..\\..\\..\\..\\creator-2.5\\src\\plugins\\coreplugin\\ifile.h' does not exist."));
- QTest::newRow("jom error")
+ QTest::newRow("jom error")
<< "Error: dependent 'main.cpp' does not exist."
<< OutputParserTester::STDERR
<< QStringList() << QStringList()
@@ -460,7 +466,7 @@ void ProjectExplorerTest::testMsvcOutputParsers_data()
<< CompileTask(Task::Error,
"dependent 'main.cpp' does not exist."));
- QTest::newRow("Multiline error")
+ QTest::newRow("Multiline error")
<< "c:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\INCLUDE\\xutility(2227) : warning C4996: 'std::_Copy_impl': Function call with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators'\n"
" c:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\INCLUDE\\xutility(2212) : see declaration of 'std::_Copy_impl'\n"
" symbolgroupvalue.cpp(2314) : see reference to function template instantiation '_OutIt std::copy<const unsigned char*,unsigned short*>(_InIt,_InIt,_OutIt)' being compiled\n"
@@ -473,25 +479,25 @@ void ProjectExplorerTest::testMsvcOutputParsers_data()
<< QStringList() << QStringList()
<< (Tasks()
<< CompileTask(Task::Warning,
- "C4996: 'std::_Copy_impl': Function call with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators'",
- FilePath::fromUserInput("c:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\INCLUDE\\xutility"), 2227)
+ "C4996: 'std::_Copy_impl': Function call with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators'",
+ FilePath::fromUserInput("c:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\INCLUDE\\xutility"), 2227)
<< CompileTask(Task::Unknown,
- "see declaration of 'std::_Copy_impl'",
- FilePath::fromUserInput("c:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\INCLUDE\\xutility"), 2212)
+ "see declaration of 'std::_Copy_impl'",
+ FilePath::fromUserInput("c:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\INCLUDE\\xutility"), 2212)
<< compileTask(Task::Unknown,
- "see reference to function template instantiation '_OutIt std::copy<const unsigned char*,unsigned short*>(_InIt,_InIt,_OutIt)' being compiled\n"
- " symbolgroupvalue.cpp(2314) : see reference to function template instantiation '_OutIt std::copy<const unsigned char*,unsigned short*>(_InIt,_InIt,_OutIt)' being compiled\n"
- " with\n"
- " [\n"
- " _OutIt=unsigned short *,\n"
- " _InIt=const unsigned char *\n"
- " ]",
- FilePath::fromUserInput("symbolgroupvalue.cpp"),
- 2314,
- QList<QTextLayout::FormatRange>()
- << formatRange(141, 287)));
-
- QTest::newRow("Ambiguous symbol")
+ "see reference to function template instantiation '_OutIt std::copy<const unsigned char*,unsigned short*>(_InIt,_InIt,_OutIt)' being compiled\n"
+ " symbolgroupvalue.cpp(2314) : see reference to function template instantiation '_OutIt std::copy<const unsigned char*,unsigned short*>(_InIt,_InIt,_OutIt)' being compiled\n"
+ " with\n"
+ " [\n"
+ " _OutIt=unsigned short *,\n"
+ " _InIt=const unsigned char *\n"
+ " ]",
+ FilePath::fromUserInput("symbolgroupvalue.cpp"),
+ 2314,
+ QList<QTextLayout::FormatRange>()
+ << formatRange(141, 287)));
+
+ QTest::newRow("Ambiguous symbol")
<< "D:\\Project\\file.h(98) : error C2872: 'UINT64' : ambiguous symbol\n"
" could be 'C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.0A\\include\\basetsd.h(83) : unsigned __int64 UINT64'\n"
" or 'D:\\Project\\types.h(71) : Types::UINT64'"
@@ -499,66 +505,72 @@ void ProjectExplorerTest::testMsvcOutputParsers_data()
<< QStringList() << QStringList()
<< (Tasks()
<< CompileTask(Task::Error,
- "C2872: 'UINT64' : ambiguous symbol",
- FilePath::fromUserInput("D:\\Project\\file.h"), 98)
+ "C2872: 'UINT64' : ambiguous symbol",
+ FilePath::fromUserInput("D:\\Project\\file.h"), 98)
<< CompileTask(Task::Unknown,
- "could be unsigned __int64 UINT64",
- FilePath::fromUserInput("C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.0A\\include\\basetsd.h"), 83)
+ "could be unsigned __int64 UINT64",
+ FilePath::fromUserInput("C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.0A\\include\\basetsd.h"), 83)
<< CompileTask(Task::Unknown,
- "or Types::UINT64",
- FilePath::fromUserInput("D:\\Project\\types.h"), 71));
+ "or Types::UINT64",
+ FilePath::fromUserInput("D:\\Project\\types.h"), 71));
- QTest::newRow("ignore moc note")
+ QTest::newRow("ignore moc note")
<< "/home/qtwebkithelpviewer.h:0: Note: No relevant classes found. No output generated."
<< OutputParserTester::STDERR
<< QStringList() << QStringList("/home/qtwebkithelpviewer.h:0: Note: No relevant classes found. No output generated.")
<< (Tasks());
- QTest::newRow("error with note")
+ QTest::newRow("error with note")
<< "main.cpp(7): error C2733: 'func': second C linkage of overloaded function not allowed\n"
"main.cpp(6): note: see declaration of 'func'"
<< OutputParserTester::STDOUT
<< QStringList() << QStringList()
<< Tasks{compileTask(Task::Error,
- "C2733: 'func': second C linkage of overloaded function not allowed\n"
- "main.cpp(7): error C2733: 'func': second C linkage of overloaded function not allowed\n"
- "main.cpp(6): note: see declaration of 'func'",
- FilePath::fromUserInput("main.cpp"),
- 7,
- QList<QTextLayout::FormatRange>()
- << formatRange(67, 130))};
-
- QTest::newRow("cyrillic warning") // QTCREATORBUG-20297
+ "C2733: 'func': second C linkage of overloaded function not allowed\n"
+ "main.cpp(7): error C2733: 'func': second C linkage of overloaded function not allowed\n"
+ "main.cpp(6): note: see declaration of 'func'",
+ FilePath::fromUserInput("main.cpp"),
+ 7,
+ QList<QTextLayout::FormatRange>()
+ << formatRange(67, 130))};
+
+ QTest::newRow("cyrillic warning") // QTCREATORBUG-20297
<< QString::fromUtf8("cl: командная строка warning D9025: переопределение \"/MDd\" на \"/MTd\"")
<< OutputParserTester::STDERR
<< QStringList() << QStringList()
<< (Tasks()
<< CompileTask(Task::Warning,
QString::fromUtf8("D9025: переопределение \"/MDd\" на \"/MTd\"")));
-}
+ }
-void ProjectExplorerTest::testMsvcOutputParsers()
-{
- OutputParserTester testbench;
- testbench.addLineParser(new MsvcParser);
- QFETCH(QString, input);
- QFETCH(OutputParserTester::Channel, inputChannel);
- QFETCH(Tasks, tasks);
- QFETCH(QStringList, childStdOutLines);
- QFETCH(QStringList, childStdErrLines);
-
- testbench.testParsing(input, inputChannel, tasks, childStdOutLines, childStdErrLines);
-}
+ void test()
+ {
+ OutputParserTester testbench;
+ testbench.addLineParser(new MsvcParser);
+ QFETCH(QString, input);
+ QFETCH(OutputParserTester::Channel, inputChannel);
+ QFETCH(Tasks, tasks);
+ QFETCH(QStringList, childStdOutLines);
+ QFETCH(QStringList, childStdErrLines);
+
+ testbench.testParsing(input, inputChannel, tasks, childStdOutLines, childStdErrLines);
+ }
+};
-void ProjectExplorerTest::testClangClOutputParsers_data()
+class ClangClParserTest : public QObject
{
- QTest::addColumn<QString>("input");
- QTest::addColumn<OutputParserTester::Channel>("inputChannel");
- QTest::addColumn<QStringList>("childStdOutLines");
- QTest::addColumn<QStringList>("childStdErrLines");
- QTest::addColumn<Tasks >("tasks");
+ Q_OBJECT
+
+private slots:
+ void test_data()
+ {
+ QTest::addColumn<QString>("input");
+ QTest::addColumn<OutputParserTester::Channel>("inputChannel");
+ QTest::addColumn<QStringList>("childStdOutLines");
+ QTest::addColumn<QStringList>("childStdErrLines");
+ QTest::addColumn<Tasks >("tasks");
- const QString clangClCompilerLog =
+ const QString clangClCompilerLog =
"In file included from .\\qwindowseglcontext.cpp:40:\n"
"./qwindowseglcontext.h(282,15) : warning: private field 'm_version' is not used [-Wunused-private-field]\n"
"const int m_version; //! majorVersion<<8 + minorVersion\n"
@@ -578,45 +590,45 @@ void ProjectExplorerTest::testClangClOutputParsers_data()
"^\n"
"2 errors generated.\n";
- const QString ignoredStderr =
+ const QString ignoredStderr =
"NMAKE : fatal error U1077: 'D:\\opt\\LLVM64_390\\bin\\clang-cl.EXE' : return code '0x1'\n"
"Stop.";
- const QString input = clangClCompilerLog + ignoredStderr;
- const QStringList expectedStderr = ignoredStderr.split('\n');
+ const QString input = clangClCompilerLog + ignoredStderr;
+ const QStringList expectedStderr = ignoredStderr.split('\n');
- QTest::newRow("error")
+ QTest::newRow("error")
<< input
<< OutputParserTester::STDERR
- << QStringList() << expectedStderr
+ << QStringList() << expectedStderr
<< (Tasks()
<< CompileTask(Task::Warning,
- "private field 'm_version' is not used [-Wunused-private-field]\n"
- "./qwindowseglcontext.h(282,15) : warning: private field 'm_version' is not used [-Wunused-private-field]\n"
- "const int m_version; //! majorVersion<<8 + minorVersion",
- FilePath::fromUserInput("./qwindowseglcontext.h"), 282)
+ "private field 'm_version' is not used [-Wunused-private-field]\n"
+ "./qwindowseglcontext.h(282,15) : warning: private field 'm_version' is not used [-Wunused-private-field]\n"
+ "const int m_version; //! majorVersion<<8 + minorVersion",
+ FilePath::fromUserInput("./qwindowseglcontext.h"), 282)
<< CompileTask(Task::Warning,
- "unused variable 'formatTextPlainC' [-Wunused-const-variable]\n"
- ".\\qwindowsclipboard.cpp(60,19) : warning: unused variable 'formatTextPlainC' [-Wunused-const-variable]\n"
- "static const char formatTextPlainC[] = \"text/plain\";",
- FilePath::fromUserInput(".\\qwindowsclipboard.cpp"), 60)
+ "unused variable 'formatTextPlainC' [-Wunused-const-variable]\n"
+ ".\\qwindowsclipboard.cpp(60,19) : warning: unused variable 'formatTextPlainC' [-Wunused-const-variable]\n"
+ "static const char formatTextPlainC[] = \"text/plain\";",
+ FilePath::fromUserInput(".\\qwindowsclipboard.cpp"), 60)
<< CompileTask(Task::Warning,
- "unused variable 'formatTextHtmlC' [-Wunused-const-variable]\n"
- ".\\qwindowsclipboard.cpp(61,19) : warning: unused variable 'formatTextHtmlC' [-Wunused-const-variable]\n"
- "static const char formatTextHtmlC[] = \"text/html\";",
- FilePath::fromUserInput(".\\qwindowsclipboard.cpp"), 61)
+ "unused variable 'formatTextHtmlC' [-Wunused-const-variable]\n"
+ ".\\qwindowsclipboard.cpp(61,19) : warning: unused variable 'formatTextHtmlC' [-Wunused-const-variable]\n"
+ "static const char formatTextHtmlC[] = \"text/html\";",
+ FilePath::fromUserInput(".\\qwindowsclipboard.cpp"), 61)
<< CompileTask(Task::Error,
- "unknown type name 'errr'\n"
- ".\\qwindowsgdinativeinterface.cpp(48,3) : error: unknown type name 'errr'\n"
- " errr",
- FilePath::fromUserInput(".\\qwindowsgdinativeinterface.cpp"), 48)
+ "unknown type name 'errr'\n"
+ ".\\qwindowsgdinativeinterface.cpp(48,3) : error: unknown type name 'errr'\n"
+ " errr",
+ FilePath::fromUserInput(".\\qwindowsgdinativeinterface.cpp"), 48)
<< CompileTask(Task::Error,
- "expected unqualified-id\n"
- ".\\qwindowsgdinativeinterface.cpp(51,1) : error: expected unqualified-id\n"
- "void *QWindowsGdiNativeInterface::nativeResourceForBackingStore(const QByteArray &resource, QBackingStore *bs)",
- FilePath::fromUserInput(".\\qwindowsgdinativeinterface.cpp"), 51));
+ "expected unqualified-id\n"
+ ".\\qwindowsgdinativeinterface.cpp(51,1) : error: expected unqualified-id\n"
+ "void *QWindowsGdiNativeInterface::nativeResourceForBackingStore(const QByteArray &resource, QBackingStore *bs)",
+ FilePath::fromUserInput(".\\qwindowsgdinativeinterface.cpp"), 51));
- QTest::newRow("other error")
+ QTest::newRow("other error")
<< "C:\\Program Files\\LLVM\\bin\\clang-cl.exe /nologo /c /EHsc /Od -m64 /Zi /MDd "
"/DUNICODE /D_UNICODE /DWIN32 /FdTestForError.cl.pdb "
"/FoC:\\MyData\\Project_home\\cpp\build-TestForError-msvc_2017_clang-Debug\\Debug_msvc_201_47eca974c876c8b3\\TestForError.b6dd39ae\\3a52ce780950d4d9\\main.cpp.obj "
@@ -628,30 +640,47 @@ void ProjectExplorerTest::testClangClOutputParsers_data()
<< OutputParserTester::STDERR
<< QStringList()
<< QStringList{"C:\\Program Files\\LLVM\\bin\\clang-cl.exe /nologo /c /EHsc /Od -m64 /Zi /MDd "
- "/DUNICODE /D_UNICODE /DWIN32 /FdTestForError.cl.pdb "
- "/FoC:\\MyData\\Project_home\\cpp\build-TestForError-msvc_2017_clang-Debug\\Debug_msvc_201_47eca974c876c8b3\\TestForError.b6dd39ae\\3a52ce780950d4d9\\main.cpp.obj "
- "C:\\MyData\\Project_home\\cpp\\TestForError\\main.cpp /TP", " ;"}
+ "/DUNICODE /D_UNICODE /DWIN32 /FdTestForError.cl.pdb "
+ "/FoC:\\MyData\\Project_home\\cpp\build-TestForError-msvc_2017_clang-Debug\\Debug_msvc_201_47eca974c876c8b3\\TestForError.b6dd39ae\\3a52ce780950d4d9\\main.cpp.obj "
+ "C:\\MyData\\Project_home\\cpp\\TestForError\\main.cpp /TP", " ;"}
<< Tasks{CompileTask(Task::Error,
- "expected ';' after return statement\n"
- "C:\\MyData\\Project_home\\cpp\\TestForError\\main.cpp(3,10): error: expected ';' after return statement\n"
- "return 0",
- FilePath::fromUserInput("C:\\MyData\\Project_home\\cpp\\TestForError\\main.cpp"),
- 3)};
+ "expected ';' after return statement\n"
+ "C:\\MyData\\Project_home\\cpp\\TestForError\\main.cpp(3,10): error: expected ';' after return statement\n"
+ "return 0",
+ FilePath::fromUserInput("C:\\MyData\\Project_home\\cpp\\TestForError\\main.cpp"),
+ 3)};
+ }
+
+ void test()
+ {
+ OutputParserTester testbench;
+ testbench.addLineParser(new ClangClParser);
+ QFETCH(QString, input);
+ QFETCH(OutputParserTester::Channel, inputChannel);
+ QFETCH(QStringList, childStdOutLines);
+ QFETCH(QStringList, childStdErrLines);
+ QFETCH(Tasks, tasks);
+
+ testbench.testParsing(input, inputChannel, tasks, childStdOutLines, childStdErrLines);
+ }
+};
+
+QObject *createMsvcParserTest()
+{
+ return new MsvcParserTest;
}
-void ProjectExplorerTest::testClangClOutputParsers()
+QObject *createClangClParserTest()
{
- OutputParserTester testbench;
- testbench.addLineParser(new ClangClParser);
- QFETCH(QString, input);
- QFETCH(OutputParserTester::Channel, inputChannel);
- QFETCH(QStringList, childStdOutLines);
- QFETCH(QStringList, childStdErrLines);
- QFETCH(Tasks, tasks);
-
- testbench.testParsing(input, inputChannel, tasks, childStdOutLines, childStdErrLines);
+ return new ClangClParserTest;
}
-} // ProjectExplorer::Internal
+} // namespace Internal
#endif // WITH_TEST
+
+} // namespace ProjectExplorer
+
+#ifdef WITH_TESTS
+#include <msvcparser.moc>
+#endif
diff --git a/src/plugins/projectexplorer/msvcparser.h b/src/plugins/projectexplorer/msvcparser.h
index 941e7736798..830693a7806 100644
--- a/src/plugins/projectexplorer/msvcparser.h
+++ b/src/plugins/projectexplorer/msvcparser.h
@@ -38,4 +38,9 @@ private:
const QRegularExpression m_compileRegExp;
};
+namespace Internal {
+QObject *createMsvcParserTest();
+QObject *createClangClParserTest();
+}
+
} // namespace ProjectExplorer
diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp
index 24449cfabb6..935cfe59e3d 100644
--- a/src/plugins/projectexplorer/projectexplorer.cpp
+++ b/src/plugins/projectexplorer/projectexplorer.cpp
@@ -167,6 +167,7 @@
#include "gnumakeparser.h"
#include "jsonwizard/jsonwizard_test.h"
#include "linuxiccparser.h"
+#include "msvcparser.h"
#include "outputparser_test.h"
#include "projectexplorer_test.h"
#include "toolchainsettingsaccessor.h"
@@ -803,6 +804,7 @@ Result<> ProjectExplorerPlugin::initialize(const QStringList &arguments)
addTest<ProjectExplorerTest>();
addTestCreator(createAbiTest);
addTestCreator(createClangParserTest);
+ addTestCreator(createClangClParserTest);
addTestCreator(createCustomParserTest);
addTestCreator(createGccParserTest);
addTestCreator(createGccToolchainTest);
@@ -810,6 +812,7 @@ Result<> ProjectExplorerPlugin::initialize(const QStringList &arguments)
addTestCreator(createJsonWizardTest);
addTestCreator(createLdOutputParserTest);
addTestCreator(createLinuxIccParserTest);
+ addTestCreator(createMsvcParserTest);
addTestCreator(createOutputParserTest);
addTestCreator(createProjectTest);
addTestCreator(createRunWorkerConflictTest);
diff --git a/src/plugins/projectexplorer/projectexplorer_test.h b/src/plugins/projectexplorer/projectexplorer_test.h
index 752e7c61236..1a8f4e53fa5 100644
--- a/src/plugins/projectexplorer/projectexplorer_test.h
+++ b/src/plugins/projectexplorer/projectexplorer_test.h
@@ -16,12 +16,6 @@ class ProjectExplorerTest final : public QObject
Q_OBJECT
private slots:
- void testMsvcOutputParsers_data();
- void testMsvcOutputParsers();
-
- void testClangClOutputParsers_data();
- void testClangClOutputParsers();
-
void testDeviceManager();
void testUserFileAccessor_prepareToReadSettings();