diff options
author | Marco Bubke <marco.bubke@theqtcompany.com> | 2015-08-31 13:10:28 +0200 |
---|---|---|
committer | Marco Bubke <marco.bubke@theqtcompany.com> | 2015-08-31 15:01:43 +0000 |
commit | 8ad761642092972d5fa3cf5c550a3fa38379a557 (patch) | |
tree | 6e76919bd3b6ab760615b01d95051996b4facc97 /tests | |
parent | 053e9597affc6d902ec8bca2a972b2f0df11d042 (diff) | |
download | qt-creator-8ad761642092972d5fa3cf5c550a3fa38379a557.tar.gz |
Clang: Reparse for removed files too
Change-Id: Ibe8a3fa46bead6018a4279c3a270cb2535a7b296
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit/unittest/translationunitstest.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/unit/unittest/translationunitstest.cpp b/tests/unit/unittest/translationunitstest.cpp index 8fccfff37c..b6096b1f5e 100644 --- a/tests/unit/unittest/translationunitstest.cpp +++ b/tests/unit/unittest/translationunitstest.cpp @@ -28,6 +28,7 @@ ** ****************************************************************************/ +#include <diagnosticset.h> #include <filecontainer.h> #include <projectpartcontainer.h> #include <projectpart.h> @@ -149,6 +150,32 @@ TEST_F(TranslationUnits, UpdateUnsavedFileAndCheckForReparse) ASSERT_TRUE(translationUnits.translationUnit(filePath, projectPartId).isNeedingReparse()); } +TEST_F(TranslationUnits, UpdateUnsavedFileAndCheckForDiagnostics) +{ + ClangBackEnd::FileContainer fileContainer(filePath, projectPartId, 74u); + ClangBackEnd::FileContainer headerContainer(headerPath, projectPartId, 74u); + ClangBackEnd::FileContainer headerContainerWithUnsavedContent(headerPath, projectPartId, Utf8String(), true, 75u); + translationUnits.createOrUpdate({fileContainer, headerContainer}); + translationUnits.translationUnit(filePath, projectPartId).diagnostics(); + + translationUnits.createOrUpdate({headerContainerWithUnsavedContent}); + + ASSERT_TRUE(translationUnits.translationUnit(filePath, projectPartId).hasNewDiagnostics()); +} + +TEST_F(TranslationUnits, RemoveFileAndCheckForDiagnostics) +{ + ClangBackEnd::FileContainer fileContainer(filePath, projectPartId, 74u); + ClangBackEnd::FileContainer headerContainer(headerPath, projectPartId, 74u); + ClangBackEnd::FileContainer headerContainerWithUnsavedContent(headerPath, projectPartId, Utf8String(), true, 75u); + translationUnits.createOrUpdate({fileContainer, headerContainer}); + translationUnits.translationUnit(filePath, projectPartId).diagnostics(); + + translationUnits.remove({headerContainerWithUnsavedContent}); + + ASSERT_TRUE(translationUnits.translationUnit(filePath, projectPartId).hasNewDiagnostics()); +} + TEST_F(TranslationUnits, DontGetNewerFileContainerIfRevisionIsTheSame) { ClangBackEnd::FileContainer fileContainer(filePath, projectPartId, 74u); |