aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMarco Bubke <marco.bubke@qt.io>2019-06-17 18:17:49 +0200
committerMarco Bubke <marco.bubke@qt.io>2019-06-27 12:32:02 +0000
commitcbfd9dc16b41176ce5a79bd9e11a336e853573a0 (patch)
tree583378ee37c5a7b8a191d2f725098081b44217eb /tests
parentbbd58ca30b32f6015a5e7eb16884dfb9f6108f17 (diff)
Clang: Update ModifiedTimeChecker in SymbolIndexer
If a watched file changed we should update the ModifiedTimeChecker too. Change-Id: Ie43f5cf5b6dd4ddb1383168a1326add21f6e3e9d Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/unittest/mockmodifiedtimechecker.h2
-rw-r--r--tests/unit/unittest/symbolindexer-test.cpp9
2 files changed, 11 insertions, 0 deletions
diff --git a/tests/unit/unittest/mockmodifiedtimechecker.h b/tests/unit/unittest/mockmodifiedtimechecker.h
index bf101988b1..1fa3dd497c 100644
--- a/tests/unit/unittest/mockmodifiedtimechecker.h
+++ b/tests/unit/unittest/mockmodifiedtimechecker.h
@@ -35,6 +35,7 @@ class MockSourceEntriesModifiedTimeChecker
public:
MOCK_CONST_METHOD1(isUpToDate,
bool (const ClangBackEnd::SourceEntries &sourceEntries));
+ MOCK_METHOD1(pathsChanged, void(const ClangBackEnd::FilePathIds &filePathIds));
};
class MockSourceTimeStampsModifiedTimeChecker
@@ -42,4 +43,5 @@ class MockSourceTimeStampsModifiedTimeChecker
{
public:
MOCK_CONST_METHOD1(isUpToDate, bool(const ClangBackEnd::SourceTimeStamps &sourceTimeStamps));
+ MOCK_METHOD1(pathsChanged, void(const ClangBackEnd::FilePathIds &filePathIds));
};
diff --git a/tests/unit/unittest/symbolindexer-test.cpp b/tests/unit/unittest/symbolindexer-test.cpp
index 0bfcf13188..c7831d099f 100644
--- a/tests/unit/unittest/symbolindexer-test.cpp
+++ b/tests/unit/unittest/symbolindexer-test.cpp
@@ -1667,6 +1667,15 @@ TEST_F(SymbolIndexer, PathsChangedUpdatesFileStatusCache)
ASSERT_THAT(fileStatusCache.lastModifiedTime(sourceId), 65);
}
+TEST_F(SymbolIndexer, PathsChangedCallsModifiedTimeChecker)
+{
+ auto sourceId = filePathId(TESTDATA_DIR "/symbolindexer_pathChanged.cpp");
+
+ EXPECT_CALL(mockModifiedTimeChecker, pathsChanged(ElementsAre(sourceId)));
+
+ indexer.pathsChanged({sourceId});
+}
+
TEST_F(SymbolIndexer, GetUpdatableFilePathIdsIfCompilerMacrosAreDifferent)
{
ON_CALL(mockProjectPartsStorage, fetchProjectPartArtefact(A<ProjectPartId>()))