diff options
author | Haojian Wu <hokein@google.com> | 2019-01-09 13:42:03 +0000 |
---|---|---|
committer | Haojian Wu <hokein@google.com> | 2019-01-09 13:42:03 +0000 |
commit | 0b097b1a8a99728cdd62278d7c873fc535ae23b9 (patch) | |
tree | b2fe84f7bea17f6cc15177265731c9c03225f565 /clang-tools-extra | |
parent | 9697d2a764c9e26099396d4618f9a8105e4b63fe (diff) |
[clangd] Add a test for SignatureHelp on dynamic index.
Summary: This would catch regressions caused by future changes of the index.
Reviewers: ilya-biryukov
Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits
Differential Revision: https://reviews.llvm.org/D56483
llvm-svn: 350720
Diffstat (limited to 'clang-tools-extra')
-rw-r--r-- | clang-tools-extra/unittests/clangd/CodeCompleteTests.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/clang-tools-extra/unittests/clangd/CodeCompleteTests.cpp b/clang-tools-extra/unittests/clangd/CodeCompleteTests.cpp index aa724badf55a..02f12eab7dd6 100644 --- a/clang-tools-extra/unittests/clangd/CodeCompleteTests.cpp +++ b/clang-tools-extra/unittests/clangd/CodeCompleteTests.cpp @@ -1793,6 +1793,37 @@ TEST(SignatureHelpTest, IndexDocumentation) { SigDoc("Doc from sema")))); } +TEST(SignatureHelpTest, DynamicIndexDocumentation) { + MockFSProvider FS; + MockCompilationDatabase CDB; + IgnoreDiagnostics DiagConsumer; + ClangdServer::Options Opts = ClangdServer::optsForTest(); + Opts.BuildDynamicSymbolIndex = true; + ClangdServer Server(CDB, FS, DiagConsumer, Opts); + + FS.Files[testPath("foo.h")] = R"cpp( + struct Foo { + // Member doc + int foo(); + }; + )cpp"; + Annotations FileContent(R"cpp( + #include "foo.h" + void test() { + Foo f; + f.foo(^); + } + )cpp"); + auto File = testPath("test.cpp"); + Server.addDocument(File, FileContent.code()); + // Wait for the dynamic index being built. + ASSERT_TRUE(Server.blockUntilIdleForTest()); + EXPECT_THAT( + llvm::cantFail(runSignatureHelp(Server, File, FileContent.point())) + .signatures, + ElementsAre(AllOf(Sig("foo() -> int", {}), SigDoc("Member doc")))); +} + TEST(CompletionTest, CompletionFunctionArgsDisabled) { CodeCompleteOptions Opts; Opts.EnableSnippets = true; |