summaryrefslogtreecommitdiff
path: root/src/plugins/cpptools/cpppreprocessor_test.cpp
diff options
context:
space:
mode:
authorNikolai Kosjar <nikolai.kosjar@digia.com>2014-02-19 09:11:59 -0300
committerNikolai Kosjar <nikolai.kosjar@digia.com>2014-03-10 13:42:43 +0100
commitaa796a9fc06dc1817b99355a333d2b0edce7215b (patch)
tree5b3d49385756e0b9ab2e456c9f2bcafb98297cd3 /src/plugins/cpptools/cpppreprocessor_test.cpp
parent16e16dc40597c11c60750e35474043bacc36e3a0 (diff)
downloadqt-creator-aa796a9fc06dc1817b99355a333d2b0edce7215b.tar.gz
CppTools: Add all diagnostic messages
...of type 'No such file or directory' to the CPlusPlus::Document. Only the first one was added and as a result, the editor only wavely underlined that one. Add also diagnostic messages if it's not possible to get the file contents. Change-Id: I8389d8e6af9480ea6712759ce5e130e1dd8912f1 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Diffstat (limited to 'src/plugins/cpptools/cpppreprocessor_test.cpp')
-rw-r--r--src/plugins/cpptools/cpppreprocessor_test.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/plugins/cpptools/cpppreprocessor_test.cpp b/src/plugins/cpptools/cpppreprocessor_test.cpp
index 17ab615b02..3178aa9771 100644
--- a/src/plugins/cpptools/cpppreprocessor_test.cpp
+++ b/src/plugins/cpptools/cpppreprocessor_test.cpp
@@ -161,3 +161,21 @@ void CppToolsPlugin::test_cpppreprocessor_includes_cyclic()
QCOMPARE(doc2->resolvedIncludes().size(), 1);
QCOMPARE(doc2->resolvedIncludes().first().resolvedFileName(), fileName1);
}
+
+/// Check: All include errors are reported as diagnostic messages.
+void CppToolsPlugin::test_cpppreprocessor_includes_allDiagnostics()
+{
+ QByteArray source =
+ "#include <NotResolvable1>\n"
+ "#include <NotResolvable2>\n"
+ "\n"
+ ;
+
+ SourcePreprocessor processor;
+ Document::Ptr document = processor.run(source);
+ QVERIFY(document);
+
+ QCOMPARE(document->resolvedIncludes().size(), 0);
+ QCOMPARE(document->unresolvedIncludes().size(), 2);
+ QCOMPARE(document->diagnosticMessages().size(), 2);
+}