| OLD | NEW |
| 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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 JSONStream js(&tb); | 244 JSONStream js(&tb); |
| 245 js.OpenArray(); | 245 js.OpenArray(); |
| 246 js.PrintValue(Object::Handle(Object::null())); | 246 js.PrintValue(Object::Handle(Object::null())); |
| 247 js.OpenObject(); | 247 js.OpenObject(); |
| 248 js.PrintProperty("object_key", Object::Handle(Object::null())); | 248 js.PrintProperty("object_key", Object::Handle(Object::null())); |
| 249 js.CloseArray(); | 249 js.CloseArray(); |
| 250 EXPECT_STREQ("[{\"type\":\"null\"},{\"object_key\":{\"type\":\"null\"}]", | 250 EXPECT_STREQ("[{\"type\":\"null\"},{\"object_key\":{\"type\":\"null\"}]", |
| 251 tb.buf()); | 251 tb.buf()); |
| 252 } | 252 } |
| 253 | 253 |
| 254 TEST_CASE(JSON_JSONStream_EscapedString) { |
| 255 TextBuffer tb(256); |
| 256 JSONStream js(&tb); |
| 257 js.PrintValue("Hel\"\"lo\r\n\t"); |
| 258 EXPECT_STREQ("\"Hel\\\"\\\"lo\\r\\n\\t\"", tb.buf()); |
| 259 } |
| 260 |
| 254 | 261 |
| 255 } // namespace dart | 262 } // namespace dart |
| OLD | NEW |