summaryrefslogtreecommitdiff
path: root/unittests/Support/Path.cpp
diff options
context:
space:
mode:
authorMichael J. Spencer <bigcheesegs@gmail.com>2010-12-01 03:37:41 +0000
committerMichael J. Spencer <bigcheesegs@gmail.com>2010-12-01 03:37:41 +0000
commit5265f22f4558f376dece4744b3fe2ae1c637d223 (patch)
tree8390432374437bae8dd6dce7f327ed6403aa0744 /unittests/Support/Path.cpp
parent28cd48fffbe2e31184332674429d6d087ad3631f (diff)
downloadllvm-5265f22f4558f376dece4744b3fe2ae1c637d223.tar.gz
llvm-5265f22f4558f376dece4744b3fe2ae1c637d223.tar.bz2
llvm-5265f22f4558f376dece4744b3fe2ae1c637d223.tar.xz
Support/PathV2: Add extension implementation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120550 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/Support/Path.cpp')
-rw-r--r--unittests/Support/Path.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/unittests/Support/Path.cpp b/unittests/Support/Path.cpp
index 70cf213f19..2114a181fa 100644
--- a/unittests/Support/Path.cpp
+++ b/unittests/Support/Path.cpp
@@ -100,6 +100,9 @@ TEST(Support, Path) {
if (error_code ec = sys::path::stem(*i, res))
ASSERT_FALSE(ec.message().c_str());
outs() << " stem: " << res << '\n';
+ if (error_code ec = sys::path::extension(*i, res))
+ ASSERT_FALSE(ec.message().c_str());
+ outs() << " stem: " << res << '\n';
temp_store = *i;
if (error_code ec = sys::path::make_absolute(temp_store))
@@ -113,10 +116,17 @@ TEST(Support, Path) {
if (error_code ec = sys::path::replace_extension(temp_store, "ext"))
ASSERT_FALSE(ec.message().c_str());
outs() << " replace_extension: " << temp_store << '\n';
+ StringRef stem, ext;
if (error_code ec = sys::path::stem(
- StringRef(temp_store.begin(), temp_store.size()), res))
+ StringRef(temp_store.begin(), temp_store.size()), stem))
ASSERT_FALSE(ec.message().c_str());
- outs() << " stem: " << res << '\n';
+ outs() << " stem: " << stem << '\n';
+ if (error_code ec = sys::path::extension(
+ StringRef(temp_store.begin(), temp_store.size()), ext))
+ ASSERT_FALSE(ec.message().c_str());
+ outs() << " extension: " << ext << '\n';
+ EXPECT_EQ(*(--sys::path::end(
+ StringRef(temp_store.begin(), temp_store.size()))), (stem + ext).str());
if (error_code ec = sys::path::native(*i, temp_store))
ASSERT_FALSE(ec.message().c_str());
outs() << " native: " << temp_store << '\n';