[clang-tools-extra] ed913a2 - [clangd] Fix case of variables and functions in code complete tests. NFC

Ilya Biryukov via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 24 06:49:55 PDT 2019


Author: Ilya Biryukov
Date: 2019-10-24T15:41:50+02:00
New Revision: ed913a291532968c188909e932a94c5cc7b416be

URL: https://github.com/llvm/llvm-project/commit/ed913a291532968c188909e932a94c5cc7b416be
DIFF: https://github.com/llvm/llvm-project/commit/ed913a291532968c188909e932a94c5cc7b416be.diff

LOG: [clangd] Fix case of variables and functions in code complete tests. NFC

Added: 
    

Modified: 
    clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp b/clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
index 73bb1f97bda2..74d37df795a7 100644
--- a/clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
+++ b/clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
@@ -97,7 +97,7 @@ std::unique_ptr<SymbolIndex> memIndex(std::vector<Symbol> Symbols) {
 }
 
 CodeCompleteResult completions(ClangdServer &Server, llvm::StringRef TestCode,
-                               Position point,
+                               Position Point,
                                std::vector<Symbol> IndexSymbols = {},
                                clangd::CodeCompleteOptions Opts = {}) {
   std::unique_ptr<SymbolIndex> OverrideIndex;
@@ -110,7 +110,7 @@ CodeCompleteResult completions(ClangdServer &Server, llvm::StringRef TestCode,
   auto File = testPath("foo.cpp");
   runAddDocument(Server, File, TestCode);
   auto CompletionList =
-      llvm::cantFail(runCodeComplete(Server, File, point, Opts));
+      llvm::cantFail(runCodeComplete(Server, File, Point, Opts));
   return CompletionList;
 }
 
@@ -209,7 +209,7 @@ TEST(CompletionTest, Filter) {
               AllOf(Has("Car"), Not(Has("MotorCar"))));
 }
 
-void TestAfterDotCompletion(clangd::CodeCompleteOptions Opts) {
+void testAfterDotCompletion(clangd::CodeCompleteOptions Opts) {
   auto Results = completions(
       R"cpp(
       int global_var;
@@ -264,7 +264,7 @@ void TestAfterDotCompletion(clangd::CodeCompleteOptions Opts) {
              Contains(IsDocumented()));
 }
 
-void TestGlobalScopeCompletion(clangd::CodeCompleteOptions Opts) {
+void testGlobalScopeCompletion(clangd::CodeCompleteOptions Opts) {
   auto Results = completions(
       R"cpp(
       int global_var;
@@ -313,8 +313,8 @@ void TestGlobalScopeCompletion(clangd::CodeCompleteOptions Opts) {
 
 TEST(CompletionTest, CompletionOptions) {
   auto Test = [&](const clangd::CodeCompleteOptions &Opts) {
-    TestAfterDotCompletion(Opts);
-    TestGlobalScopeCompletion(Opts);
+    testAfterDotCompletion(Opts);
+    testGlobalScopeCompletion(Opts);
   };
   // We used to test every combination of options, but that got too slow (2^N).
   auto Flags = {
@@ -2131,12 +2131,12 @@ TEST(CompletionTest, EnableSpeculativeIndexRequest) {
 
 TEST(CompletionTest, InsertTheMostPopularHeader) {
   std::string DeclFile = URI::create(testPath("foo")).toString();
-  Symbol sym = func("Func");
-  sym.CanonicalDeclaration.FileURI = DeclFile.c_str();
-  sym.IncludeHeaders.emplace_back("\"foo.h\"", 2);
-  sym.IncludeHeaders.emplace_back("\"bar.h\"", 1000);
+  Symbol Sym = func("Func");
+  Sym.CanonicalDeclaration.FileURI = DeclFile.c_str();
+  Sym.IncludeHeaders.emplace_back("\"foo.h\"", 2);
+  Sym.IncludeHeaders.emplace_back("\"bar.h\"", 1000);
 
-  auto Results = completions("Fun^", {sym}).Completions;
+  auto Results = completions("Fun^", {Sym}).Completions;
   assert(!Results.empty());
   EXPECT_THAT(Results[0], AllOf(Named("Func"), InsertInclude("\"bar.h\"")));
   EXPECT_EQ(Results[0].Includes.size(), 2u);
@@ -2153,13 +2153,13 @@ TEST(CompletionTest, NoInsertIncludeIfOnePresent) {
   ClangdServer Server(CDB, FS, DiagConsumer, ClangdServer::optsForTest());
 
   std::string DeclFile = URI::create(testPath("foo")).toString();
-  Symbol sym = func("Func");
-  sym.CanonicalDeclaration.FileURI = DeclFile.c_str();
-  sym.IncludeHeaders.emplace_back("\"foo.h\"", 2);
-  sym.IncludeHeaders.emplace_back("\"bar.h\"", 1000);
+  Symbol Sym = func("Func");
+  Sym.CanonicalDeclaration.FileURI = DeclFile.c_str();
+  Sym.IncludeHeaders.emplace_back("\"foo.h\"", 2);
+  Sym.IncludeHeaders.emplace_back("\"bar.h\"", 1000);
 
   EXPECT_THAT(
-      completions(Server, "#include \"foo.h\"\nFun^", {sym}).Completions,
+      completions(Server, "#include \"foo.h\"\nFun^", {Sym}).Completions,
       UnorderedElementsAre(
           AllOf(Named("Func"), HasInclude("\"foo.h\""), Not(InsertInclude()))));
 }


        


More information about the cfe-commits mailing list