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

Side by Side Diff: runtime/vm/json_test.cc

Issue 18472009: JSONStream Print Dart Objects (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/json_stream.cc ('k') | runtime/vm/object.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "platform/assert.h" 5 #include "platform/assert.h"
6 #include "platform/json.h" 6 #include "platform/json.h"
7 #include "vm/json_stream.h" 7 #include "vm/json_stream.h"
8 #include "vm/unit_test.h" 8 #include "vm/unit_test.h"
9 9
10 namespace dart { 10 namespace dart {
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 js.PrintValue((intptr_t)4); 212 js.PrintValue((intptr_t)4);
213 js.CloseArray(); 213 js.CloseArray();
214 js.OpenArray(); 214 js.OpenArray();
215 js.PrintValueBool(false); 215 js.PrintValueBool(false);
216 js.CloseArray(); 216 js.CloseArray();
217 js.CloseArray(); 217 js.CloseArray();
218 EXPECT_STREQ("[[4],[false]]", tb.buf()); 218 EXPECT_STREQ("[[4],[false]]", tb.buf());
219 } 219 }
220 220
221 221
222 TEST_CASE(JSON_JSONStream_DartObject) {
223 TextBuffer tb(256);
224 JSONStream js(&tb);
225 js.OpenArray();
226 js.PrintValue(Object::Handle(Object::null()));
227 js.OpenObject();
228 js.PrintProperty("object_key", Object::Handle(Object::null()));
229 js.CloseArray();
230 EXPECT_STREQ("[{\"type\":\"null\"},{\"object_key\":{\"type\":\"null\"}]",
231 tb.buf());
232 }
233
234
222 } // namespace dart 235 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/json_stream.cc ('k') | runtime/vm/object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698