Move twice-repeated clang path operation into a new function.
[oota-llvm.git] / unittests / Support / Path.cpp
index 11d53c83419def2a60b357f643c0d264c2477e9a..cfba227dbe93fe723d855d95bcb15a418ba916ec 100644 (file)
@@ -789,4 +789,14 @@ TEST(Support, NormalizePath) {
 
 #undef EXPECT_PATH_IS
 }
+
+TEST(Support, RemoveLeadingDotSlash) {
+  StringRef Path1("././/foolz/wat");
+  StringRef Path2("./////");
+
+  Path1 = path::remove_leading_dotslash(Path1);
+  EXPECT_EQ(Path1, "foolz/wat");
+  Path2 = path::remove_leading_dotslash(Path2);
+  EXPECT_EQ(Path2, "");
+}
 } // anonymous namespace