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

Unified Diff: runtime/vm/json_test.cc

Issue 23439002: JSON string decoding for VM debugger (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 4 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
« runtime/platform/json.cc ('K') | « runtime/vm/debugger_api_impl_test.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/json_test.cc
===================================================================
--- runtime/vm/json_test.cc (revision 26654)
+++ runtime/vm/json_test.cc (working copy)
@@ -73,11 +73,14 @@
" \"foo\" : [null, 1, { }, \"bar\", true, false],"
" \"line\": 111, "
" },"
- " \"foo\": \"outer foo\", "
+ " \"foo\": \"outer foo\", "
+ " \"quote\": \"\\\"\", "
+ " \"white\": \"\\t \\n\", "
"}";
JSONReader reader(jobj);
bool found;
+ char s[128];
found = reader.Seek("id");
EXPECT(found);
@@ -86,6 +89,23 @@
EXPECT(found);
EXPECT_EQ(reader.Type(), JSONReader::kString);
EXPECT(reader.IsStringLiteral("outer foo"));
+
+ found = reader.Seek("quote");
+ EXPECT(found);
+ EXPECT_EQ(reader.Type(), JSONReader::kString);
+ reader.GetRawValueChars(s, sizeof s);
+ EXPECT_STREQ("\\\"", s);
+ reader.GetDecodedValueChars(s, sizeof s);
+ EXPECT_STREQ("\"", s);
+
+ found = reader.Seek("white");
+ EXPECT(found);
+ EXPECT_EQ(reader.Type(), JSONReader::kString);
+ reader.GetRawValueChars(s, sizeof s);
+ EXPECT_STREQ("\\t \\n", s);
+ reader.GetDecodedValueChars(s, sizeof s);
+ EXPECT_STREQ("\t \n", s);
+
found = reader.Seek("line");
EXPECT(!found);
found = reader.Seek("params");
« runtime/platform/json.cc ('K') | « runtime/vm/debugger_api_impl_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698