aboutsummaryrefslogtreecommitdiffstats
path: root/unittests
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-08-11 20:47:15 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-08-11 20:47:15 +0000
commit0ad7f9bb2f806387e53ffeaf6a564b9a80b962af (patch)
treee5e52a07f3fc5d958c9f0671e42c48c23fba87c9 /unittests
parent0a31d2f6456069adba19b8aeca66c68b633c38b4 (diff)
downloadexternal_llvm-0ad7f9bb2f806387e53ffeaf6a564b9a80b962af.zip
external_llvm-0ad7f9bb2f806387e53ffeaf6a564b9a80b962af.tar.gz
external_llvm-0ad7f9bb2f806387e53ffeaf6a564b9a80b962af.tar.bz2
StringRef: Add find(char) and find(StringRef).
Also, regroup functions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78712 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r--unittests/ADT/StringRefTest.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/unittests/ADT/StringRefTest.cpp b/unittests/ADT/StringRefTest.cpp
index e7498cc..972201c 100644
--- a/unittests/ADT/StringRefTest.cpp
+++ b/unittests/ADT/StringRefTest.cpp
@@ -87,6 +87,13 @@ TEST(StringRefTest, Utilities) {
raw_string_ostream OS(Storage);
OS << StringRef("hello");
EXPECT_EQ("hello", OS.str());
+
+ EXPECT_TRUE(Str.find('l') == 2);
+ EXPECT_TRUE(Str.find('z') == StringRef::npos);
+ EXPECT_TRUE(Str.find("helloworld") == StringRef::npos);
+ EXPECT_TRUE(Str.find("hello") == 0);
+ EXPECT_TRUE(Str.find("ello") == 1);
+ EXPECT_TRUE(Str.find("zz") == StringRef::npos);
}
} // end anonymous namespace