aboutsummaryrefslogtreecommitdiff
path: root/llvm/unittests/ADT/StringRefTest.cpp
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
commita1e04d43c4986c24723e8840d9f7a00ed068c2df (patch)
tree3ff0e9b53a72285b8866d10c46129540f27d097b /llvm/unittests/ADT/StringRefTest.cpp
parent2c30970b22112b0fe7a603005ea2b26d11e69b95 (diff)
downloadllvm-a1e04d43c4986c24723e8840d9f7a00ed068c2df.zip
llvm-a1e04d43c4986c24723e8840d9f7a00ed068c2df.tar.gz
llvm-a1e04d43c4986c24723e8840d9f7a00ed068c2df.tar.bz2
StringRef: Add find(char) and find(StringRef).
Also, regroup functions. llvm-svn: 78712
Diffstat (limited to 'llvm/unittests/ADT/StringRefTest.cpp')
-rw-r--r--llvm/unittests/ADT/StringRefTest.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/unittests/ADT/StringRefTest.cpp b/llvm/unittests/ADT/StringRefTest.cpp
index e7498cc..972201c 100644
--- a/llvm/unittests/ADT/StringRefTest.cpp
+++ b/llvm/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