[clang-tools-extra] r359079 - [clangd] Fix handling of include paths in windows tests

Kadir Cetinkaya via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 24 02:42:54 PDT 2019


Author: kadircet
Date: Wed Apr 24 02:42:53 2019
New Revision: 359079

URL: http://llvm.org/viewvc/llvm-project?rev=359079&view=rev
Log:
[clangd] Fix handling of include paths in windows tests

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

Modified: clang-tools-extra/trunk/unittests/clangd/CodeCompleteTests.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/clangd/CodeCompleteTests.cpp?rev=359079&r1=359078&r2=359079&view=diff
==============================================================================
--- clang-tools-extra/trunk/unittests/clangd/CodeCompleteTests.cpp (original)
+++ clang-tools-extra/trunk/unittests/clangd/CodeCompleteTests.cpp Wed Apr 24 02:42:53 2019
@@ -22,6 +22,7 @@
 #include "clang/Sema/CodeCompleteConsumer.h"
 #include "clang/Tooling/CompilationDatabase.h"
 #include "llvm/Support/Error.h"
+#include "llvm/Support/Path.h"
 #include "llvm/Testing/Support/Error.h"
 #include "gmock/gmock.h"
 #include "gtest/gtest.h"
@@ -699,11 +700,13 @@ TEST(CompletionTest, DynamicIndexInclude
   Server.addDocument(testPath("foo_impl.cpp"), FileContent);
   // Wait for the dynamic index being built.
   ASSERT_TRUE(Server.blockUntilIdleForTest());
-  EXPECT_THAT(
-      completions(Server, "Foo^ foo;").Completions,
-      ElementsAre(AllOf(Named("Foo"),
-                        HasInclude('"' + testPath("foo_header.h") + '"'),
-                        InsertInclude())));
+  EXPECT_THAT(completions(Server, "Foo^ foo;").Completions,
+              ElementsAre(AllOf(Named("Foo"),
+                                HasInclude('"' +
+                                           llvm::sys::path::convert_to_slash(
+                                               testPath("foo_header.h")) +
+                                           '"'),
+                                InsertInclude())));
 }
 
 TEST(CompletionTest, DynamicIndexMultiFile) {

Modified: clang-tools-extra/trunk/unittests/clangd/HeadersTests.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/clangd/HeadersTests.cpp?rev=359079&r1=359078&r2=359079&view=diff
==============================================================================
--- clang-tools-extra/trunk/unittests/clangd/HeadersTests.cpp (original)
+++ clang-tools-extra/trunk/unittests/clangd/HeadersTests.cpp Wed Apr 24 02:42:53 2019
@@ -15,6 +15,7 @@
 #include "clang/Frontend/CompilerInvocation.h"
 #include "clang/Frontend/FrontendActions.h"
 #include "clang/Lex/PreprocessorOptions.h"
+#include "llvm/Support/Path.h"
 #include "gmock/gmock.h"
 #include "gtest/gtest.h"
 
@@ -221,7 +222,8 @@ TEST_F(HeadersTest, ShortenedInclude) {
 }
 
 TEST_F(HeadersTest, NotShortenedInclude) {
-  std::string BarHeader = testPath("sub-2/bar.h");
+  std::string BarHeader =
+      llvm::sys::path::convert_to_slash(testPath("sub-2/bar.h"));
   EXPECT_EQ(calculate(BarHeader, ""), "\"" + BarHeader + "\"");
 }
 
@@ -265,8 +267,7 @@ TEST(Headers, NoHeaderSearchInfo) {
   auto Inserting = HeaderFile{HeaderPath, /*Verbatim=*/false};
   auto Verbatim = HeaderFile{"<x>", /*Verbatim=*/true};
 
-  EXPECT_EQ(Inserter.calculateIncludePath(Inserting),
-            "\"" + HeaderPath + "\"");
+  EXPECT_EQ(Inserter.calculateIncludePath(Inserting), "\"" + HeaderPath + "\"");
   EXPECT_EQ(Inserter.shouldInsertInclude(HeaderPath, Inserting), false);
 
   EXPECT_EQ(Inserter.calculateIncludePath(Verbatim), "<x>");




More information about the cfe-commits mailing list