diff options
author | tc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-07-29 00:45:32 +0000 |
---|---|---|
committer | tc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-07-29 00:45:32 +0000 |
commit | 14fd11947f98ad50efa67c96cc0ce7bfd06e92ba (patch) | |
tree | 1031cf0f099d73745b8113a5ce5ee18fa3268c7f /chrome/common/json_value_serializer_unittest.cc | |
parent | 27a3384a28534629327753c228b5aac773696131 (diff) | |
download | chromium_src-14fd11947f98ad50efa67c96cc0ce7bfd06e92ba.zip chromium_src-14fd11947f98ad50efa67c96cc0ce7bfd06e92ba.tar.gz chromium_src-14fd11947f98ad50efa67c96cc0ce7bfd06e92ba.tar.bz2 |
Add a unittest for the JSONValueSerializer::set_allow_trailing_comma() method. Fixes the return type in the header.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@55 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/json_value_serializer_unittest.cc')
-rw-r--r-- | chrome/common/json_value_serializer_unittest.cc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/chrome/common/json_value_serializer_unittest.cc b/chrome/common/json_value_serializer_unittest.cc index a4e9d89..1c2b433 100644 --- a/chrome/common/json_value_serializer_unittest.cc +++ b/chrome/common/json_value_serializer_unittest.cc @@ -187,6 +187,23 @@ TEST(JSONValueSerializerTest, HexStrings) { delete deserial_root; } +TEST(JSONValueSerializerTest, AllowTrailingComma) { + Value* root = NULL; + Value* root_expected = NULL; + std::string test_with_commas("{\"key\": [true,],}"); + std::string test_no_commas("{\"key\": [true]}"); + + JSONStringValueSerializer serializer(test_with_commas); + serializer.set_allow_trailing_comma(true); + JSONStringValueSerializer serializer_expected(test_no_commas); + ASSERT_TRUE(serializer.Deserialize(&root)); + ASSERT_TRUE(serializer_expected.Deserialize(&root_expected)); + ASSERT_TRUE(root->Equals(root_expected)); + + delete root; + delete root_expected; +} + namespace { void ValidateJsonList(const std::string& json) { |