From 22da134d98a8e88ad39fff0abf73754785d25a6b Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Sun, 10 Jan 2016 10:36:59 +0000 Subject: [PATCH] Make test work on windows by turning \ in paths back into /. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@257286 91177308-0d34-0410-b5e6-96231b3b80d8 --- unittests/Basic/VirtualFileSystemTest.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/unittests/Basic/VirtualFileSystemTest.cpp b/unittests/Basic/VirtualFileSystemTest.cpp index b72b757b5f..3a638bbf7b 100644 --- a/unittests/Basic/VirtualFileSystemTest.cpp +++ b/unittests/Basic/VirtualFileSystemTest.cpp @@ -658,11 +658,17 @@ TEST_F(InMemoryFileSystemTest, WorkingDirectory) { 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 -- 2.50.1