Windows-specific test for sys::path::remove_dots.
authorMike Aizatsky <aizatsky@chromium.org>
Mon, 9 Nov 2015 19:36:53 +0000 (19:36 +0000)
committerMike Aizatsky <aizatsky@chromium.org>
Mon, 9 Nov 2015 19:36:53 +0000 (19:36 +0000)
Differential Revision: http://reviews.llvm.org/D14503

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252504 91177308-0d34-0410-b5e6-96231b3b80d8

unittests/Support/Path.cpp

index 07ad3fc..9b7cd2f 100644 (file)
@@ -853,6 +853,18 @@ static std::string remove_dots(StringRef path,
 }
 
 TEST(Support, RemoveDots) {
+#if defined(LLVM_ON_WIN32)
+  EXPECT_EQ("foolz\\wat", remove_dots(".\\.\\\\foolz\\wat", false));
+  EXPECT_EQ("", remove_dots(".\\\\\\\\\\", false));
+
+  EXPECT_EQ("a\\..\\b\\c", remove_dots(".\\a\\..\\b\\c", false));
+  EXPECT_EQ("b\\c", remove_dots(".\\a\\..\\b\\c", true));
+  EXPECT_EQ("c", remove_dots(".\\.\\c", true));
+
+  SmallString<64> Path1(".\\.\\c");
+  EXPECT_TRUE(path::remove_dots(Path1, true));
+  EXPECT_EQ("c", Path1);
+#else
   EXPECT_EQ("foolz/wat", remove_dots("././/foolz/wat", false));
   EXPECT_EQ("", remove_dots("./////", false));
 
@@ -863,5 +875,6 @@ TEST(Support, RemoveDots) {
   SmallString<64> Path1("././c");
   EXPECT_TRUE(path::remove_dots(Path1, true));
   EXPECT_EQ("c", Path1);
+#endif
 }
 } // anonymous namespace