From a26be4a946ded0d328473e3842f2df45e896488f Mon Sep 17 00:00:00 2001 From: Douglas Katzman Date: Wed, 2 Sep 2015 21:02:10 +0000 Subject: Move twice-repeated clang path operation into a new function. And make it more robust in the edge case of exactly "./" as input. llvm-svn: 246711 --- llvm/unittests/Support/Path.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'llvm/unittests/Support/Path.cpp') diff --git a/llvm/unittests/Support/Path.cpp b/llvm/unittests/Support/Path.cpp index 11d53c83419..cfba227dbe9 100644 --- a/llvm/unittests/Support/Path.cpp +++ b/llvm/unittests/Support/Path.cpp @@ -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 -- cgit v1.2.3