X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=unittests%2FADT%2FStringRefTest.cpp;h=d91084381ec304881cf59ac8fe89ed1d87644ef5;hb=c7384cfc7addb5d2818ac0bb4492778f28183c49;hp=8364eac827487b70698370fac253f44904e80e37;hpb=7850dd0f25ccc5da6df54999a907e1277ed055d6;p=oota-llvm.git diff --git a/unittests/ADT/StringRefTest.cpp b/unittests/ADT/StringRefTest.cpp index 8364eac8274..d91084381ec 100644 --- a/unittests/ADT/StringRefTest.cpp +++ b/unittests/ADT/StringRefTest.cpp @@ -245,6 +245,12 @@ TEST(StringRefTest, Find) { EXPECT_EQ(StringRef::npos, Str.find("zz")); EXPECT_EQ(2U, Str.find("ll", 2)); EXPECT_EQ(StringRef::npos, Str.find("ll", 3)); + EXPECT_EQ(0U, Str.find("")); + StringRef LongStr("hellx xello hell ello world foo bar hello"); + EXPECT_EQ(36U, LongStr.find("hello")); + EXPECT_EQ(28U, LongStr.find("foo")); + EXPECT_EQ(12U, LongStr.find("hell", 2)); + EXPECT_EQ(0U, LongStr.find("")); EXPECT_EQ(3U, Str.rfind('l')); EXPECT_EQ(StringRef::npos, Str.rfind('z'));