[clang-tools-extra] 60adfb8 - [clangd] Fix windows buildbots

Kadir Cetinkaya via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 15 07:25:33 PST 2020


Author: Kadir Cetinkaya
Date: 2020-01-15T16:22:36+01:00
New Revision: 60adfb83cda883d9fc1079c89d2feaa681a41b90

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

LOG: [clangd] Fix windows buildbots

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clangd/unittests/HoverTests.cpp b/clang-tools-extra/clangd/unittests/HoverTests.cpp
index 0898b311c6de..d30c9bfb90ff 100644
--- a/clang-tools-extra/clangd/unittests/HoverTests.cpp
+++ b/clang-tools-extra/clangd/unittests/HoverTests.cpp
@@ -1514,26 +1514,6 @@ TEST(Hover, All) {
             HI.Name = "cls<cls<cls<int> > >";
             HI.Documentation = "type of nested templates.";
           }},
-      {
-          R"cpp(// sizeof expr
-          void foo() {
-            (void)[[size^of]](char);
-          })cpp",
-          [](HoverInfo &HI) {
-            HI.Name = "expression";
-            HI.Type = "unsigned long";
-            HI.Value = "1";
-          }},
-      {
-          R"cpp(// alignof expr
-          void foo() {
-            (void)[[align^of]](char);
-          })cpp",
-          [](HoverInfo &HI) {
-            HI.Name = "expression";
-            HI.Type = "unsigned long";
-            HI.Value = "1";
-          }},
   };
 
   // Create a tiny index, so tests above can verify documentation is fetched.
@@ -1794,6 +1774,49 @@ Value = val
 
 def)pt");
 }
+
+TEST(Hover, ExprTests) {
+  struct {
+    const char *const Code;
+    const std::function<void(HoverInfo &)> ExpectedBuilder;
+  } Cases[] = {
+      {
+          R"cpp(// sizeof expr
+          void foo() {
+            (void)[[size^of]](char);
+          })cpp",
+          [](HoverInfo &HI) {
+            HI.Name = "expression";
+            HI.Type = "unsigned long";
+            HI.Value = "1";
+          }},
+      {
+          R"cpp(// alignof expr
+          void foo() {
+            (void)[[align^of]](char);
+          })cpp",
+          [](HoverInfo &HI) {
+            HI.Name = "expression";
+            HI.Type = "unsigned long";
+            HI.Value = "1";
+          }},
+  };
+  for (const auto &C : Cases) {
+    Annotations T(C.Code);
+    TestTU TU = TestTU::withCode(T.code());
+    auto AST = TU.build();
+    for (const auto &D : AST.getDiagnostics())
+      ADD_FAILURE() << D;
+
+    auto H = getHover(AST, T.point(), format::getLLVMStyle(), nullptr);
+    ASSERT_TRUE(H);
+    HoverInfo ExpectedHover;
+    C.ExpectedBuilder(ExpectedHover);
+    // We don't check for Type as it might 
diff er on 
diff erent platforms.
+    EXPECT_EQ(H->Name, ExpectedHover.Name);
+    EXPECT_EQ(H->Value, ExpectedHover.Value);
+  }
+}
 } // namespace
 } // namespace clangd
 } // namespace clang


        


More information about the cfe-commits mailing list