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

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

Issue 217323006: Redo allocationprofile options (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 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/service.cc » ('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 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 TEST_CASE(JSON_JSONStream_EscapedString) { 305 TEST_CASE(JSON_JSONStream_EscapedString) {
306 JSONStream js; 306 JSONStream js;
307 { 307 {
308 JSONArray jsarr(&js); 308 JSONArray jsarr(&js);
309 jsarr.AddValue("Hel\"\"lo\r\n\t"); 309 jsarr.AddValue("Hel\"\"lo\r\n\t");
310 } 310 }
311 EXPECT_STREQ("[\"Hel\\\"\\\"lo\\r\\n\\t\"]", js.ToCString()); 311 EXPECT_STREQ("[\"Hel\\\"\\\"lo\\r\\n\\t\"]", js.ToCString());
312 } 312 }
313 313
314 314
315 TEST_CASE(JSON_JSONStream_Options) {
316 const char* arguments[] = {"a", "b", "c"};
317 const char* option_keys[] = {"dog", "cat"};
318 const char* option_values[] = {"apple", "banana"};
319
320 JSONStream js;
321 EXPECT(js.num_arguments() == 0);
322 js.SetArguments(&arguments[0], 3);
323 EXPECT(js.num_arguments() == 3);
324 EXPECT_STREQ("a", js.command());
325
326 EXPECT(js.num_options() == 0);
327 js.SetOptions(&option_keys[0], &option_values[0], 3);
328 EXPECT(js.num_options() == 3);
329 EXPECT(!js.HasOption("lizard"));
330 EXPECT(js.HasOption("dog"));
331 EXPECT(js.HasOption("cat"));
332 EXPECT(js.OptionIs("cat", "banana"));
333 EXPECT(!js.OptionIs("dog", "banana"));
334 }
335
315 } // namespace dart 336 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/json_stream.cc ('k') | runtime/vm/service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698