summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/unittests/clangd/TUSchedulerTests.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang-tools-extra/unittests/clangd/TUSchedulerTests.cpp')
-rw-r--r--clang-tools-extra/unittests/clangd/TUSchedulerTests.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/clang-tools-extra/unittests/clangd/TUSchedulerTests.cpp b/clang-tools-extra/unittests/clangd/TUSchedulerTests.cpp
index 936a790c884..125e6be4781 100644
--- a/clang-tools-extra/unittests/clangd/TUSchedulerTests.cpp
+++ b/clang-tools-extra/unittests/clangd/TUSchedulerTests.cpp
@@ -532,6 +532,18 @@ TEST_F(TUSchedulerTests, NoChangeDiags) {
ASSERT_TRUE(S.blockUntilIdle(timeoutSeconds(10)));
}
+TEST_F(TUSchedulerTests, Run) {
+ TUScheduler S(/*AsyncThreadsCount=*/getDefaultAsyncThreadsCount(),
+ /*StorePreambleInMemory=*/true, /*ASTCallbacks=*/nullptr,
+ /*UpdateDebounce=*/std::chrono::steady_clock::duration::zero(),
+ ASTRetentionPolicy());
+ std::atomic<int> Counter(0);
+ S.run("add 1", [&] { ++Counter; });
+ S.run("add 2", [&] { Counter += 2; });
+ ASSERT_TRUE(S.blockUntilIdle(timeoutSeconds(10)));
+ EXPECT_EQ(Counter.load(), 3);
+}
+
} // namespace
} // namespace clangd
} // namespace clang
OpenPOWER on IntegriCloud