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

Unified Diff: base/json_reader_unittest.cc

Issue 159104: Silence a false coverity warning by changing the code a bit. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 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_reader.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/json_reader_unittest.cc
===================================================================
--- base/json_reader_unittest.cc (revision 20638)
+++ base/json_reader_unittest.cc (working copy)
@@ -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());
« no previous file with comments | « base/json_reader.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698