diff options
author | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-05 00:36:34 +0000 |
---|---|---|
committer | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-05 00:36:34 +0000 |
commit | 650303702da4b95d7f212637525ff27e6280299c (patch) | |
tree | aef8daa304a11ac0f3a366aaf5b92e77e272d020 /base/string_split_unittest.cc | |
parent | 883ce72de20ef56c3c332215c12f14886b67bf8e (diff) | |
download | chromium_src-650303702da4b95d7f212637525ff27e6280299c.zip chromium_src-650303702da4b95d7f212637525ff27e6280299c.tar.gz chromium_src-650303702da4b95d7f212637525ff27e6280299c.tar.bz2 |
TTF: Re-enable SplitStringIntoKeyValuePairsTest.EmptyString. Fix the case
where an empty pair would cause SplitStringIntoKeyValuePairs to report an error
yet add the empty pair to the pairs list. Add more tests.
BUG=none
TEST=SplitStringIntoKeyValuePairsTest.*, StringUtilTest.SplitString
Review URL: http://codereview.chromium.org/1971001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46420 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/string_split_unittest.cc')
-rw-r--r-- | base/string_split_unittest.cc | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/base/string_split_unittest.cc b/base/string_split_unittest.cc index 984e6e8..820f74b 100644 --- a/base/string_split_unittest.cc +++ b/base/string_split_unittest.cc @@ -85,7 +85,7 @@ class SplitStringIntoKeyValuePairsTest : public testing::Test { std::vector<std::pair<std::string, std::string> > kv_pairs; }; -TEST_F(SplitStringIntoKeyValuePairsTest, DISABLED_EmptyString) { +TEST_F(SplitStringIntoKeyValuePairsTest, EmptyString) { EXPECT_TRUE(SplitStringIntoKeyValuePairs("", ':', // Key-value delimiters ',', // Key-value pair delims @@ -93,6 +93,18 @@ TEST_F(SplitStringIntoKeyValuePairsTest, DISABLED_EmptyString) { EXPECT_TRUE(kv_pairs.empty()); } +TEST_F(SplitStringIntoKeyValuePairsTest, EmptySecondPair) { + EXPECT_TRUE(SplitStringIntoKeyValuePairs("key1:value1,,key3:value3", + ':', // Key-value delimiters + ',', // Key-value pair delims + &kv_pairs)); + ASSERT_EQ(2U, kv_pairs.size()); + EXPECT_EQ("key1", kv_pairs[0].first); + EXPECT_EQ("value1", kv_pairs[0].second); + EXPECT_EQ("key3", kv_pairs[1].first); + EXPECT_EQ("value3", kv_pairs[1].second); +} + TEST_F(SplitStringIntoKeyValuePairsTest, EmptySecondValue) { EXPECT_FALSE(SplitStringIntoKeyValuePairs("key1:value1 , key2:", ':', // Key-value delimiters |