Skip to content
Snippets Groups Projects
Commit 14fd1194 authored by tc@google.com's avatar tc@google.com
Browse files

Add a unittest for the JSONValueSerializer::set_allow_trailing_comma() method....

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
parent 27a3384a
No related branches found
No related tags found
No related merge requests found
......@@ -72,7 +72,7 @@ class JSONStringValueSerializer : public ValueSerializer {
void set_pretty_print(bool new_value) { pretty_print_ = new_value; }
bool pretty_print() { return pretty_print_; }
bool set_allow_trailing_comma(bool new_value) {
void set_allow_trailing_comma(bool new_value) {
allow_trailing_comma_ = new_value;
}
......
......@@ -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) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment