diff options
| author | Sam McCall <sam.mccall@gmail.com> | 2018-01-24 17:53:32 +0000 |
|---|---|---|
| committer | Sam McCall <sam.mccall@gmail.com> | 2018-01-24 17:53:32 +0000 |
| commit | d5ea3e32a6aef88aac4dc038c95c872ec482f692 (patch) | |
| tree | 99d504796267dfac8710d641dd3288480f5609b8 | |
| parent | 5f7aff9a0a8b651348b024bd240fdb705d907f12 (diff) | |
| download | bcm5719-llvm-d5ea3e32a6aef88aac4dc038c95c872ec482f692.tar.gz bcm5719-llvm-d5ea3e32a6aef88aac4dc038c95c872ec482f692.zip | |
[clangd] add test for r323347 CodeComplete behavior we rely on
llvm-svn: 323350
| -rw-r--r-- | clang-tools-extra/unittests/clangd/CodeCompleteTests.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/clang-tools-extra/unittests/clangd/CodeCompleteTests.cpp b/clang-tools-extra/unittests/clangd/CodeCompleteTests.cpp index 38e7657d36c..729c2bb098c 100644 --- a/clang-tools-extra/unittests/clangd/CodeCompleteTests.cpp +++ b/clang-tools-extra/unittests/clangd/CodeCompleteTests.cpp @@ -537,12 +537,13 @@ TEST(CompletionTest, IndexSuppressesPreambleCompletions) { /*StorePreamblesInMemory=*/true); FS.Files[getVirtualTestFilePath("bar.h")] = - R"cpp(namespace ns { int preamble; })cpp"; + R"cpp(namespace ns { struct preamble { int member; }; })cpp"; auto File = getVirtualTestFilePath("foo.cpp"); Annotations Test(R"cpp( #include "bar.h" namespace ns { int local; } - void f() { ns::^ } + void f() { ns::^; } + void f() { ns::preamble().$2^; } )cpp"); Server.addDocument(Context::empty(), File, Test.code()).wait(); clangd::CodeCompleteOptions Opts = {}; @@ -562,6 +563,11 @@ TEST(CompletionTest, IndexSuppressesPreambleCompletions) { .second.Value; EXPECT_THAT(WithIndex.items, UnorderedElementsAre(Named("local"), Named("index"))); + auto ClassFromPreamble = + Server.codeComplete(Context::empty(), File, Test.point("2"), Opts) + .get() + .second.Value; + EXPECT_THAT(ClassFromPreamble.items, Contains(Named("member"))); } TEST(CompletionTest, DynamicIndexMultiFile) { |

