summaryrefslogtreecommitdiffstats
path: root/base/json_reader_unittest.cc
diff options
context:
space:
mode:
Diffstat (limited to 'base/json_reader_unittest.cc')
-rw-r--r--base/json_reader_unittest.cc18
1 files changed, 18 insertions, 0 deletions
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 @@ TEST(JSONReaderTest, Reading) {
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());