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

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

Issue 547703002: Rework how types work in the VM Service. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: gen js Created 6 years, 3 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/bin/vmservice/observatory/lib/src/service/object.dart ('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 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 291
292 292
293 TEST_CASE(JSON_JSONStream_DartObject) { 293 TEST_CASE(JSON_JSONStream_DartObject) {
294 JSONStream js; 294 JSONStream js;
295 { 295 {
296 JSONArray jsarr(&js); 296 JSONArray jsarr(&js);
297 jsarr.AddValue(Object::Handle(Object::null())); 297 jsarr.AddValue(Object::Handle(Object::null()));
298 JSONObject jsobj(&jsarr); 298 JSONObject jsobj(&jsarr);
299 jsobj.AddProperty("object_key", Object::Handle(Object::null())); 299 jsobj.AddProperty("object_key", Object::Handle(Object::null()));
300 } 300 }
301 EXPECT_STREQ("[{\"type\":\"@Null\",\"id\":\"objects\\/null\"," 301 EXPECT_STREQ("[{\"type\":\"@null\",\"id\":\"objects\\/null\","
302 "\"valueAsString\":\"null\"}," 302 "\"valueAsString\":\"null\"},"
303 "{\"object_key\":{\"type\":\"@Null\",\"id\":\"objects\\/null\"," 303 "{\"object_key\":{\"type\":\"@null\",\"id\":\"objects\\/null\","
304 "\"valueAsString\":\"null\"}}]", 304 "\"valueAsString\":\"null\"}}]",
305 js.ToCString()); 305 js.ToCString());
306 } 306 }
307 307
308 TEST_CASE(JSON_JSONStream_EscapedString) { 308 TEST_CASE(JSON_JSONStream_EscapedString) {
309 JSONStream js; 309 JSONStream js;
310 { 310 {
311 JSONArray jsarr(&js); 311 JSONArray jsarr(&js);
312 jsarr.AddValue("Hel\"\"lo\r\n\t"); 312 jsarr.AddValue("Hel\"\"lo\r\n\t");
313 } 313 }
(...skipping 16 matching lines...) Expand all
330 js.SetOptions(&option_keys[0], &option_values[0], 3); 330 js.SetOptions(&option_keys[0], &option_values[0], 3);
331 EXPECT(js.num_options() == 3); 331 EXPECT(js.num_options() == 3);
332 EXPECT(!js.HasOption("lizard")); 332 EXPECT(!js.HasOption("lizard"));
333 EXPECT(js.HasOption("dog")); 333 EXPECT(js.HasOption("dog"));
334 EXPECT(js.HasOption("cat")); 334 EXPECT(js.HasOption("cat"));
335 EXPECT(js.OptionIs("cat", "banana")); 335 EXPECT(js.OptionIs("cat", "banana"));
336 EXPECT(!js.OptionIs("dog", "banana")); 336 EXPECT(!js.OptionIs("dog", "banana"));
337 } 337 }
338 338
339 } // namespace dart 339 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/bin/vmservice/observatory/lib/src/service/object.dart ('k') | runtime/vm/object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698