Chromium Code Reviews| Index: base/string_util_unittest.cc |
| diff --git a/base/string_util_unittest.cc b/base/string_util_unittest.cc |
| index 35c58d6668ac805a643244721ac1e13a59b9b35b..98f64bd1a15245621252e1602479110fb3632de5 100644 |
| --- a/base/string_util_unittest.cc |
| +++ b/base/string_util_unittest.cc |
| @@ -1576,6 +1576,21 @@ TEST(StringUtilTest, StartsWith) { |
| EXPECT_TRUE(StartsWith(L"java", L"", true)); |
| } |
| +TEST(StringUtilTest, EndsWith) { |
| + EXPECT_TRUE(EndsWith(L"Foo.plugin", L".plugin", true)); |
| + EXPECT_FALSE(EndsWith(L"Foo.Plugin", L".plugin", true)); |
| + EXPECT_TRUE(EndsWith(L"Foo.plugin", L".plugin", false)); |
| + EXPECT_TRUE(EndsWith(L"Foo.Plugin", L".plugin", false)); |
| + EXPECT_FALSE(EndsWith(L".plug", L".plugin", true)); |
| + EXPECT_FALSE(EndsWith(L".plug", L".plugin", false)); |
| + EXPECT_FALSE(EndsWith(L"Foo.plugin Bar", L".plugin", true)); |
| + EXPECT_FALSE(EndsWith(L"Foo.plugin Bar", L".plugin", false)); |
| + EXPECT_FALSE(EndsWith(L"", L".plugin", false)); |
| + EXPECT_FALSE(EndsWith(L"", L".plugin", true)); |
| + EXPECT_TRUE(EndsWith(L"Foo.plugin", L"", false)); |
| + EXPECT_TRUE(EndsWith(L"Foo.plugin", L"", true)); |
| +} |
|
Mark Mentovai
2009/09/04 18:09:00
I'd also add a few cases to test |str == search|,
|
| + |
| TEST(StringUtilTest, GetStringFWithOffsets) { |
| std::vector<string16> subst; |
| subst.push_back(ASCIIToUTF16("1")); |