diff options
Diffstat (limited to 'clang-tools-extra/unittests/clangd/IndexTests.cpp')
-rw-r--r-- | clang-tools-extra/unittests/clangd/IndexTests.cpp | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/clang-tools-extra/unittests/clangd/IndexTests.cpp b/clang-tools-extra/unittests/clangd/IndexTests.cpp index 3a159279733..70dda71156c 100644 --- a/clang-tools-extra/unittests/clangd/IndexTests.cpp +++ b/clang-tools-extra/unittests/clangd/IndexTests.cpp @@ -187,35 +187,30 @@ TEST(MemIndexTest, TemplateSpecialization) { SymbolSlab::Builder B; Symbol S = symbol("TempSpec"); - S.ID = SymbolID("0"); B.insert(S); - S = symbol("TempSpec"); - S.ID = SymbolID("1"); + S = symbol("TempSpec<int, bool>"); S.SymInfo.Properties = static_cast<index::SymbolPropertySet>( index::SymbolProperty::TemplateSpecialization); B.insert(S); - S = symbol("TempSpec"); - S.ID = SymbolID("2"); + S = symbol("TempSpec<int, U>"); S.SymInfo.Properties = static_cast<index::SymbolPropertySet>( index::SymbolProperty::TemplatePartialSpecialization); B.insert(S); auto I = MemIndex::build(std::move(B).build(), RefSlab()); FuzzyFindRequest Req; - Req.Query = "TempSpec"; Req.AnyScope = true; - std::vector<Symbol> Symbols; - I->fuzzyFind(Req, [&Symbols](const Symbol &Sym) { Symbols.push_back(Sym); }); - EXPECT_EQ(Symbols.size(), 1U); - EXPECT_FALSE(Symbols.front().SymInfo.Properties & - static_cast<index::SymbolPropertySet>( - index::SymbolProperty::TemplateSpecialization)); - EXPECT_FALSE(Symbols.front().SymInfo.Properties & - static_cast<index::SymbolPropertySet>( - index::SymbolProperty::TemplatePartialSpecialization)); + Req.Query = "TempSpec"; + EXPECT_THAT(match(*I, Req), + UnorderedElementsAre("TempSpec", "TempSpec<int, bool>", + "TempSpec<int, U>")); + + Req.Query = "TempSpec<int"; + EXPECT_THAT(match(*I, Req), + UnorderedElementsAre("TempSpec<int, bool>", "TempSpec<int, U>")); } TEST(MergeIndexTest, Lookup) { |