[clang-tools-extra] r323350 - [clangd] add test for r323347 CodeComplete behavior we rely on
Sam McCall via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 24 09:53:32 PST 2018
Author: sammccall
Date: Wed Jan 24 09:53:32 2018
New Revision: 323350
URL: http://llvm.org/viewvc/llvm-project?rev=323350&view=rev
Log:
[clangd] add test for r323347 CodeComplete behavior we rely on
Modified:
clang-tools-extra/trunk/unittests/clangd/CodeCompleteTests.cpp
Modified: clang-tools-extra/trunk/unittests/clangd/CodeCompleteTests.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/clangd/CodeCompleteTests.cpp?rev=323350&r1=323349&r2=323350&view=diff
==============================================================================
--- clang-tools-extra/trunk/unittests/clangd/CodeCompleteTests.cpp (original)
+++ clang-tools-extra/trunk/unittests/clangd/CodeCompleteTests.cpp Wed Jan 24 09:53:32 2018
@@ -537,12 +537,13 @@ TEST(CompletionTest, IndexSuppressesPrea
/*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, IndexSuppressesPrea
.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) {
More information about the cfe-commits
mailing list