diff options
author | Douglas Katzman <dougk@google.com> | 2015-09-02 21:02:10 +0000 |
---|---|---|
committer | Douglas Katzman <dougk@google.com> | 2015-09-02 21:02:10 +0000 |
commit | a26be4a946ded0d328473e3842f2df45e896488f (patch) | |
tree | 3c49861cd5090e0c521d244c843b15d92b66384e /llvm/unittests/Support/Path.cpp | |
parent | 9550590711ed82b357837b5af976ab3b7611764c (diff) | |
download | bcm5719-llvm-a26be4a946ded0d328473e3842f2df45e896488f.tar.gz bcm5719-llvm-a26be4a946ded0d328473e3842f2df45e896488f.zip |
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
Diffstat (limited to 'llvm/unittests/Support/Path.cpp')
-rw-r--r-- | llvm/unittests/Support/Path.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
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 |