From 8edfc2f814fe107bf31e3470478aa9bcacdf5aed Mon Sep 17 00:00:00 2001 From: =?utf8?q?Christian=20K=C3=BChnel?= Date: Tue, 1 Feb 2022 10:14:07 +0000 Subject: [PATCH] [clangd] Cleanup of readability-identifier-naming Auto-generated patch based on clang-tidy readability-identifier-naming. Only some manual cleanup for `extern "C"` declarations and a GTest change was required. I'm not sure if this cleanup is actually very useful. It cleans up clang-tidy findings to the number of warnings from clang-tidy should be lower. Since it was easy to do and required only little cleanup I thought I'd upload it for discussion. One pattern that keeps recurring: Test **matchers** are also supposed to start with a lowercase letter as per LLVM convention. However GTest naming convention for matchers start with upper case. I would propose to keep stay consistent with the GTest convention there. However that would imply a lot of `//NOLINT` throughout these files. To re-product this patch run: ``` run-clang-tidy -checks="-*,readability-identifier-naming" -fix -format ./clang-tools-extra/clangd ``` To convert the macro names, I was using this script with some manual cleanup afterwards: https://gist.github.com/ChristianKuehnel/a01cc4362b07c58281554ab46235a077 Differential Revision: https://reviews.llvm.org/D115634 --- .clang-tidy | 4 + clang-tools-extra/clangd/ClangdLSPServer.cpp | 12 +- clang-tools-extra/clangd/SourceCode.cpp | 4 +- clang-tools-extra/clangd/TUScheduler.cpp | 8 +- clang-tools-extra/clangd/XRefs.cpp | 4 +- .../clangd/benchmarks/IndexBenchmark.cpp | 12 +- clang-tools-extra/clangd/fuzzer/clangd-fuzzer.cpp | 6 +- .../clangd/index/YAMLSerialization.cpp | 12 +- .../clangd/unittests/BackgroundIndexTests.cpp | 101 ++- .../clangd/unittests/CallHierarchyTests.cpp | 108 ++-- .../clangd/unittests/ClangdLSPServerTests.cpp | 20 +- .../clangd/unittests/CodeCompleteTests.cpp | 709 +++++++++++---------- .../clangd/unittests/CompileCommandsTests.cpp | 16 +- .../clangd/unittests/ConfigCompileTests.cpp | 30 +- .../clangd/unittests/ConfigProviderTests.cpp | 12 +- clang-tools-extra/clangd/unittests/ConfigTesting.h | 8 +- .../clangd/unittests/ConfigYAMLTests.cpp | 55 +- .../clangd/unittests/DiagnosticsTests.cpp | 188 +++--- .../clangd/unittests/DumpASTTests.cpp | 6 +- .../clangd/unittests/ExpectedTypeTest.cpp | 16 +- .../clangd/unittests/FileIndexTests.cpp | 104 +-- .../clangd/unittests/FindSymbolsTests.cpp | 590 ++++++++--------- .../clangd/unittests/HeaderSourceSwitchTests.cpp | 6 +- .../clangd/unittests/HeadersTests.cpp | 50 +- .../clangd/unittests/IncludeCleanerTests.cpp | 4 +- .../clangd/unittests/IndexActionTests.cpp | 64 +- clang-tools-extra/clangd/unittests/IndexTests.cpp | 24 +- .../clangd/unittests/JSONTransportTests.cpp | 8 +- .../clangd/unittests/ParsedASTTests.cpp | 76 +-- .../clangd/unittests/QualityTests.cpp | 6 +- .../clangd/unittests/SerializationTests.cpp | 36 +- .../clangd/unittests/SourceCodeTests.cpp | 6 +- .../clangd/unittests/SymbolCollectorTests.cpp | 534 ++++++++-------- .../clangd/unittests/SymbolInfoTests.cpp | 6 +- clang-tools-extra/clangd/unittests/TestIndex.cpp | 4 +- .../clangd/unittests/TypeHierarchyTests.cpp | 118 ++-- clang-tools-extra/clangd/unittests/URITests.cpp | 38 +- clang-tools-extra/clangd/unittests/XRefsTests.cpp | 152 ++--- .../clangd/unittests/support/ThreadingTests.cpp | 6 +- .../clangd/unittests/support/TraceTests.cpp | 18 +- 40 files changed, 1595 insertions(+), 1586 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index 879c366..f3710d1 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -6,6 +6,10 @@ CheckOptions: value: CamelCase - key: readability-identifier-naming.FunctionCase value: camelBack + # Exclude from scanning as this is an exported symbol used for fuzzing + # throughout the code base. + - key: readability-identifier-naming.FunctionIgnoredRegexp + value: "LLVMFuzzerTestOneInput" - key: readability-identifier-naming.MemberCase value: CamelCase - key: readability-identifier-naming.ParameterCase diff --git a/clang-tools-extra/clangd/ClangdLSPServer.cpp b/clang-tools-extra/clangd/ClangdLSPServer.cpp index 5b1d046..8bd95b0 100644 --- a/clang-tools-extra/clangd/ClangdLSPServer.cpp +++ b/clang-tools-extra/clangd/ClangdLSPServer.cpp @@ -71,8 +71,8 @@ llvm::Optional decodeVersion(llvm::StringRef Encoded) { return llvm::None; } -const llvm::StringLiteral APPLY_FIX_COMMAND = "clangd.applyFix"; -const llvm::StringLiteral APPLY_TWEAK_COMMAND = "clangd.applyTweak"; +const llvm::StringLiteral ApplyFixCommand = "clangd.applyFix"; +const llvm::StringLiteral ApplyTweakCommand = "clangd.applyTweak"; /// Transforms a tweak into a code action that would apply it if executed. /// EXPECTS: T.prepare() was called and returned true. @@ -88,7 +88,7 @@ CodeAction toCodeAction(const ClangdServer::TweakRef &T, const URIForFile &File, // directly. CA.command.emplace(); CA.command->title = T.Title; - CA.command->command = std::string(APPLY_TWEAK_COMMAND); + CA.command->command = std::string(ApplyTweakCommand); TweakArgs Args; Args.file = File; Args.tweakID = T.ID; @@ -950,7 +950,7 @@ static llvm::Optional asCommand(const CodeAction &Action) { if (Action.command) { Cmd = *Action.command; } else if (Action.edit) { - Cmd.command = std::string(APPLY_FIX_COMMAND); + Cmd.command = std::string(ApplyFixCommand); Cmd.argument = *Action.edit; } else { return None; @@ -1495,8 +1495,8 @@ void ClangdLSPServer::bindMethods(LSPBinder &Bind, Bind.method("$/memoryUsage", this, &ClangdLSPServer::onMemoryUsage); if (Opts.FoldingRanges) Bind.method("textDocument/foldingRange", this, &ClangdLSPServer::onFoldingRange); - Bind.command(APPLY_FIX_COMMAND, this, &ClangdLSPServer::onCommandApplyEdit); - Bind.command(APPLY_TWEAK_COMMAND, this, &ClangdLSPServer::onCommandApplyTweak); + Bind.command(ApplyFixCommand, this, &ClangdLSPServer::onCommandApplyEdit); + Bind.command(ApplyTweakCommand, this, &ClangdLSPServer::onCommandApplyTweak); ApplyWorkspaceEdit = Bind.outgoingMethod("workspace/applyEdit"); PublishDiagnostics = Bind.outgoingNotification("textDocument/publishDiagnostics"); diff --git a/clang-tools-extra/clangd/SourceCode.cpp b/clang-tools-extra/clangd/SourceCode.cpp index e005fe4..d4a38a56 100644 --- a/clang-tools-extra/clangd/SourceCode.cpp +++ b/clang-tools-extra/clangd/SourceCode.cpp @@ -1177,10 +1177,10 @@ bool isProtoFile(SourceLocation Loc, const SourceManager &SM) { return false; auto FID = SM.getFileID(Loc); // All proto generated headers should start with this line. - static const char *PROTO_HEADER_COMMENT = + static const char *ProtoHeaderComment = "// Generated by the protocol buffer compiler. DO NOT EDIT!"; // Double check that this is an actual protobuf header. - return SM.getBufferData(FID).startswith(PROTO_HEADER_COMMENT); + return SM.getBufferData(FID).startswith(ProtoHeaderComment); } namespace { diff --git a/clang-tools-extra/clangd/TUScheduler.cpp b/clang-tools-extra/clangd/TUScheduler.cpp index 9b98791..dfabdb6 100644 --- a/clang-tools-extra/clangd/TUScheduler.cpp +++ b/clang-tools-extra/clangd/TUScheduler.cpp @@ -100,10 +100,10 @@ namespace { class ASTWorker; } // namespace -static clang::clangd::Key kFileBeingProcessed; +static clang::clangd::Key FileBeingProcessed; llvm::Optional TUScheduler::getFileBeingProcessedInContext() { - if (auto *File = Context::current().get(kFileBeingProcessed)) + if (auto *File = Context::current().get(FileBeingProcessed)) return llvm::StringRef(*File); return None; } @@ -1228,7 +1228,7 @@ void ASTWorker::startTask(llvm::StringRef Name, } // Allow this request to be cancelled if invalidated. - Context Ctx = Context::current().derive(kFileBeingProcessed, FileName); + Context Ctx = Context::current().derive(FileBeingProcessed, FileName); Canceler Invalidate = nullptr; if (Invalidation) { WithContext WC(std::move(Ctx)); @@ -1656,7 +1656,7 @@ void TUScheduler::runWithPreamble(llvm::StringRef Name, PathRef File, auto Task = [Worker, Consistency, Name = Name.str(), File = File.str(), Contents = It->second->Contents, Command = Worker->getCurrentCompileCommand(), - Ctx = Context::current().derive(kFileBeingProcessed, + Ctx = Context::current().derive(FileBeingProcessed, std::string(File)), Action = std::move(Action), this]() mutable { ThreadCrashReporter ScopedReporter([&Name, &Contents, &Command]() { diff --git a/clang-tools-extra/clangd/XRefs.cpp b/clang-tools-extra/clangd/XRefs.cpp index fbe6084..c6a2445 100644 --- a/clang-tools-extra/clangd/XRefs.cpp +++ b/clang-tools-extra/clangd/XRefs.cpp @@ -1861,7 +1861,9 @@ static QualType typeForNode(const SelectionTree::Node *N) { QualType VisitCXXThrowExpr(const CXXThrowExpr *S) { return S->getSubExpr()->getType(); } - QualType VisitCoyieldStmt(const CoyieldExpr *S) { + // FIXME(sammccall): this should be VisitCoyieldExpr + // see https://reviews.llvm.org/D115634 + QualType visitCoyieldStmt(const CoyieldExpr *S) { return type(S->getOperand()); } // Treat a designated initializer like a reference to the field. diff --git a/clang-tools-extra/clangd/benchmarks/IndexBenchmark.cpp b/clang-tools-extra/clangd/benchmarks/IndexBenchmark.cpp index 77fca2a..bd32041 100644 --- a/clang-tools-extra/clangd/benchmarks/IndexBenchmark.cpp +++ b/clang-tools-extra/clangd/benchmarks/IndexBenchmark.cpp @@ -73,29 +73,29 @@ std::vector extractQueriesFromLogs() { return Requests; } -static void MemQueries(benchmark::State &State) { +static void memQueries(benchmark::State &State) { const auto Mem = buildMem(); const auto Requests = extractQueriesFromLogs(); for (auto _ : State) for (const auto &Request : Requests) Mem->fuzzyFind(Request, [](const Symbol &S) {}); } -BENCHMARK(MemQueries); +BENCHMARK(memQueries); -static void DexQueries(benchmark::State &State) { +static void dexQueries(benchmark::State &State) { const auto Dex = buildDex(); const auto Requests = extractQueriesFromLogs(); for (auto _ : State) for (const auto &Request : Requests) Dex->fuzzyFind(Request, [](const Symbol &S) {}); } -BENCHMARK(DexQueries); +BENCHMARK(dexQueries); -static void DexBuild(benchmark::State &State) { +static void dexBuild(benchmark::State &State) { for (auto _ : State) buildDex(); } -BENCHMARK(DexBuild); +BENCHMARK(dexBuild); } // namespace } // namespace clangd diff --git a/clang-tools-extra/clangd/fuzzer/clangd-fuzzer.cpp b/clang-tools-extra/clangd/fuzzer/clangd-fuzzer.cpp index 1c1ac5b..7295f03 100644 --- a/clang-tools-extra/clangd/fuzzer/clangd-fuzzer.cpp +++ b/clang-tools-extra/clangd/fuzzer/clangd-fuzzer.cpp @@ -19,12 +19,12 @@ using namespace clang::clangd; -extern "C" int LLVMFuzzerTestOneInput(uint8_t *data, size_t size) { - if (size == 0) +extern "C" int LLVMFuzzerTestOneInput(uint8_t *Data, size_t Size) { + if (Size == 0) return 0; // fmemopen isn't portable, but I think we only run the fuzzer on Linux. - std::FILE *In = fmemopen(data, size, "r"); + std::FILE *In = fmemopen(Data, Size, "r"); auto Transport = newJSONTransport(In, llvm::nulls(), /*InMirror=*/nullptr, /*Pretty=*/false, /*Style=*/JSONStreamStyle::Delimited); diff --git a/clang-tools-extra/clangd/index/YAMLSerialization.cpp b/clang-tools-extra/clangd/index/YAMLSerialization.cpp index 84bf514..ddab56e 100644 --- a/clang-tools-extra/clangd/index/YAMLSerialization.cpp +++ b/clang-tools-extra/clangd/index/YAMLSerialization.cpp @@ -161,19 +161,19 @@ template <> struct MappingTraits { }; template <> struct MappingTraits { - static void mapping(IO &io, SymbolInfo &SymInfo) { + static void mapping(IO &IO, SymbolInfo &SymInfo) { // FIXME: expose other fields? - io.mapRequired("Kind", SymInfo.Kind); - io.mapRequired("Lang", SymInfo.Lang); + IO.mapRequired("Kind", SymInfo.Kind); + IO.mapRequired("Lang", SymInfo.Lang); } }; template <> struct MappingTraits { - static void mapping(IO &io, + static void mapping(IO &IO, clang::clangd::Symbol::IncludeHeaderWithReferences &Inc) { - io.mapRequired("Header", Inc.IncludeHeader); - io.mapRequired("References", Inc.References); + IO.mapRequired("Header", Inc.IncludeHeader); + IO.mapRequired("References", Inc.References); } }; diff --git a/clang-tools-extra/clangd/unittests/BackgroundIndexTests.cpp b/clang-tools-extra/clangd/unittests/BackgroundIndexTests.cpp index 9b60d62..247ddf6 100644 --- a/clang-tools-extra/clangd/unittests/BackgroundIndexTests.cpp +++ b/clang-tools-extra/clangd/unittests/BackgroundIndexTests.cpp @@ -28,28 +28,28 @@ using ::testing::UnorderedElementsAre; namespace clang { namespace clangd { -MATCHER_P(Named, N, "") { return arg.Name == N; } -MATCHER_P(QName, N, "") { return (arg.Scope + arg.Name).str() == N; } -MATCHER(Declared, "") { +MATCHER_P(named, N, "") { return arg.Name == N; } +MATCHER_P(qName, N, "") { return (arg.Scope + arg.Name).str() == N; } +MATCHER(declared, "") { return !StringRef(arg.CanonicalDeclaration.FileURI).empty(); } -MATCHER(Defined, "") { return !StringRef(arg.Definition.FileURI).empty(); } -MATCHER_P(FileURI, F, "") { return StringRef(arg.Location.FileURI) == F; } +MATCHER(defined, "") { return !StringRef(arg.Definition.FileURI).empty(); } +MATCHER_P(fileURI, F, "") { return StringRef(arg.Location.FileURI) == F; } ::testing::Matcher -RefsAre(std::vector<::testing::Matcher> Matchers) { +refsAre(std::vector<::testing::Matcher> Matchers) { return ElementsAre(::testing::Pair(_, UnorderedElementsAreArray(Matchers))); } // URI cannot be empty since it references keys in the IncludeGraph. -MATCHER(EmptyIncludeNode, "") { +MATCHER(emptyIncludeNode, "") { return arg.Flags == IncludeGraphNode::SourceFlag::None && !arg.URI.empty() && arg.Digest == FileDigest{{0}} && arg.DirectIncludes.empty(); } -MATCHER(HadErrors, "") { +MATCHER(hadErrors, "") { return arg.Flags & IncludeGraphNode::SourceFlag::HadErrors; } -MATCHER_P(NumReferences, N, "") { return arg.References == N; } +MATCHER_P(numReferences, N, "") { return arg.References == N; } class MemoryShardStorage : public BackgroundIndexStorage { mutable std::mutex StorageMu; @@ -159,8 +159,8 @@ TEST_F(BackgroundIndexTest, Config) { // Wait for both files to be indexed. ASSERT_TRUE(Idx.blockUntilIdleForTest()); EXPECT_THAT(runFuzzyFind(Idx, ""), - UnorderedElementsAre(QName("foo"), QName("foo::two"), - QName("bar"), QName("bar::one"))); + UnorderedElementsAre(qName("foo"), qName("foo::two"), + qName("bar"), qName("bar::one"))); } TEST_F(BackgroundIndexTest, IndexTwoFiles) { @@ -203,11 +203,11 @@ TEST_F(BackgroundIndexTest, IndexTwoFiles) { ASSERT_TRUE(Idx.blockUntilIdleForTest()); EXPECT_THAT(runFuzzyFind(Idx, ""), - UnorderedElementsAre(AllOf(Named("common"), NumReferences(1U)), - AllOf(Named("A_CC"), NumReferences(0U)), - AllOf(Named("g"), NumReferences(1U)), - AllOf(Named("f_b"), Declared(), - Not(Defined()), NumReferences(0U)))); + UnorderedElementsAre(AllOf(named("common"), numReferences(1U)), + AllOf(named("A_CC"), numReferences(0U)), + AllOf(named("g"), numReferences(1U)), + AllOf(named("f_b"), declared(), + Not(defined()), numReferences(0U)))); Cmd.Filename = testPath("root/B.cc"); Cmd.CommandLine = {"clang++", Cmd.Filename}; @@ -216,22 +216,22 @@ TEST_F(BackgroundIndexTest, IndexTwoFiles) { ASSERT_TRUE(Idx.blockUntilIdleForTest()); // B_CC is dropped as we don't collect symbols from A.h in this compilation. EXPECT_THAT(runFuzzyFind(Idx, ""), - UnorderedElementsAre(AllOf(Named("common"), NumReferences(5U)), - AllOf(Named("A_CC"), NumReferences(0U)), - AllOf(Named("g"), NumReferences(1U)), - AllOf(Named("f_b"), Declared(), Defined(), - NumReferences(1U)))); + UnorderedElementsAre(AllOf(named("common"), numReferences(5U)), + AllOf(named("A_CC"), numReferences(0U)), + AllOf(named("g"), numReferences(1U)), + AllOf(named("f_b"), declared(), defined(), + numReferences(1U)))); auto Syms = runFuzzyFind(Idx, "common"); - EXPECT_THAT(Syms, UnorderedElementsAre(Named("common"))); + EXPECT_THAT(Syms, UnorderedElementsAre(named("common"))); auto Common = *Syms.begin(); EXPECT_THAT(getRefs(Idx, Common.ID), - RefsAre({FileURI("unittest:///root/A.h"), - FileURI("unittest:///root/A.cc"), - FileURI("unittest:///root/B.cc"), - FileURI("unittest:///root/B.cc"), - FileURI("unittest:///root/B.cc"), - FileURI("unittest:///root/B.cc")})); + refsAre({fileURI("unittest:///root/A.h"), + fileURI("unittest:///root/A.cc"), + fileURI("unittest:///root/B.cc"), + fileURI("unittest:///root/B.cc"), + fileURI("unittest:///root/B.cc"), + fileURI("unittest:///root/B.cc")})); } TEST_F(BackgroundIndexTest, MainFileRefs) { @@ -259,8 +259,8 @@ TEST_F(BackgroundIndexTest, MainFileRefs) { ASSERT_TRUE(Idx.blockUntilIdleForTest()); EXPECT_THAT( runFuzzyFind(Idx, ""), - UnorderedElementsAre(AllOf(Named("header_sym"), NumReferences(1U)), - AllOf(Named("main_sym"), NumReferences(1U)))); + UnorderedElementsAre(AllOf(named("header_sym"), numReferences(1U)), + AllOf(named("main_sym"), numReferences(1U)))); } TEST_F(BackgroundIndexTest, ShardStorageTest) { @@ -270,7 +270,6 @@ TEST_F(BackgroundIndexTest, ShardStorageTest) { void f_b(); class A_CC {}; )cpp"; - std::string A_CC = ""; FS.Files[testPath("root/A.cc")] = R"cpp( #include "A.h" void g() { (void)common; } @@ -310,19 +309,19 @@ TEST_F(BackgroundIndexTest, ShardStorageTest) { EXPECT_NE(ShardHeader, nullptr); EXPECT_THAT( *ShardHeader->Symbols, - UnorderedElementsAre(Named("common"), Named("A_CC"), - AllOf(Named("f_b"), Declared(), Not(Defined())))); + UnorderedElementsAre(named("common"), named("A_CC"), + AllOf(named("f_b"), declared(), Not(defined())))); for (const auto &Ref : *ShardHeader->Refs) EXPECT_THAT(Ref.second, - UnorderedElementsAre(FileURI("unittest:///root/A.h"))); + UnorderedElementsAre(fileURI("unittest:///root/A.h"))); auto ShardSource = MSS.loadShard(testPath("root/A.cc")); EXPECT_NE(ShardSource, nullptr); EXPECT_THAT(*ShardSource->Symbols, - UnorderedElementsAre(Named("g"), Named("B_CC"))); + UnorderedElementsAre(named("g"), named("B_CC"))); for (const auto &Ref : *ShardSource->Refs) EXPECT_THAT(Ref.second, - UnorderedElementsAre(FileURI("unittest:///root/A.cc"))); + UnorderedElementsAre(fileURI("unittest:///root/A.cc"))); // The BaseOf relationship between A_CC and B_CC is stored in both the file // containing the definition of the subject (A_CC) and the file containing @@ -344,8 +343,8 @@ TEST_F(BackgroundIndexTest, DirectIncludesTest) { void f_b(); class A_CC {}; )cpp"; - std::string A_CC = "#include \"A.h\"\nvoid g() { (void)common; }"; - FS.Files[testPath("root/A.cc")] = A_CC; + FS.Files[testPath("root/A.cc")] = + "#include \"A.h\"\nvoid g() { (void)common; }"; llvm::StringMap Storage; size_t CacheHits = 0; @@ -372,7 +371,7 @@ TEST_F(BackgroundIndexTest, DirectIncludesTest) { EXPECT_NE(ShardSource->Sources->lookup("unittest:///root/A.cc").Digest, FileDigest{{0}}); EXPECT_THAT(ShardSource->Sources->lookup("unittest:///root/A.h"), - EmptyIncludeNode()); + emptyIncludeNode()); auto ShardHeader = MSS.loadShard(testPath("root/A.h")); EXPECT_TRUE(ShardHeader->Sources); @@ -383,7 +382,7 @@ TEST_F(BackgroundIndexTest, DirectIncludesTest) { EXPECT_NE(ShardHeader->Sources->lookup("unittest:///root/A.h").Digest, FileDigest{{0}}); EXPECT_THAT(ShardHeader->Sources->lookup("unittest:///root/B.h"), - EmptyIncludeNode()); + emptyIncludeNode()); } TEST_F(BackgroundIndexTest, ShardStorageLoad) { @@ -432,7 +431,7 @@ TEST_F(BackgroundIndexTest, ShardStorageLoad) { // Check if the new symbol has arrived. auto ShardHeader = MSS.loadShard(testPath("root/A.h")); EXPECT_NE(ShardHeader, nullptr); - EXPECT_THAT(*ShardHeader->Symbols, Contains(Named("A_CCnew"))); + EXPECT_THAT(*ShardHeader->Symbols, Contains(named("A_CCnew"))); // Change source. FS.Files[testPath("root/A.cc")] = @@ -450,11 +449,11 @@ TEST_F(BackgroundIndexTest, ShardStorageLoad) { // Check if the new symbol has arrived. ShardHeader = MSS.loadShard(testPath("root/A.h")); EXPECT_NE(ShardHeader, nullptr); - EXPECT_THAT(*ShardHeader->Symbols, Contains(Named("A_CCnew"))); + EXPECT_THAT(*ShardHeader->Symbols, Contains(named("A_CCnew"))); auto ShardSource = MSS.loadShard(testPath("root/A.cc")); EXPECT_NE(ShardSource, nullptr); EXPECT_THAT(*ShardSource->Symbols, - Contains(AllOf(Named("f_b"), Declared(), Defined()))); + Contains(AllOf(named("f_b"), declared(), defined()))); } TEST_F(BackgroundIndexTest, ShardStorageEmptyFile) { @@ -522,7 +521,7 @@ TEST_F(BackgroundIndexTest, ShardStorageEmptyFile) { ShardHeader = MSS.loadShard(testPath("root/B.h")); EXPECT_NE(ShardHeader, nullptr); EXPECT_THAT(*ShardHeader->Symbols, - Contains(AllOf(Named("new_func"), Declared(), Not(Defined())))); + Contains(AllOf(named("new_func"), declared(), Not(defined())))); } TEST_F(BackgroundIndexTest, NoDotsInAbsPath) { @@ -587,27 +586,27 @@ TEST_F(BackgroundIndexTest, UncompilableFiles) { { auto Shard = MSS.loadShard(testPath("A.cc")); - EXPECT_THAT(*Shard->Symbols, UnorderedElementsAre(Named("foo"))); + EXPECT_THAT(*Shard->Symbols, UnorderedElementsAre(named("foo"))); EXPECT_THAT(Shard->Sources->keys(), UnorderedElementsAre("unittest:///A.cc", "unittest:///A.h", "unittest:///B.h")); - EXPECT_THAT(Shard->Sources->lookup("unittest:///A.cc"), HadErrors()); + EXPECT_THAT(Shard->Sources->lookup("unittest:///A.cc"), hadErrors()); } { auto Shard = MSS.loadShard(testPath("A.h")); - EXPECT_THAT(*Shard->Symbols, UnorderedElementsAre(Named("foo"))); + EXPECT_THAT(*Shard->Symbols, UnorderedElementsAre(named("foo"))); EXPECT_THAT(Shard->Sources->keys(), UnorderedElementsAre("unittest:///A.h")); - EXPECT_THAT(Shard->Sources->lookup("unittest:///A.h"), HadErrors()); + EXPECT_THAT(Shard->Sources->lookup("unittest:///A.h"), hadErrors()); } { auto Shard = MSS.loadShard(testPath("B.h")); - EXPECT_THAT(*Shard->Symbols, UnorderedElementsAre(Named("asdf"))); + EXPECT_THAT(*Shard->Symbols, UnorderedElementsAre(named("asdf"))); EXPECT_THAT(Shard->Sources->keys(), UnorderedElementsAre("unittest:///B.h", "unittest:///C.h")); - EXPECT_THAT(Shard->Sources->lookup("unittest:///B.h"), HadErrors()); + EXPECT_THAT(Shard->Sources->lookup("unittest:///B.h"), hadErrors()); } { @@ -615,7 +614,7 @@ TEST_F(BackgroundIndexTest, UncompilableFiles) { EXPECT_THAT(*Shard->Symbols, UnorderedElementsAre()); EXPECT_THAT(Shard->Sources->keys(), UnorderedElementsAre("unittest:///C.h")); - EXPECT_THAT(Shard->Sources->lookup("unittest:///C.h"), HadErrors()); + EXPECT_THAT(Shard->Sources->lookup("unittest:///C.h"), hadErrors()); } } diff --git a/clang-tools-extra/clangd/unittests/CallHierarchyTests.cpp b/clang-tools-extra/clangd/unittests/CallHierarchyTests.cpp index a9d0385..b2f3a14 100644 --- a/clang-tools-extra/clangd/unittests/CallHierarchyTests.cpp +++ b/clang-tools-extra/clangd/unittests/CallHierarchyTests.cpp @@ -52,15 +52,15 @@ using ::testing::Matcher; using ::testing::UnorderedElementsAre; // Helpers for matching call hierarchy data structures. -MATCHER_P(WithName, N, "") { return arg.name == N; } -MATCHER_P(WithSelectionRange, R, "") { return arg.selectionRange == R; } +MATCHER_P(withName, N, "") { return arg.name == N; } +MATCHER_P(withSelectionRange, R, "") { return arg.selectionRange == R; } template -::testing::Matcher From(ItemMatcher M) { +::testing::Matcher from(ItemMatcher M) { return Field(&CallHierarchyIncomingCall::from, M); } template -::testing::Matcher FromRanges(RangeMatchers... M) { +::testing::Matcher fromRanges(RangeMatchers... M) { return Field(&CallHierarchyIncomingCall::fromRanges, UnorderedElementsAre(M...)); } @@ -86,23 +86,23 @@ TEST(CallHierarchy, IncomingOneFileCpp) { std::vector Items = prepareCallHierarchy(AST, Source.point(), testPath(TU.Filename)); - ASSERT_THAT(Items, ElementsAre(WithName("callee"))); + ASSERT_THAT(Items, ElementsAre(withName("callee"))); auto IncomingLevel1 = incomingCalls(Items[0], Index.get()); ASSERT_THAT(IncomingLevel1, - ElementsAre(AllOf(From(WithName("caller1")), - FromRanges(Source.range("Callee"))))); + ElementsAre(AllOf(from(withName("caller1")), + fromRanges(Source.range("Callee"))))); auto IncomingLevel2 = incomingCalls(IncomingLevel1[0].from, Index.get()); ASSERT_THAT(IncomingLevel2, - ElementsAre(AllOf(From(WithName("caller2")), - FromRanges(Source.range("Caller1A"), + ElementsAre(AllOf(from(withName("caller2")), + fromRanges(Source.range("Caller1A"), Source.range("Caller1B"))), - AllOf(From(WithName("caller3")), - FromRanges(Source.range("Caller1C"))))); + AllOf(from(withName("caller3")), + fromRanges(Source.range("Caller1C"))))); auto IncomingLevel3 = incomingCalls(IncomingLevel2[0].from, Index.get()); ASSERT_THAT(IncomingLevel3, - ElementsAre(AllOf(From(WithName("caller3")), - FromRanges(Source.range("Caller2"))))); + ElementsAre(AllOf(from(withName("caller3")), + fromRanges(Source.range("Caller2"))))); auto IncomingLevel4 = incomingCalls(IncomingLevel3[0].from, Index.get()); EXPECT_THAT(IncomingLevel4, IsEmpty()); @@ -131,23 +131,23 @@ TEST(CallHierarchy, IncomingOneFileObjC) { auto Index = TU.index(); std::vector Items = prepareCallHierarchy(AST, Source.point(), testPath(TU.Filename)); - ASSERT_THAT(Items, ElementsAre(WithName("callee"))); + ASSERT_THAT(Items, ElementsAre(withName("callee"))); auto IncomingLevel1 = incomingCalls(Items[0], Index.get()); ASSERT_THAT(IncomingLevel1, - ElementsAre(AllOf(From(WithName("caller1")), - FromRanges(Source.range("Callee"))))); + ElementsAre(AllOf(from(withName("caller1")), + fromRanges(Source.range("Callee"))))); auto IncomingLevel2 = incomingCalls(IncomingLevel1[0].from, Index.get()); ASSERT_THAT(IncomingLevel2, - ElementsAre(AllOf(From(WithName("caller2")), - FromRanges(Source.range("Caller1A"), + ElementsAre(AllOf(from(withName("caller2")), + fromRanges(Source.range("Caller1A"), Source.range("Caller1B"))), - AllOf(From(WithName("caller3")), - FromRanges(Source.range("Caller1C"))))); + AllOf(from(withName("caller3")), + fromRanges(Source.range("Caller1C"))))); auto IncomingLevel3 = incomingCalls(IncomingLevel2[0].from, Index.get()); ASSERT_THAT(IncomingLevel3, - ElementsAre(AllOf(From(WithName("caller3")), - FromRanges(Source.range("Caller2"))))); + ElementsAre(AllOf(from(withName("caller3")), + fromRanges(Source.range("Caller2"))))); auto IncomingLevel4 = incomingCalls(IncomingLevel3[0].from, Index.get()); EXPECT_THAT(IncomingLevel4, IsEmpty()); @@ -174,16 +174,16 @@ TEST(CallHierarchy, MainFileOnlyRef) { std::vector Items = prepareCallHierarchy(AST, Source.point(), testPath(TU.Filename)); - ASSERT_THAT(Items, ElementsAre(WithName("callee"))); + ASSERT_THAT(Items, ElementsAre(withName("callee"))); auto IncomingLevel1 = incomingCalls(Items[0], Index.get()); ASSERT_THAT(IncomingLevel1, - ElementsAre(AllOf(From(WithName("caller1")), - FromRanges(Source.range("Callee"))))); + ElementsAre(AllOf(from(withName("caller1")), + fromRanges(Source.range("Callee"))))); auto IncomingLevel2 = incomingCalls(IncomingLevel1[0].from, Index.get()); EXPECT_THAT(IncomingLevel2, - ElementsAre(AllOf(From(WithName("caller2")), - FromRanges(Source.range("Caller1"))))); + ElementsAre(AllOf(from(withName("caller2")), + fromRanges(Source.range("Caller1"))))); } TEST(CallHierarchy, IncomingQualified) { @@ -207,13 +207,13 @@ TEST(CallHierarchy, IncomingQualified) { std::vector Items = prepareCallHierarchy(AST, Source.point(), testPath(TU.Filename)); - ASSERT_THAT(Items, ElementsAre(WithName("Waldo::find"))); + ASSERT_THAT(Items, ElementsAre(withName("Waldo::find"))); auto Incoming = incomingCalls(Items[0], Index.get()); EXPECT_THAT(Incoming, - ElementsAre(AllOf(From(WithName("caller1")), - FromRanges(Source.range("Caller1"))), - AllOf(From(WithName("caller2")), - FromRanges(Source.range("Caller2"))))); + ElementsAre(AllOf(from(withName("caller1")), + fromRanges(Source.range("Caller1"))), + AllOf(from(withName("caller2")), + fromRanges(Source.range("Caller2"))))); } TEST(CallHierarchy, IncomingMultiFileCpp) { @@ -273,24 +273,24 @@ TEST(CallHierarchy, IncomingMultiFileCpp) { auto CheckCallHierarchy = [&](ParsedAST &AST, Position Pos, PathRef TUPath) { std::vector Items = prepareCallHierarchy(AST, Pos, TUPath); - ASSERT_THAT(Items, ElementsAre(WithName("callee"))); + ASSERT_THAT(Items, ElementsAre(withName("callee"))); auto IncomingLevel1 = incomingCalls(Items[0], Index.get()); ASSERT_THAT(IncomingLevel1, - ElementsAre(AllOf(From(WithName("caller1")), - FromRanges(Caller1C.range())))); + ElementsAre(AllOf(from(withName("caller1")), + fromRanges(Caller1C.range())))); auto IncomingLevel2 = incomingCalls(IncomingLevel1[0].from, Index.get()); ASSERT_THAT( IncomingLevel2, - ElementsAre(AllOf(From(WithName("caller2")), - FromRanges(Caller2C.range("A"), Caller2C.range("B"))), - AllOf(From(WithName("caller3")), - FromRanges(Caller3C.range("Caller1"))))); + ElementsAre(AllOf(from(withName("caller2")), + fromRanges(Caller2C.range("A"), Caller2C.range("B"))), + AllOf(from(withName("caller3")), + fromRanges(Caller3C.range("Caller1"))))); auto IncomingLevel3 = incomingCalls(IncomingLevel2[0].from, Index.get()); ASSERT_THAT(IncomingLevel3, - ElementsAre(AllOf(From(WithName("caller3")), - FromRanges(Caller3C.range("Caller2"))))); + ElementsAre(AllOf(from(withName("caller3")), + fromRanges(Caller3C.range("Caller2"))))); auto IncomingLevel4 = incomingCalls(IncomingLevel3[0].from, Index.get()); EXPECT_THAT(IncomingLevel4, IsEmpty()); @@ -382,24 +382,24 @@ TEST(CallHierarchy, IncomingMultiFileObjC) { auto CheckCallHierarchy = [&](ParsedAST &AST, Position Pos, PathRef TUPath) { std::vector Items = prepareCallHierarchy(AST, Pos, TUPath); - ASSERT_THAT(Items, ElementsAre(WithName("callee"))); + ASSERT_THAT(Items, ElementsAre(withName("callee"))); auto IncomingLevel1 = incomingCalls(Items[0], Index.get()); ASSERT_THAT(IncomingLevel1, - ElementsAre(AllOf(From(WithName("caller1")), - FromRanges(Caller1C.range())))); + ElementsAre(AllOf(from(withName("caller1")), + fromRanges(Caller1C.range())))); auto IncomingLevel2 = incomingCalls(IncomingLevel1[0].from, Index.get()); ASSERT_THAT( IncomingLevel2, - ElementsAre(AllOf(From(WithName("caller2")), - FromRanges(Caller2C.range("A"), Caller2C.range("B"))), - AllOf(From(WithName("caller3")), - FromRanges(Caller3C.range("Caller1"))))); + ElementsAre(AllOf(from(withName("caller2")), + fromRanges(Caller2C.range("A"), Caller2C.range("B"))), + AllOf(from(withName("caller3")), + fromRanges(Caller3C.range("Caller1"))))); auto IncomingLevel3 = incomingCalls(IncomingLevel2[0].from, Index.get()); ASSERT_THAT(IncomingLevel3, - ElementsAre(AllOf(From(WithName("caller3")), - FromRanges(Caller3C.range("Caller2"))))); + ElementsAre(AllOf(from(withName("caller3")), + fromRanges(Caller3C.range("Caller2"))))); auto IncomingLevel4 = incomingCalls(IncomingLevel3[0].from, Index.get()); EXPECT_THAT(IncomingLevel4, IsEmpty()); @@ -444,15 +444,15 @@ TEST(CallHierarchy, CallInLocalVarDecl) { std::vector Items = prepareCallHierarchy(AST, Source.point(), testPath(TU.Filename)); - ASSERT_THAT(Items, ElementsAre(WithName("callee"))); + ASSERT_THAT(Items, ElementsAre(withName("callee"))); auto Incoming = incomingCalls(Items[0], Index.get()); ASSERT_THAT( Incoming, ElementsAre( - AllOf(From(WithName("caller1")), FromRanges(Source.range("call1"))), - AllOf(From(WithName("caller2")), FromRanges(Source.range("call2"))), - AllOf(From(WithName("caller3")), FromRanges(Source.range("call3"))))); + AllOf(from(withName("caller1")), fromRanges(Source.range("call1"))), + AllOf(from(withName("caller2")), fromRanges(Source.range("call2"))), + AllOf(from(withName("caller3")), fromRanges(Source.range("call3"))))); } } // namespace diff --git a/clang-tools-extra/clangd/unittests/ClangdLSPServerTests.cpp b/clang-tools-extra/clangd/unittests/ClangdLSPServerTests.cpp index b3eaae6..722a5fb 100644 --- a/clang-tools-extra/clangd/unittests/ClangdLSPServerTests.cpp +++ b/clang-tools-extra/clangd/unittests/ClangdLSPServerTests.cpp @@ -27,7 +27,7 @@ namespace { using llvm::Succeeded; using testing::ElementsAre; -MATCHER_P(DiagMessage, M, "") { +MATCHER_P(diagMessage, M, "") { if (const auto *O = arg.getAsObject()) { if (const auto Msg = O->getString("message")) return *Msg == M; @@ -125,12 +125,12 @@ TEST_F(LSPTest, Diagnostics) { Client.didOpen("foo.cpp", "void main(int, char**);"); EXPECT_THAT(Client.diagnostics("foo.cpp"), llvm::ValueIs(testing::ElementsAre( - DiagMessage("'main' must return 'int' (fix available)")))); + diagMessage("'main' must return 'int' (fix available)")))); Client.didChange("foo.cpp", "int x = \"42\";"); EXPECT_THAT(Client.diagnostics("foo.cpp"), llvm::ValueIs(testing::ElementsAre( - DiagMessage("Cannot initialize a variable of type 'int' with " + diagMessage("Cannot initialize a variable of type 'int' with " "an lvalue of type 'const char[3]'")))); Client.didClose("foo.cpp"); @@ -145,8 +145,8 @@ TEST_F(LSPTest, DiagnosticsHeaderSaved) { )cpp"); EXPECT_THAT(Client.diagnostics("foo.cpp"), llvm::ValueIs(testing::ElementsAre( - DiagMessage("'foo.h' file not found"), - DiagMessage("Use of undeclared identifier 'VAR'")))); + diagMessage("'foo.h' file not found"), + diagMessage("Use of undeclared identifier 'VAR'")))); // Now create the header. FS.Files["foo.h"] = "#define VAR original"; Client.notify( @@ -154,7 +154,7 @@ TEST_F(LSPTest, DiagnosticsHeaderSaved) { llvm::json::Object{{"textDocument", Client.documentID("foo.h")}}); EXPECT_THAT(Client.diagnostics("foo.cpp"), llvm::ValueIs(testing::ElementsAre( - DiagMessage("Use of undeclared identifier 'original'")))); + diagMessage("Use of undeclared identifier 'original'")))); // Now modify the header from within the "editor". FS.Files["foo.h"] = "#define VAR changed"; Client.notify( @@ -163,7 +163,7 @@ TEST_F(LSPTest, DiagnosticsHeaderSaved) { // Foo.cpp should be rebuilt with new diagnostics. EXPECT_THAT(Client.diagnostics("foo.cpp"), llvm::ValueIs(testing::ElementsAre( - DiagMessage("Use of undeclared identifier 'changed'")))); + diagMessage("Use of undeclared identifier 'changed'")))); } TEST_F(LSPTest, RecordsLatencies) { @@ -221,12 +221,12 @@ CompileFlags: Client.didOpen("foo.cpp", "int x = FOO;"); EXPECT_THAT(Client.diagnostics("foo.cpp"), llvm::ValueIs(testing::ElementsAre( - DiagMessage("Use of undeclared identifier 'FOO'")))); + diagMessage("Use of undeclared identifier 'FOO'")))); // bar.cpp shows the configured compile command. Client.didOpen("bar.cpp", "int x = FOO;"); EXPECT_THAT(Client.diagnostics("bar.cpp"), llvm::ValueIs(testing::ElementsAre( - DiagMessage("Use of undeclared identifier 'BAR'")))); + diagMessage("Use of undeclared identifier 'BAR'")))); } TEST_F(LSPTest, ModulesTest) { @@ -384,7 +384,7 @@ TEST_F(LSPTest, DiagModuleTest) { auto &Client = start(); Client.didOpen("foo.cpp", "test;"); EXPECT_THAT(Client.diagnostics("foo.cpp"), - llvm::ValueIs(testing::ElementsAre(DiagMessage(DiagMsg)))); + llvm::ValueIs(testing::ElementsAre(diagMessage(DiagMsg)))); } } // namespace } // namespace clangd diff --git a/clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp b/clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp index c602627..a0fcb62 100644 --- a/clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp +++ b/clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp @@ -52,47 +52,47 @@ using ::testing::UnorderedElementsAre; using ContextKind = CodeCompletionContext::Kind; // GMock helpers for matching completion items. -MATCHER_P(Named, Name, "") { return arg.Name == Name; } -MATCHER_P(MainFileRefs, Refs, "") { return arg.MainFileRefs == Refs; } -MATCHER_P(ScopeRefs, Refs, "") { return arg.ScopeRefsInFile == Refs; } -MATCHER_P(NameStartsWith, Prefix, "") { +MATCHER_P(named, Name, "") { return arg.Name == Name; } +MATCHER_P(mainFileRefs, Refs, "") { return arg.MainFileRefs == Refs; } +MATCHER_P(scopeRefs, Refs, "") { return arg.ScopeRefsInFile == Refs; } +MATCHER_P(nameStartsWith, Prefix, "") { return llvm::StringRef(arg.Name).startswith(Prefix); } -MATCHER_P(Scope, S, "") { return arg.Scope == S; } -MATCHER_P(Qualifier, Q, "") { return arg.RequiredQualifier == Q; } -MATCHER_P(Labeled, Label, "") { +MATCHER_P(scope, S, "") { return arg.Scope == S; } +MATCHER_P(qualifier, Q, "") { return arg.RequiredQualifier == Q; } +MATCHER_P(labeled, Label, "") { return arg.RequiredQualifier + arg.Name + arg.Signature == Label; } -MATCHER_P(SigHelpLabeled, Label, "") { return arg.label == Label; } -MATCHER_P(Kind, K, "") { return arg.Kind == K; } -MATCHER_P(Doc, D, "") { +MATCHER_P(sigHelpLabeled, Label, "") { return arg.label == Label; } +MATCHER_P(kind, K, "") { return arg.Kind == K; } +MATCHER_P(doc, D, "") { return arg.Documentation && arg.Documentation->asPlainText() == D; } -MATCHER_P(ReturnType, D, "") { return arg.ReturnType == D; } -MATCHER_P(HasInclude, IncludeHeader, "") { +MATCHER_P(returnType, D, "") { return arg.ReturnType == D; } +MATCHER_P(hasInclude, IncludeHeader, "") { return !arg.Includes.empty() && arg.Includes[0].Header == IncludeHeader; } -MATCHER_P(InsertInclude, IncludeHeader, "") { +MATCHER_P(insertInclude, IncludeHeader, "") { return !arg.Includes.empty() && arg.Includes[0].Header == IncludeHeader && bool(arg.Includes[0].Insertion); } -MATCHER(InsertInclude, "") { +MATCHER(insertInclude, "") { return !arg.Includes.empty() && bool(arg.Includes[0].Insertion); } -MATCHER_P(SnippetSuffix, Text, "") { return arg.SnippetSuffix == Text; } -MATCHER_P(Origin, OriginSet, "") { return arg.Origin == OriginSet; } -MATCHER_P(Signature, S, "") { return arg.Signature == S; } +MATCHER_P(snippetSuffix, Text, "") { return arg.SnippetSuffix == Text; } +MATCHER_P(origin, OriginSet, "") { return arg.Origin == OriginSet; } +MATCHER_P(signature, S, "") { return arg.Signature == S; } -// Shorthand for Contains(Named(Name)). -Matcher &> Has(std::string Name) { - return Contains(Named(std::move(Name))); +// Shorthand for Contains(named(Name)). +Matcher &> has(std::string Name) { + return Contains(named(std::move(Name))); } -Matcher &> Has(std::string Name, +Matcher &> has(std::string Name, CompletionItemKind K) { - return Contains(AllOf(Named(std::move(Name)), Kind(K))); + return Contains(AllOf(named(std::move(Name)), kind(K))); } -MATCHER(IsDocumented, "") { return arg.Documentation.hasValue(); } -MATCHER(Deprecated, "") { return arg.Deprecated; } +MATCHER(isDocumented, "") { return arg.Documentation.hasValue(); } +MATCHER(deprecated, "") { return arg.Deprecated; } std::unique_ptr memIndex(std::vector Symbols) { SymbolSlab::Builder Slab; @@ -177,7 +177,7 @@ int func() { MemberAccess().ABG^ } )cpp", /*IndexSymbols=*/{}, Opts); EXPECT_THAT(Results.Completions, - ElementsAre(Named("ABG"), Named("AlphaBetaGamma"))); + ElementsAre(named("ABG"), named("AlphaBetaGamma"))); } TEST(DecisionForestRankingModel, ReferencesAffectRanking) { @@ -189,13 +189,13 @@ TEST(DecisionForestRankingModel, ReferencesAffectRanking) { {ns("clangA"), withReferences(NumReferences, func("clangD"))}, Opts) .Completions, - ElementsAre(Named("clangD"), Named("clangA"))); + ElementsAre(named("clangD"), named("clangA"))); EXPECT_THAT( completions("int main() { clang^ }", {withReferences(NumReferences, ns("clangA")), func("clangD")}, Opts) .Completions, - ElementsAre(Named("clangA"), Named("clangD"))); + ElementsAre(named("clangA"), named("clangD"))); } TEST(DecisionForestRankingModel, DecisionForestScorerCallbackTest) { @@ -240,7 +240,7 @@ int main() { ClassWithMembers().^ } /*IndexSymbols=*/{}, Opts); EXPECT_TRUE(Results.HasMore); - EXPECT_THAT(Results.Completions, ElementsAre(Named("AAA"), Named("BBB"))); + EXPECT_THAT(Results.Completions, ElementsAre(named("AAA"), named("BBB"))); } TEST(CompletionTest, Filter) { @@ -256,16 +256,16 @@ TEST(CompletionTest, Filter) { // Only items matching the fuzzy query are returned. EXPECT_THAT(completions(Body + "int main() { S().Foba^ }").Completions, - AllOf(Has("FooBar"), Has("FooBaz"), Not(Has("Qux")))); + AllOf(has("FooBar"), has("FooBaz"), Not(has("Qux")))); // Macros require prefix match, either from index or AST. Symbol Sym = var("MotorCarIndex"); Sym.SymInfo.Kind = index::SymbolKind::Macro; EXPECT_THAT( completions(Body + "int main() { C^ }", {Sym}).Completions, - AllOf(Has("Car"), Not(Has("MotorCar")), Not(Has("MotorCarIndex")))); + AllOf(has("Car"), Not(has("MotorCar")), Not(has("MotorCarIndex")))); EXPECT_THAT(completions(Body + "int main() { M^ }", {Sym}).Completions, - AllOf(Has("MotorCar"), Has("MotorCarIndex"))); + AllOf(has("MotorCar"), has("MotorCarIndex"))); } void testAfterDotCompletion(clangd::CodeCompleteOptions Opts) { @@ -281,7 +281,7 @@ void testAfterDotCompletion(clangd::CodeCompleteOptions Opts) { struct GlobalClass {}; struct ClassWithMembers { - /// Doc for method. + /// doc for method. int method(); int field; @@ -292,7 +292,7 @@ void testAfterDotCompletion(clangd::CodeCompleteOptions Opts) { int test() { struct LocalClass {}; - /// Doc for local_var. + /// doc for local_var. int local_var; ClassWithMembers().^ @@ -304,22 +304,22 @@ void testAfterDotCompletion(clangd::CodeCompleteOptions Opts) { // Class members. The only items that must be present in after-dot // completion. EXPECT_THAT(Results.Completions, - AllOf(Has("method"), Has("field"), Not(Has("ClassWithMembers")), - Not(Has("operator=")), Not(Has("~ClassWithMembers")))); + AllOf(has("method"), has("field"), Not(has("ClassWithMembers")), + Not(has("operator=")), Not(has("~ClassWithMembers")))); EXPECT_IFF(Opts.IncludeIneligibleResults, Results.Completions, - Has("private_field")); + has("private_field")); // Global items. EXPECT_THAT( Results.Completions, - Not(AnyOf(Has("global_var"), Has("index_var"), Has("global_func"), - Has("global_func()"), Has("index_func"), Has("GlobalClass"), - Has("IndexClass"), Has("MACRO"), Has("LocalClass")))); + Not(AnyOf(has("global_var"), has("index_var"), has("global_func"), + has("global_func()"), has("index_func"), has("GlobalClass"), + has("IndexClass"), has("MACRO"), has("LocalClass")))); // There should be no code patterns (aka snippets) in after-dot // completion. At least there aren't any we're aware of. EXPECT_THAT(Results.Completions, - Not(Contains(Kind(CompletionItemKind::Snippet)))); + Not(Contains(kind(CompletionItemKind::Snippet)))); // Check documentation. - EXPECT_THAT(Results.Completions, Contains(IsDocumented())); + EXPECT_THAT(Results.Completions, Contains(isDocumented())); } void testGlobalScopeCompletion(clangd::CodeCompleteOptions Opts) { @@ -334,14 +334,14 @@ void testGlobalScopeCompletion(clangd::CodeCompleteOptions Opts) { struct GlobalClass {}; struct ClassWithMembers { - /// Doc for method. + /// doc for method. int method(); }; int test() { struct LocalClass {}; - /// Doc for local_var. + /// doc for local_var. int local_var; ^ @@ -352,20 +352,20 @@ void testGlobalScopeCompletion(clangd::CodeCompleteOptions Opts) { EXPECT_TRUE(Results.RanParser); // Class members. Should never be present in global completions. EXPECT_THAT(Results.Completions, - Not(AnyOf(Has("method"), Has("method()"), Has("field")))); + Not(AnyOf(has("method"), has("method()"), has("field")))); // Global items. EXPECT_THAT(Results.Completions, - AllOf(Has("global_var"), Has("index_var"), Has("global_func"), - Has("index_func" /* our fake symbol doesn't include () */), - Has("GlobalClass"), Has("IndexClass"))); + AllOf(has("global_var"), has("index_var"), has("global_func"), + has("index_func" /* our fake symbol doesn't include () */), + has("GlobalClass"), has("IndexClass"))); // A macro. - EXPECT_THAT(Results.Completions, Has("MACRO")); + EXPECT_THAT(Results.Completions, has("MACRO")); // Local items. Must be present always. EXPECT_THAT(Results.Completions, - AllOf(Has("local_var"), Has("LocalClass"), - Contains(Kind(CompletionItemKind::Snippet)))); + AllOf(has("local_var"), has("LocalClass"), + Contains(kind(CompletionItemKind::Snippet)))); // Check documentation. - EXPECT_THAT(Results.Completions, Contains(IsDocumented())); + EXPECT_THAT(Results.Completions, Contains(isDocumented())); } TEST(CompletionTest, CompletionOptions) { @@ -397,7 +397,7 @@ TEST(CompletionTest, Accessible) { void Foo::pub() { this->^ } )cpp"); EXPECT_THAT(Internal.Completions, - AllOf(Has("priv"), Has("prot"), Has("pub"))); + AllOf(has("priv"), has("prot"), has("pub"))); auto External = completions(R"cpp( class Foo { @@ -411,7 +411,7 @@ TEST(CompletionTest, Accessible) { } )cpp"); EXPECT_THAT(External.Completions, - AllOf(Has("pub"), Not(Has("prot")), Not(Has("priv")))); + AllOf(has("pub"), Not(has("prot")), Not(has("priv")))); } TEST(CompletionTest, Qualifiers) { @@ -426,40 +426,40 @@ TEST(CompletionTest, Qualifiers) { void test() { Bar().^ } )cpp"); EXPECT_THAT(Results.Completions, - Contains(AllOf(Qualifier(""), Named("bar")))); + Contains(AllOf(qualifier(""), named("bar")))); // Hidden members are not shown. EXPECT_THAT(Results.Completions, - Not(Contains(AllOf(Qualifier("Foo::"), Named("foo"))))); + Not(Contains(AllOf(qualifier("Foo::"), named("foo"))))); // Private members are not shown. EXPECT_THAT(Results.Completions, - Not(Contains(AllOf(Qualifier(""), Named("foo"))))); + Not(Contains(AllOf(qualifier(""), named("foo"))))); } TEST(CompletionTest, InjectedTypename) { // These are suppressed when accessed as a member... EXPECT_THAT(completions("struct X{}; void foo(){ X().^ }").Completions, - Not(Has("X"))); + Not(has("X"))); EXPECT_THAT(completions("struct X{ void foo(){ this->^ } };").Completions, - Not(Has("X"))); + Not(has("X"))); // ...but accessible in other, more useful cases. EXPECT_THAT(completions("struct X{ void foo(){ ^ } };").Completions, - Has("X")); + has("X")); EXPECT_THAT( completions("struct Y{}; struct X:Y{ void foo(){ ^ } };").Completions, - Has("Y")); + has("Y")); EXPECT_THAT( completions( "template struct Y{}; struct X:Y{ void foo(){ ^ } };") .Completions, - Has("Y")); + has("Y")); // This case is marginal (`using X::X` is useful), we allow it for now. EXPECT_THAT(completions("struct X{}; void foo(){ X::^ }").Completions, - Has("X")); + has("X")); } TEST(CompletionTest, SkipInjectedWhenUnqualified) { EXPECT_THAT(completions("struct X { void f() { X^ }};").Completions, - ElementsAre(Named("X"), Named("~X"))); + ElementsAre(named("X"), named("~X"))); } TEST(CompletionTest, Snippets) { @@ -478,8 +478,8 @@ TEST(CompletionTest, Snippets) { /*IndexSymbols=*/{}, Opts); EXPECT_THAT( Results.Completions, - HasSubsequence(Named("a"), - SnippetSuffix("(${1:int i}, ${2:const float f})"))); + HasSubsequence(named("a"), + snippetSuffix("(${1:int i}, ${2:const float f})"))); } TEST(CompletionTest, NoSnippetsInUsings) { @@ -495,8 +495,8 @@ TEST(CompletionTest, NoSnippetsInUsings) { )cpp", /*IndexSymbols=*/{}, Opts); EXPECT_THAT(Results.Completions, - ElementsAre(AllOf(Named("func"), Labeled("func(int a, int b)"), - SnippetSuffix("")))); + ElementsAre(AllOf(named("func"), labeled("func(int a, int b)"), + snippetSuffix("")))); // Check index completions too. auto Func = func("ns::func"); @@ -510,8 +510,8 @@ TEST(CompletionTest, NoSnippetsInUsings) { )cpp", /*IndexSymbols=*/{Func}, Opts); EXPECT_THAT(Results.Completions, - ElementsAre(AllOf(Named("func"), Labeled("func(int a, int b)"), - SnippetSuffix("")))); + ElementsAre(AllOf(named("func"), labeled("func(int a, int b)"), + snippetSuffix("")))); // Check all-scopes completions too. Opts.AllScopes = true; @@ -520,8 +520,8 @@ TEST(CompletionTest, NoSnippetsInUsings) { )cpp", /*IndexSymbols=*/{Func}, Opts); EXPECT_THAT(Results.Completions, - Contains(AllOf(Named("func"), Labeled("ns::func(int a, int b)"), - SnippetSuffix("")))); + Contains(AllOf(named("func"), labeled("ns::func(int a, int b)"), + snippetSuffix("")))); } TEST(CompletionTest, Kinds) { @@ -536,18 +536,18 @@ TEST(CompletionTest, Kinds) { )cpp", {func("indexFunction"), var("indexVariable"), cls("indexClass")}); EXPECT_THAT(Results.Completions, - AllOf(Has("function", CompletionItemKind::Function), - Has("variable", CompletionItemKind::Variable), - Has("int", CompletionItemKind::Keyword), - Has("Struct", CompletionItemKind::Struct), - Has("MACRO", CompletionItemKind::Text), - Has("indexFunction", CompletionItemKind::Function), - Has("indexVariable", CompletionItemKind::Variable), - Has("indexClass", CompletionItemKind::Class))); + AllOf(has("function", CompletionItemKind::Function), + has("variable", CompletionItemKind::Variable), + has("int", CompletionItemKind::Keyword), + has("Struct", CompletionItemKind::Struct), + has("MACRO", CompletionItemKind::Text), + has("indexFunction", CompletionItemKind::Function), + has("indexVariable", CompletionItemKind::Variable), + has("indexClass", CompletionItemKind::Class))); Results = completions("nam^"); EXPECT_THAT(Results.Completions, - Has("namespace", CompletionItemKind::Snippet)); + has("namespace", CompletionItemKind::Snippet)); // Members of anonymous unions are of kind 'field'. Results = completions( @@ -561,7 +561,7 @@ TEST(CompletionTest, Kinds) { )cpp"); EXPECT_THAT( Results.Completions, - UnorderedElementsAre(AllOf(Named("a"), Kind(CompletionItemKind::Field)))); + UnorderedElementsAre(AllOf(named("a"), kind(CompletionItemKind::Field)))); // Completion kinds for templates should not be unknown. Results = completions( @@ -580,13 +580,13 @@ TEST(CompletionTest, Kinds) { EXPECT_THAT( Results.Completions, UnorderedElementsAre( - AllOf(Named("complete_class"), Kind(CompletionItemKind::Class)), - AllOf(Named("complete_function"), Kind(CompletionItemKind::Function)), - AllOf(Named("complete_type_alias"), - Kind(CompletionItemKind::Interface)), - AllOf(Named("complete_variable"), Kind(CompletionItemKind::Variable)), - AllOf(Named("complete_static_member"), - Kind(CompletionItemKind::Property)))); + AllOf(named("complete_class"), kind(CompletionItemKind::Class)), + AllOf(named("complete_function"), kind(CompletionItemKind::Function)), + AllOf(named("complete_type_alias"), + kind(CompletionItemKind::Interface)), + AllOf(named("complete_variable"), kind(CompletionItemKind::Variable)), + AllOf(named("complete_static_member"), + kind(CompletionItemKind::Property)))); Results = completions( R"cpp( @@ -597,7 +597,7 @@ TEST(CompletionTest, Kinds) { )cpp"); EXPECT_THAT( Results.Completions, - Contains(AllOf(Named("Red"), Kind(CompletionItemKind::EnumMember)))); + Contains(AllOf(named("Red"), kind(CompletionItemKind::EnumMember)))); } TEST(CompletionTest, NoDuplicates) { @@ -613,7 +613,7 @@ TEST(CompletionTest, NoDuplicates) { {cls("Adapter")}); // Make sure there are no duplicate entries of 'Adapter'. - EXPECT_THAT(Results.Completions, ElementsAre(Named("Adapter"))); + EXPECT_THAT(Results.Completions, ElementsAre(named("Adapter"))); } TEST(CompletionTest, ScopedNoIndex) { @@ -624,7 +624,7 @@ TEST(CompletionTest, ScopedNoIndex) { ")cpp"); // Babble is a better match than BigBang. Box doesn't match at all. EXPECT_THAT(Results.Completions, - ElementsAre(Named("Babble"), Named("BigBang"))); + ElementsAre(named("Babble"), named("BigBang"))); } TEST(CompletionTest, Scoped) { @@ -635,7 +635,7 @@ TEST(CompletionTest, Scoped) { ")cpp", {var("fake::BigBang")}); EXPECT_THAT(Results.Completions, - ElementsAre(Named("Babble"), Named("BigBang"))); + ElementsAre(named("Babble"), named("BigBang"))); } TEST(CompletionTest, ScopedWithFilter) { @@ -644,17 +644,17 @@ TEST(CompletionTest, ScopedWithFilter) { void f() { ns::x^ } )cpp", {cls("ns::XYZ"), func("ns::foo")}); - EXPECT_THAT(Results.Completions, UnorderedElementsAre(Named("XYZ"))); + EXPECT_THAT(Results.Completions, UnorderedElementsAre(named("XYZ"))); } TEST(CompletionTest, ReferencesAffectRanking) { EXPECT_THAT(completions("int main() { abs^ }", {func("absA"), func("absB")}) .Completions, - HasSubsequence(Named("absA"), Named("absB"))); + HasSubsequence(named("absA"), named("absB"))); EXPECT_THAT(completions("int main() { abs^ }", {func("absA"), withReferences(1000, func("absB"))}) .Completions, - HasSubsequence(Named("absB"), Named("absA"))); + HasSubsequence(named("absB"), named("absA"))); } TEST(CompletionTest, ContextWords) { @@ -669,7 +669,7 @@ TEST(CompletionTest, ContextWords) { // Yellow would normally sort last (alphabetic). // But the recent mention should bump it up. ASSERT_THAT(Results.Completions, - HasSubsequence(Named("YELLOW"), Named("BLUE"))); + HasSubsequence(named("YELLOW"), named("BLUE"))); } TEST(CompletionTest, GlobalQualified) { @@ -679,8 +679,8 @@ TEST(CompletionTest, GlobalQualified) { )cpp", {cls("XYZ")}); EXPECT_THAT(Results.Completions, - AllOf(Has("XYZ", CompletionItemKind::Class), - Has("f", CompletionItemKind::Function))); + AllOf(has("XYZ", CompletionItemKind::Class), + has("f", CompletionItemKind::Function))); } TEST(CompletionTest, FullyQualified) { @@ -691,8 +691,8 @@ TEST(CompletionTest, FullyQualified) { )cpp", {cls("ns::XYZ")}); EXPECT_THAT(Results.Completions, - AllOf(Has("XYZ", CompletionItemKind::Class), - Has("bar", CompletionItemKind::Function))); + AllOf(has("XYZ", CompletionItemKind::Class), + has("bar", CompletionItemKind::Function))); } TEST(CompletionTest, SemaIndexMerge) { @@ -705,10 +705,10 @@ TEST(CompletionTest, SemaIndexMerge) { // We get results from both index and sema, with no duplicates. EXPECT_THAT(Results.Completions, UnorderedElementsAre( - AllOf(Named("local"), Origin(SymbolOrigin::AST)), - AllOf(Named("Index"), Origin(SymbolOrigin::Static)), - AllOf(Named("both"), - Origin(SymbolOrigin::AST | SymbolOrigin::Static)))); + AllOf(named("local"), origin(SymbolOrigin::AST)), + AllOf(named("Index"), origin(SymbolOrigin::Static)), + AllOf(named("both"), + origin(SymbolOrigin::AST | SymbolOrigin::Static)))); } TEST(CompletionTest, SemaIndexMergeWithLimit) { @@ -738,13 +738,13 @@ TEST(CompletionTest, IncludeInsertionPreprocessorIntegrationTests) { TU.Code = Test.code().str(); auto Results = completions(TU, Test.point(), {Sym}); EXPECT_THAT(Results.Completions, - ElementsAre(AllOf(Named("X"), InsertInclude("\"bar.h\"")))); + ElementsAre(AllOf(named("X"), insertInclude("\"bar.h\"")))); // Can be disabled via option. CodeCompleteOptions NoInsertion; NoInsertion.InsertIncludes = CodeCompleteOptions::NeverInsert; Results = completions(TU, Test.point(), {Sym}, NoInsertion); EXPECT_THAT(Results.Completions, - ElementsAre(AllOf(Named("X"), Not(InsertInclude())))); + ElementsAre(AllOf(named("X"), Not(insertInclude())))); // Duplicate based on inclusions in preamble. Test = Annotations(R"cpp( #include "sub/bar.h" // not shortest, so should only match resolved. @@ -752,8 +752,8 @@ TEST(CompletionTest, IncludeInsertionPreprocessorIntegrationTests) { )cpp"); TU.Code = Test.code().str(); Results = completions(TU, Test.point(), {Sym}); - EXPECT_THAT(Results.Completions, ElementsAre(AllOf(Named("X"), Labeled("X"), - Not(InsertInclude())))); + EXPECT_THAT(Results.Completions, ElementsAre(AllOf(named("X"), labeled("X"), + Not(insertInclude())))); } TEST(CompletionTest, NoIncludeInsertionWhenDeclFoundInFile) { @@ -775,8 +775,8 @@ TEST(CompletionTest, NoIncludeInsertionWhenDeclFoundInFile) { )cpp", {SymX, SymY}); EXPECT_THAT(Results.Completions, - ElementsAre(AllOf(Named("X"), Not(InsertInclude())), - AllOf(Named("Y"), Not(InsertInclude())))); + ElementsAre(AllOf(named("X"), Not(insertInclude())), + AllOf(named("Y"), Not(insertInclude())))); } TEST(CompletionTest, IndexSuppressesPreambleCompletions) { @@ -795,14 +795,14 @@ TEST(CompletionTest, IndexSuppressesPreambleCompletions) { Opts.Index = I.get(); auto WithIndex = completions(TU, Test.point(), {}, Opts); EXPECT_THAT(WithIndex.Completions, - UnorderedElementsAre(Named("local"), Named("index"))); + UnorderedElementsAre(named("local"), named("index"))); auto ClassFromPreamble = completions(TU, Test.point("2"), {}, Opts); - EXPECT_THAT(ClassFromPreamble.Completions, Contains(Named("member"))); + EXPECT_THAT(ClassFromPreamble.Completions, Contains(named("member"))); Opts.Index = nullptr; auto WithoutIndex = completions(TU, Test.point(), {}, Opts); EXPECT_THAT(WithoutIndex.Completions, - UnorderedElementsAre(Named("local"), Named("preamble"))); + UnorderedElementsAre(named("local"), named("preamble"))); } // This verifies that we get normal preprocessor completions in the preamble. @@ -818,7 +818,7 @@ TEST(CompletionTest, CompletionInPreamble) { #endif )cpp") .Completions; - EXPECT_THAT(Results, ElementsAre(Named("ifndef"))); + EXPECT_THAT(Results, ElementsAre(named("ifndef"))); } TEST(CompletionTest, CompletionRecoveryASTType) { @@ -830,7 +830,7 @@ TEST(CompletionTest, CompletionRecoveryASTType) { overloaded().^ })cpp") .Completions; - EXPECT_THAT(Results, ElementsAre(Named("member"))); + EXPECT_THAT(Results, ElementsAre(named("member"))); } TEST(CompletionTest, DynamicIndexIncludeInsertion) { @@ -864,8 +864,8 @@ TEST(CompletionTest, DynamicIndexIncludeInsertion) { llvm::cantFail(runCodeComplete(Server, File, Test.point(), {})); EXPECT_THAT(CompletionList.Completions, - ElementsAre(AllOf(Named("Foo"), HasInclude("\"foo_header.h\""), - InsertInclude()))); + ElementsAre(AllOf(named("Foo"), hasInclude("\"foo_header.h\""), + insertInclude()))); } TEST(CompletionTest, DynamicIndexMultiFile) { @@ -896,12 +896,12 @@ TEST(CompletionTest, DynamicIndexMultiFile) { auto Results = cantFail(runCodeComplete(Server, File, Test.point(), {})); // "XYZ" and "foo" are not included in the file being completed but are still // visible through the index. - EXPECT_THAT(Results.Completions, Has("XYZ", CompletionItemKind::Class)); - EXPECT_THAT(Results.Completions, Has("foo", CompletionItemKind::Function)); - EXPECT_THAT(Results.Completions, Has("XXX", CompletionItemKind::Class)); + EXPECT_THAT(Results.Completions, has("XYZ", CompletionItemKind::Class)); + EXPECT_THAT(Results.Completions, has("foo", CompletionItemKind::Function)); + EXPECT_THAT(Results.Completions, has("XXX", CompletionItemKind::Class)); EXPECT_THAT(Results.Completions, - Contains((Named("fooooo"), Kind(CompletionItemKind::Function), - Doc("Doooc"), ReturnType("void")))); + Contains((named("fooooo"), kind(CompletionItemKind::Function), + doc("Doooc"), returnType("void")))); } TEST(CompletionTest, Documentation) { @@ -920,13 +920,14 @@ TEST(CompletionTest, Documentation) { int x = ^ )cpp"); EXPECT_THAT(Results.Completions, - Contains(AllOf(Named("foo"), - Doc("Annotation: custom_annotation\nNon-doxygen comment.")))); + Contains(AllOf( + named("foo"), + doc("Annotation: custom_annotation\nNon-doxygen comment.")))); EXPECT_THAT( Results.Completions, - Contains(AllOf(Named("bar"), Doc("Doxygen comment.\n\\param int a")))); + Contains(AllOf(named("bar"), doc("Doxygen comment.\n\\param int a")))); EXPECT_THAT(Results.Completions, - Contains(AllOf(Named("baz"), Doc("Multi-line block comment")))); + Contains(AllOf(named("baz"), doc("Multi-line block comment")))); } TEST(CompletionTest, CommentsFromSystemHeaders) { @@ -956,7 +957,7 @@ int x = foo^ EXPECT_THAT( CompletionList.Completions, - Contains(AllOf(Named("foo"), Doc("This comment should be retained!")))); + Contains(AllOf(named("foo"), doc("This comment should be retained!")))); } TEST(CompletionTest, GlobalCompletionFiltering) { @@ -991,8 +992,8 @@ TEST(CodeCompleteTest, NoColonColonAtTheEnd) { } )cpp"); - EXPECT_THAT(Results.Completions, Contains(Labeled("clang"))); - EXPECT_THAT(Results.Completions, Not(Contains(Labeled("clang::")))); + EXPECT_THAT(Results.Completions, Contains(labeled("clang"))); + EXPECT_THAT(Results.Completions, Not(Contains(labeled("clang::")))); } TEST(CompletionTest, BacktrackCrashes) { @@ -1005,7 +1006,7 @@ TEST(CompletionTest, BacktrackCrashes) { int foo(ns::FooBar^ )cpp"); - EXPECT_THAT(Results.Completions, ElementsAre(Labeled("FooBarBaz"))); + EXPECT_THAT(Results.Completions, ElementsAre(labeled("FooBarBaz"))); // Check we don't crash in that case too. completions(R"cpp( @@ -1032,7 +1033,7 @@ int f(int input_num) { )cpp"); EXPECT_THAT(Results.Completions, - UnorderedElementsAre(Named("X"), Named("Y"))); + UnorderedElementsAre(named("X"), named("Y"))); } TEST(CompletionTest, CompleteInMacroAndNamespaceWithStringification) { @@ -1049,7 +1050,7 @@ int f(int input_num) { } // namespace ns )cpp"); - EXPECT_THAT(Results.Completions, Contains(Named("X"))); + EXPECT_THAT(Results.Completions, Contains(named("X"))); } TEST(CompletionTest, IgnoreCompleteInExcludedPPBranchWithRecoveryContext) { @@ -1080,14 +1081,14 @@ TEST(CompletionTest, DefaultArgs) { int Z(int A, int B = 0, int C = 0, int D = 0); )cpp"; EXPECT_THAT(completions(Context + "int y = X^", {}, Opts).Completions, - UnorderedElementsAre(Labeled("X(int A = 0)"))); + UnorderedElementsAre(labeled("X(int A = 0)"))); EXPECT_THAT(completions(Context + "int y = Y^", {}, Opts).Completions, - UnorderedElementsAre(AllOf(Labeled("Y(int A, int B = 0)"), - SnippetSuffix("(${1:int A})")))); + UnorderedElementsAre(AllOf(labeled("Y(int A, int B = 0)"), + snippetSuffix("(${1:int A})")))); EXPECT_THAT(completions(Context + "int y = Z^", {}, Opts).Completions, UnorderedElementsAre( - AllOf(Labeled("Z(int A, int B = 0, int C = 0, int D = 0)"), - SnippetSuffix("(${1:int A})")))); + AllOf(labeled("Z(int A, int B = 0, int C = 0, int D = 0)"), + snippetSuffix("(${1:int A})")))); } TEST(CompletionTest, NoCrashWithTemplateParamsAndPreferredTypes) { @@ -1097,7 +1098,7 @@ template