OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 library json_tests; | 5 library json_tests; |
6 import "package:expect/expect.dart"; | |
7 import 'dart:json' as json; | 6 import 'dart:json' as json; |
8 import 'dart:html'; | 7 import 'dart:html'; |
9 import '../../pkg/unittest/lib/unittest.dart'; | 8 import '../../pkg/unittest/lib/unittest.dart'; |
10 import '../../pkg/unittest/lib/html_config.dart'; | 9 import '../../pkg/unittest/lib/html_config.dart'; |
11 | 10 |
12 main() { | 11 main() { |
13 useHtmlConfiguration(); | 12 useHtmlConfiguration(); |
14 test('Parse', () { | 13 test('Parse', () { |
15 // Scalars. | 14 // Scalars. |
16 expect(json.parse(' 5 '), equals(5)); | 15 expect(json.parse(' 5 '), equals(5)); |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 | 152 |
154 /** | 153 /** |
155 * Checks that the argument can be converted to a JSON string and | 154 * Checks that the argument can be converted to a JSON string and |
156 * back, and produce something equivalent to the argument. | 155 * back, and produce something equivalent to the argument. |
157 */ | 156 */ |
158 validateRoundTrip(expected) { | 157 validateRoundTrip(expected) { |
159 expect(json.parse(json.stringify(expected)), equals(expected)); | 158 expect(json.parse(json.stringify(expected)), equals(expected)); |
160 } | 159 } |
161 | 160 |
162 | 161 |
OLD | NEW |