OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 import "package:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
6 import 'dart:async'; | 6 import 'dart:async'; |
7 import 'dart:convert'; | 7 import 'dart:convert'; |
8 import 'json_unicode_tests.dart'; | 8 import 'json_unicode_tests.dart'; |
9 import '../../async_helper.dart'; | 9 import "package:async_helper/async_helper.dart"; |
10 | 10 |
11 final JSON_UTF8 = JSON.fuse(UTF8); | 11 final JSON_UTF8 = JSON.fuse(UTF8); |
12 | 12 |
13 void expectJsonEquals(o1, o2, [path = "result"]) { | 13 void expectJsonEquals(o1, o2, [path = "result"]) { |
14 if (o1 == o2) return; | 14 if (o1 == o2) return; |
15 if (o1 is List && o2 is List) { | 15 if (o1 is List && o2 is List) { |
16 Expect.equals(o1.length, o2.length, "$path.length"); | 16 Expect.equals(o1.length, o2.length, "$path.length"); |
17 for (int i = 0; i < o1.length; i++) { | 17 for (int i = 0; i < o1.length; i++) { |
18 expectJsonEquals(o1[i], o2[i], "$path[$i]"); | 18 expectJsonEquals(o1[i], o2[i], "$path[$i]"); |
19 } | 19 } |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 var bytes = test[0]; | 71 var bytes = test[0]; |
72 var o = test[1]; | 72 var o = test[1]; |
73 checkIsJsonEqual(o, decode(bytes)); | 73 checkIsJsonEqual(o, decode(bytes)); |
74 checkIsJsonEqual(o, decodeChunked(bytes, 1)); | 74 checkIsJsonEqual(o, decodeChunked(bytes, 1)); |
75 checkIsJsonEqual(o, decodeChunked(bytes, 2)); | 75 checkIsJsonEqual(o, decodeChunked(bytes, 2)); |
76 checkIsJsonEqual(o, decodeChunked(bytes, 3)); | 76 checkIsJsonEqual(o, decodeChunked(bytes, 3)); |
77 checkIsJsonEqual(o, decodeChunked(bytes, 4)); | 77 checkIsJsonEqual(o, decodeChunked(bytes, 4)); |
78 checkIsJsonEqual(o, decodeChunked(bytes, 5)); | 78 checkIsJsonEqual(o, decodeChunked(bytes, 5)); |
79 } | 79 } |
80 } | 80 } |
OLD | NEW |