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 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |
OLD | NEW |