summaryrefslogtreecommitdiff
path: root/unittests
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2013-10-28 22:42:54 +0000
committerRui Ueyama <ruiu@google.com>2013-10-28 22:42:54 +0000
commitbc850d0c6c8d0e5ed4a2cdc502603a9d2946908e (patch)
treead1aefed323e732b27fc081d8b4c42fce0615560 /unittests
parent136660484d56ac5bb168e0c3a8f6fbc9d986723e (diff)
downloadllvm-bc850d0c6c8d0e5ed4a2cdc502603a9d2946908e.tar.gz
llvm-bc850d0c6c8d0e5ed4a2cdc502603a9d2946908e.tar.bz2
llvm-bc850d0c6c8d0e5ed4a2cdc502603a9d2946908e.tar.xz
Add a few tests for StringRef::{start,end}with.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193550 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r--unittests/ADT/StringRefTest.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/unittests/ADT/StringRefTest.cpp b/unittests/ADT/StringRefTest.cpp
index 3cb6143a42..07fba49684 100644
--- a/unittests/ADT/StringRefTest.cpp
+++ b/unittests/ADT/StringRefTest.cpp
@@ -248,6 +248,7 @@ TEST(StringRefTest, Trim) {
TEST(StringRefTest, StartsWith) {
StringRef Str("hello");
+ EXPECT_TRUE(Str.startswith(""));
EXPECT_TRUE(Str.startswith("he"));
EXPECT_FALSE(Str.startswith("helloworld"));
EXPECT_FALSE(Str.startswith("hi"));
@@ -255,6 +256,7 @@ TEST(StringRefTest, StartsWith) {
TEST(StringRefTest, EndsWith) {
StringRef Str("hello");
+ EXPECT_TRUE(Str.endswith(""));
EXPECT_TRUE(Str.endswith("lo"));
EXPECT_FALSE(Str.endswith("helloworld"));
EXPECT_FALSE(Str.endswith("worldhello"));