Silence a false coverity warning by changing the code a bit.
Review URL: http://codereview.chromium.org/159104
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21447 0039d316-1c4b-4281-b951-d872f2087c98
CrOS-Libchrome-Original-Commit: 5b0bc2527811d672c7b09a2a4fbfa92b49132186
diff --git a/base/json_reader_unittest.cc b/base/json_reader_unittest.cc
index 0513eb5..be3e07e 100644
--- a/base/json_reader_unittest.cc
+++ b/base/json_reader_unittest.cc
@@ -24,6 +24,24 @@
ASSERT_TRUE(root.get());
ASSERT_TRUE(root->IsType(Value::TYPE_BOOLEAN));
+ // Embedded comment
+ root.reset(JSONReader().JsonToValue("/* comment */null", false, false));
+ ASSERT_TRUE(root.get());
+ ASSERT_TRUE(root->IsType(Value::TYPE_NULL));
+ root.reset(JSONReader().JsonToValue("40 /* comment */", false, false));
+ ASSERT_TRUE(root.get());
+ ASSERT_TRUE(root->IsType(Value::TYPE_INTEGER));
+ root.reset(JSONReader().JsonToValue("true // comment", false, false));
+ ASSERT_TRUE(root.get());
+ ASSERT_TRUE(root->IsType(Value::TYPE_BOOLEAN));
+ root.reset(JSONReader().JsonToValue("/* comment */\"sample string\"",
+ false, false));
+ ASSERT_TRUE(root.get());
+ ASSERT_TRUE(root->IsType(Value::TYPE_STRING));
+ std::string value;
+ ASSERT_TRUE(root->GetAsString(&value));
+ ASSERT_EQ("sample string", value);
+
// Test number formats
root.reset(JSONReader().JsonToValue("43", false, false));
ASSERT_TRUE(root.get());