r257286 - Make test work on windows by turning \ in paths back into /.

Benjamin Kramer via cfe-commits cfe-commits at lists.llvm.org
Sun Jan 10 02:36:59 PST 2016


Author: d0k
Date: Sun Jan 10 04:36:59 2016
New Revision: 257286

URL: http://llvm.org/viewvc/llvm-project?rev=257286&view=rev
Log:
Make test work on windows by turning \ in paths back into /.

Modified:
    cfe/trunk/unittests/Basic/VirtualFileSystemTest.cpp

Modified: cfe/trunk/unittests/Basic/VirtualFileSystemTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Basic/VirtualFileSystemTest.cpp?rev=257286&r1=257285&r2=257286&view=diff
==============================================================================
--- cfe/trunk/unittests/Basic/VirtualFileSystemTest.cpp (original)
+++ cfe/trunk/unittests/Basic/VirtualFileSystemTest.cpp Sun Jan 10 04:36:59 2016
@@ -658,11 +658,17 @@ TEST_F(InMemoryFileSystemTest, WorkingDi
   Stat = FS.status("c");
   ASSERT_FALSE(Stat.getError()) << Stat.getError() << "\n" << FS.toString();
 
+  auto ReplaceBackslashes = [](std::string S) {
+    std::replace(S.begin(), S.end(), '\\', '/');
+    return S;
+  };
   NormalizedFS.setCurrentWorkingDirectory("/b/c");
   NormalizedFS.setCurrentWorkingDirectory(".");
-  ASSERT_EQ("/b/c", NormalizedFS.getCurrentWorkingDirectory().get());
+  ASSERT_EQ("/b/c", ReplaceBackslashes(
+                        NormalizedFS.getCurrentWorkingDirectory().get()));
   NormalizedFS.setCurrentWorkingDirectory("..");
-  ASSERT_EQ("/b", NormalizedFS.getCurrentWorkingDirectory().get());
+  ASSERT_EQ("/b", ReplaceBackslashes(
+                      NormalizedFS.getCurrentWorkingDirectory().get()));
 }
 
 // NOTE: in the tests below, we use '//root/' as our root directory, since it is




More information about the cfe-commits mailing list