X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=blobdiff_plain;f=unittests%2FADT%2FStringRefTest.cpp;h=6cf2e6a0454dcba5802721e5f5a1b72b70be6ebc;hp=8af07da24ea12d8706bb320f12063e277fa7ec07;hb=f41971f6e7f9e5ba0c590c7e35e2c1af0cd38c69;hpb=eb2f352d0ffe950a4cf0238397df329ae2af2a27 diff --git a/unittests/ADT/StringRefTest.cpp b/unittests/ADT/StringRefTest.cpp index 8af07da24ea..6cf2e6a0454 100644 --- a/unittests/ADT/StringRefTest.cpp +++ b/unittests/ADT/StringRefTest.cpp @@ -230,6 +230,54 @@ TEST(StringRefTest, Split2) { expected.push_back("a"); expected.push_back("b"); expected.push_back("c"); StringRef("a,,b,c").split(parts, ',', 3, false); EXPECT_TRUE(parts == expected); + + expected.clear(); parts.clear(); + expected.push_back(""); + StringRef().split(parts, ",", 0, true); + EXPECT_TRUE(parts == expected); + + expected.clear(); parts.clear(); + expected.push_back(StringRef()); + StringRef("").split(parts, ",", 0, true); + EXPECT_TRUE(parts == expected); + + expected.clear(); parts.clear(); + StringRef("").split(parts, ",", 0, false); + EXPECT_TRUE(parts == expected); + StringRef().split(parts, ",", 0, false); + EXPECT_TRUE(parts == expected); + + expected.clear(); parts.clear(); + expected.push_back("a"); + expected.push_back(""); + expected.push_back("b"); + expected.push_back("c,d"); + StringRef("a,,b,c,d").split(parts, ",", 3, true); + EXPECT_TRUE(parts == expected); + + expected.clear(); parts.clear(); + expected.push_back(""); + StringRef().split(parts, ',', 0, true); + EXPECT_TRUE(parts == expected); + + expected.clear(); parts.clear(); + expected.push_back(StringRef()); + StringRef("").split(parts, ',', 0, true); + EXPECT_TRUE(parts == expected); + + expected.clear(); parts.clear(); + StringRef("").split(parts, ',', 0, false); + EXPECT_TRUE(parts == expected); + StringRef().split(parts, ',', 0, false); + EXPECT_TRUE(parts == expected); + + expected.clear(); parts.clear(); + expected.push_back("a"); + expected.push_back(""); + expected.push_back("b"); + expected.push_back("c,d"); + StringRef("a,,b,c,d").split(parts, ',', 3, true); + EXPECT_TRUE(parts == expected); } TEST(StringRefTest, Trim) {