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

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

Issue 257053003: Always use the same json for null in the vm service. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: gen js Created 6 years, 7 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 // TODO(zra): Remove when tests are ready to enable. 5 // TODO(zra): Remove when tests are ready to enable.
6 #include "platform/globals.h" 6 #include "platform/globals.h"
7 #if !defined(TARGET_ARCH_ARM64) 7 #if !defined(TARGET_ARCH_ARM64)
8 8
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 #include "platform/json.h" 10 #include "platform/json.h"
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 295
296 296
297 TEST_CASE(JSON_JSONStream_DartObject) { 297 TEST_CASE(JSON_JSONStream_DartObject) {
298 JSONStream js; 298 JSONStream js;
299 { 299 {
300 JSONArray jsarr(&js); 300 JSONArray jsarr(&js);
301 jsarr.AddValue(Object::Handle(Object::null())); 301 jsarr.AddValue(Object::Handle(Object::null()));
302 JSONObject jsobj(&jsarr); 302 JSONObject jsobj(&jsarr);
303 jsobj.AddProperty("object_key", Object::Handle(Object::null())); 303 jsobj.AddProperty("object_key", Object::Handle(Object::null()));
304 } 304 }
305 EXPECT_STREQ("[{\"type\":\"null\"},{\"object_key\":{\"type\":\"null\"}}]", 305 EXPECT_STREQ("[{\"type\":\"@Null\",\"id\":\"objects\\/null\","
306 "\"valueAsString\":\"null\"},"
307 "{\"object_key\":{\"type\":\"@Null\",\"id\":\"objects\\/null\","
308 "\"valueAsString\":\"null\"}}]",
306 js.ToCString()); 309 js.ToCString());
307 } 310 }
308 311
309 TEST_CASE(JSON_JSONStream_EscapedString) { 312 TEST_CASE(JSON_JSONStream_EscapedString) {
310 JSONStream js; 313 JSONStream js;
311 { 314 {
312 JSONArray jsarr(&js); 315 JSONArray jsarr(&js);
313 jsarr.AddValue("Hel\"\"lo\r\n\t"); 316 jsarr.AddValue("Hel\"\"lo\r\n\t");
314 } 317 }
315 EXPECT_STREQ("[\"Hel\\\"\\\"lo\\r\\n\\t\"]", js.ToCString()); 318 EXPECT_STREQ("[\"Hel\\\"\\\"lo\\r\\n\\t\"]", js.ToCString());
(...skipping 17 matching lines...) Expand all
333 EXPECT(!js.HasOption("lizard")); 336 EXPECT(!js.HasOption("lizard"));
334 EXPECT(js.HasOption("dog")); 337 EXPECT(js.HasOption("dog"));
335 EXPECT(js.HasOption("cat")); 338 EXPECT(js.HasOption("cat"));
336 EXPECT(js.OptionIs("cat", "banana")); 339 EXPECT(js.OptionIs("cat", "banana"));
337 EXPECT(!js.OptionIs("dog", "banana")); 340 EXPECT(!js.OptionIs("dog", "banana"));
338 } 341 }
339 342
340 } // namespace dart 343 } // namespace dart
341 344
342 #endif // !defined(TARGET_ARCH_ARM64) 345 #endif // !defined(TARGET_ARCH_ARM64)
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