This revision was automatically updated to reflect the committed changes.
Closed by commit rL350720: [clangd] Add a test for SignatureHelp on dynamic 
index. (authored by hokein, committed by ).
Herald added a subscriber: llvm-commits.

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56483/new/

https://reviews.llvm.org/D56483

Files:
  clang-tools-extra/trunk/unittests/clangd/CodeCompleteTests.cpp


Index: clang-tools-extra/trunk/unittests/clangd/CodeCompleteTests.cpp
===================================================================
--- clang-tools-extra/trunk/unittests/clangd/CodeCompleteTests.cpp
+++ clang-tools-extra/trunk/unittests/clangd/CodeCompleteTests.cpp
@@ -1793,6 +1793,37 @@
                         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;


Index: clang-tools-extra/trunk/unittests/clangd/CodeCompleteTests.cpp
===================================================================
--- clang-tools-extra/trunk/unittests/clangd/CodeCompleteTests.cpp
+++ clang-tools-extra/trunk/unittests/clangd/CodeCompleteTests.cpp
@@ -1793,6 +1793,37 @@
                         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;
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to