diff options
Diffstat (limited to 'clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp')
| -rw-r--r-- | clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp | 44 |
1 files changed, 24 insertions, 20 deletions
diff --git a/clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp b/clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp index 2f846e9c837..23fa0526b0d 100644 --- a/clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp +++ b/clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp @@ -90,7 +90,7 @@ std::unique_ptr<SymbolIndex> memIndex(std::vector<Symbol> Symbols) { SymbolSlab::Builder Slab; for (const auto &Sym : Symbols) Slab.insert(Sym); - return MemIndex::build(std::move(Slab).build(), RefSlab()); + return MemIndex::build(std::move(Slab).build(), RefSlab(), RelationSlab()); } CodeCompleteResult completions(ClangdServer &Server, llvm::StringRef TestCode, @@ -641,10 +641,10 @@ TEST(CompletionTest, IncludeInsertionPreprocessorIntegrationTests) { CodeCompleteOptions NoInsertion; NoInsertion.InsertIncludes = CodeCompleteOptions::NeverInsert; Results = completions(Server, - R"cpp( + R"cpp( int main() { ns::^ } )cpp", - {Sym}, NoInsertion); + {Sym}, NoInsertion); EXPECT_THAT(Results.Completions, ElementsAre(AllOf(Named("X"), Not(InsertInclude())))); // Duplicate based on inclusions in preamble. @@ -1108,6 +1108,10 @@ public: void refs(const RefsRequest &, llvm::function_ref<void(const Ref &)>) const override {} + void relations(const RelationsRequest &, + llvm::function_ref<void(const SymbolID &, const Symbol &)>) + const override {} + // This is incorrect, but IndexRequestCollector is not an actual index and it // isn't used in production code. size_t estimateMemoryUsage() const override { return 0; } @@ -2026,19 +2030,19 @@ TEST(CompletionTest, OverridesNonIdentName) { TEST(GuessCompletionPrefix, Filters) { for (llvm::StringRef Case : { - "[[scope::]][[ident]]^", - "[[]][[]]^", - "\n[[]][[]]^", - "[[]][[ab]]^", - "x.[[]][[ab]]^", - "x.[[]][[]]^", - "[[x::]][[ab]]^", - "[[x::]][[]]^", - "[[::x::]][[ab]]^", - "some text [[scope::more::]][[identif]]^ier", - "some text [[scope::]][[mor]]^e::identifier", - "weird case foo::[[::bar::]][[baz]]^", - }) { + "[[scope::]][[ident]]^", + "[[]][[]]^", + "\n[[]][[]]^", + "[[]][[ab]]^", + "x.[[]][[ab]]^", + "x.[[]][[]]^", + "[[x::]][[ab]]^", + "[[x::]][[]]^", + "[[::x::]][[ab]]^", + "some text [[scope::more::]][[identif]]^ier", + "some text [[scope::]][[mor]]^e::identifier", + "weird case foo::[[::bar::]][[baz]]^", + }) { Annotations F(Case); auto Offset = cantFail(positionToOffset(F.code(), F.point())); auto ToStringRef = [&](Range R) { @@ -2440,10 +2444,10 @@ TEST(CompletionTest, CursorInSnippets) { /*IndexSymbols=*/{}, Options); // Last placeholder in code patterns should be $0 to put the cursor there. - EXPECT_THAT( - Results.Completions, - Contains(AllOf(Named("while"), - SnippetSuffix(" (${1:condition}) {\n${0:statements}\n}")))); + EXPECT_THAT(Results.Completions, + Contains(AllOf( + Named("while"), + SnippetSuffix(" (${1:condition}) {\n${0:statements}\n}")))); // However, snippets for functions must *not* end with $0. EXPECT_THAT(Results.Completions, Contains(AllOf(Named("while_foo"), |

