aboutsummaryrefslogtreecommitdiff
path: root/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
commit63cc3a85cc10093f83f76ea9192f77929b58569e (patch)
tree8144f00064a3c7e625fc6c7b775b243e30646b12 /unittests/Support/Path.cpp
parent7973f350b78e0bef8567f441f3255c846f5432ac (diff)
Adds llvm::sys::path::is_separator() to test whether a char is a path separator
on the host OS. Reviewed by dgregor. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125406 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/Support/Path.cpp')
-rw-r--r--unittests/Support/Path.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/unittests/Support/Path.cpp b/unittests/Support/Path.cpp
index 1f67f13e97..60d08bc92d 100644
--- a/unittests/Support/Path.cpp
+++ b/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("");