Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(849)

Unified Diff: base/json/json_reader_unittest.cc

Issue 12476030: Handle block comments ending in **/ in the JSON parser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: neater fix Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/json/json_parser.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/json/json_reader_unittest.cc
diff --git a/base/json/json_reader_unittest.cc b/base/json/json_reader_unittest.cc
index 38bf590695c5eb38930396418502de8c640e7d5a..353e095551ad3af845b86997f37711f27eca19df 100644
--- a/base/json/json_reader_unittest.cc
+++ b/base/json/json_reader_unittest.cc
@@ -62,6 +62,19 @@ TEST(JSONReaderTest, Reading) {
ASSERT_TRUE(root.get());
list = static_cast<ListValue*>(root.get());
EXPECT_EQ(3u, list->GetSize());
+ root.reset(JSONReader().ReadToValue("/* comment **/42"));
+ ASSERT_TRUE(root.get());
+ EXPECT_TRUE(root->IsType(Value::TYPE_INTEGER));
+ EXPECT_TRUE(root->GetAsInteger(&int_val));
+ EXPECT_EQ(42, int_val);
+ root.reset(JSONReader().ReadToValue(
+ "/* comment **/\n"
+ "// */ 43\n"
+ "44"));
+ ASSERT_TRUE(root.get());
+ EXPECT_TRUE(root->IsType(Value::TYPE_INTEGER));
+ EXPECT_TRUE(root->GetAsInteger(&int_val));
+ EXPECT_EQ(44, int_val);
// Test number formats
root.reset(JSONReader().ReadToValue("43"));
« no previous file with comments | « base/json/json_parser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698