summaryrefslogtreecommitdiff
path: root/tests/unit/unittest/clangdocuments-test.cpp
diff options
context:
space:
mode:
authorNikolai Kosjar <nikolai.kosjar@qt.io>2018-01-04 14:48:35 +0100
committerNikolai Kosjar <nikolai.kosjar@qt.io>2018-01-05 15:27:44 +0000
commit5972e27169802b8ae68eeb7b7d0520b4791988e6 (patch)
treedf3d3641b2d3429b5e4cd7d8ef73ae10db86d9a3 /tests/unit/unittest/clangdocuments-test.cpp
parent8ced936e791c8c3401e491f78f79578827900857 (diff)
downloadqt-creator-5972e27169802b8ae68eeb7b7d0520b4791988e6.tar.gz
Clang: Ensure to clear all affected translation units on project part change
The ones that were already dirty were not taken into the account and used the old project configuration. Change-Id: I949d1ca8c23bbdb18eec78e5a708199beff6f735 Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
Diffstat (limited to 'tests/unit/unittest/clangdocuments-test.cpp')
-rw-r--r--tests/unit/unittest/clangdocuments-test.cpp22
1 files changed, 17 insertions, 5 deletions
diff --git a/tests/unit/unittest/clangdocuments-test.cpp b/tests/unit/unittest/clangdocuments-test.cpp
index e2622f5b33..71186353ee 100644
--- a/tests/unit/unittest/clangdocuments-test.cpp
+++ b/tests/unit/unittest/clangdocuments-test.cpp
@@ -410,19 +410,31 @@ TEST_F(Documents, SetDocumentsDirtyIfProjectPartChanged)
documents.create({fileContainerWithOtherProject});
projects.createOrUpdate({ProjectPartContainer(projectPartId)});
- const auto notDirtyBefore = documents.setDocumentsDirtyIfProjectPartChanged();
+ const auto affectedDocuments = documents.setDocumentsDirtyIfProjectPartChanged();
- ASSERT_THAT(notDirtyBefore, createdDocuments);
+ ASSERT_THAT(affectedDocuments, createdDocuments);
}
-TEST_F(Documents, SetDocumentsDirtyIfProjectPartChangedReturnsEmpty)
+TEST_F(Documents, SetDocumentsDirtyIfProjectPartChanged_EvenIfAlreadyDirty)
+{
+ ClangBackEnd::FileContainer fileContainer(filePath, projectPartId, Utf8StringVector(), 74u);
+ auto createdDocuments = documents.create({fileContainer});
+ projects.createOrUpdate({ProjectPartContainer(projectPartId)});
+ documents.setDocumentsDirtyIfProjectPartChanged(); // Make already dirty
+
+ const auto affectedDocuments = documents.setDocumentsDirtyIfProjectPartChanged();
+
+ ASSERT_THAT(affectedDocuments, createdDocuments);
+}
+
+TEST_F(Documents, SetDocumentsDirtyIfProjectPartChanged_ReturnsEmpty)
{
ClangBackEnd::FileContainer fileContainer(filePath, projectPartId, Utf8StringVector(), 74u);
documents.create({fileContainer});
- const auto notDirtyBefore = documents.setDocumentsDirtyIfProjectPartChanged();
+ const auto affectedDocuments = documents.setDocumentsDirtyIfProjectPartChanged();
- ASSERT_TRUE(notDirtyBefore.empty());
+ ASSERT_TRUE(affectedDocuments.empty());
}
void Documents::SetUp()