Revert "[clangd] testPath's final result agrees with the passed in Style"
authorKadir Cetinkaya <kadircet@google.com>
Mon, 23 Nov 2020 12:12:35 +0000 (13:12 +0100)
committerKadir Cetinkaya <kadircet@google.com>
Mon, 23 Nov 2020 12:12:59 +0000 (13:12 +0100)
This reverts commit 8cec8de2a4e6692da6226bb02cf417eb0e50adde as it
breaks windows buildbots.

clang-tools-extra/clangd/unittests/ConfigCompileTests.cpp
clang-tools-extra/clangd/unittests/TestFS.cpp

index 2b4605eb97e2658a6e08f82f09f7497083fd8991..a2423094b17a919907fa805c362be1ae090124aa 100644 (file)
@@ -255,6 +255,7 @@ TEST_F(ConfigCompileTests, ExternalBlockMountPoint) {
   };
 
   auto BarPath = testPath("foo/bar.h", llvm::sys::path::Style::posix);
+  BarPath = llvm::sys::path::convert_to_slash(BarPath);
   Parm.Path = BarPath;
   // Non-absolute MountPoint without a directory raises an error.
   Frag = GetFrag("", "foo");
@@ -268,6 +269,7 @@ TEST_F(ConfigCompileTests, ExternalBlockMountPoint) {
   ASSERT_FALSE(Conf.Index.External);
 
   auto FooPath = testPath("foo/", llvm::sys::path::Style::posix);
+  FooPath = llvm::sys::path::convert_to_slash(FooPath);
   // Ok when relative.
   Frag = GetFrag(testRoot(), "foo/");
   compileAndApply();
@@ -291,6 +293,7 @@ TEST_F(ConfigCompileTests, ExternalBlockMountPoint) {
 
   // File outside MountPoint, no index.
   auto BazPath = testPath("bar/baz.h", llvm::sys::path::Style::posix);
+  BazPath = llvm::sys::path::convert_to_slash(BazPath);
   Parm.Path = BazPath;
   Frag = GetFrag("", FooPath.c_str());
   compileAndApply();
@@ -299,6 +302,7 @@ TEST_F(ConfigCompileTests, ExternalBlockMountPoint) {
 
   // File under MountPoint, index should be set.
   BazPath = testPath("foo/baz.h", llvm::sys::path::Style::posix);
+  BazPath = llvm::sys::path::convert_to_slash(BazPath);
   Parm.Path = BazPath;
   Frag = GetFrag("", FooPath.c_str());
   compileAndApply();
index f343a85331d04ebac6422f1b0e5ed52d305feb6b..ba4010cb45817d2397a037cdcf3c6b223debfc73 100644 (file)
@@ -80,10 +80,12 @@ const char *testRoot() {
 }
 
 std::string testPath(PathRef File, llvm::sys::path::Style Style) {
-  assert(llvm::sys::path::is_relative(File, Style));
+  assert(llvm::sys::path::is_relative(File) && "FileName should be relative");
+
+  llvm::SmallString<32> NativeFile = File;
+  llvm::sys::path::native(NativeFile, Style);
   llvm::SmallString<32> Path;
-  llvm::sys::path::append(Path, testRoot(), File);
-  llvm::sys::path::native(Path, Style);
+  llvm::sys::path::append(Path, Style, testRoot(), NativeFile);
   return std::string(Path.str());
 }