summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/Support/Path.cpp
diff options
context:
space:
mode:
authorZhanyong Wan <wan@google.com>2011-02-11 21:24:40 +0000
committerZhanyong Wan <wan@google.com>2011-02-11 21:24:40 +0000
commit606bb1a2dce55989c1dc607ed995516d0b48934f (patch)
treec820c994206fc3badd4468f45fc4038c76d3d177 /llvm/unittests/Support/Path.cpp
parentc6ca7bb67a6b67583c545f37a59b8735780263e2 (diff)
downloadbcm5719-llvm-606bb1a2dce55989c1dc607ed995516d0b48934f.tar.gz
bcm5719-llvm-606bb1a2dce55989c1dc607ed995516d0b48934f.zip
Adds llvm::sys::path::is_separator() to test whether a char is a path separator
on the host OS. Reviewed by dgregor. llvm-svn: 125406
Diffstat (limited to 'llvm/unittests/Support/Path.cpp')
-rw-r--r--llvm/unittests/Support/Path.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/unittests/Support/Path.cpp b/llvm/unittests/Support/Path.cpp
index 1f67f13e97e..60d08bc92db 100644
--- a/llvm/unittests/Support/Path.cpp
+++ b/llvm/unittests/Support/Path.cpp
@@ -29,6 +29,19 @@ using namespace llvm::sys;
namespace {
+TEST(is_separator, Works) {
+ EXPECT_TRUE(path::is_separator('/'));
+ EXPECT_FALSE(path::is_separator('\0'));
+ EXPECT_FALSE(path::is_separator('-'));
+ EXPECT_FALSE(path::is_separator(' '));
+
+#ifdef LLVM_ON_WIN32
+ EXPECT_TRUE(path::is_separator('\\'));
+#else
+ EXPECT_FALSE(path::is_separator('\\'));
+#endif
+}
+
TEST(Support, Path) {
SmallVector<StringRef, 40> paths;
paths.push_back("");
OpenPOWER on IntegriCloud