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
This commit is contained in:
Zhanyong Wan
2011-02-11 21:24:40 +00:00
parent 7973f350b7
commit 63cc3a85cc
3 changed files with 32 additions and 12 deletions

View File

@ -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("");