| 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 | 6 |
| 7 #import('dart:json'); | 7 #import('dart:json'); |
| 8 #import('dart:html'); | 8 #import('dart:html'); |
| 9 #import('../../../../lib/unittest/unittest.dart'); | 9 #import('../../lib/unittest/unittest.dart'); |
| 10 #import('../../../../lib/unittest/html_config.dart'); | 10 #import('../../lib/unittest/html_config.dart'); |
| 11 | 11 |
| 12 main() { | 12 main() { |
| 13 useHtmlConfiguration(); | 13 useHtmlConfiguration(); |
| 14 test('Parse', () { | 14 test('Parse', () { |
| 15 // Scalars. | 15 // Scalars. |
| 16 expect(JSON.parse(' 5 ')).equals(5); | 16 expect(JSON.parse(' 5 ')).equals(5); |
| 17 expect(JSON.parse(' -42 ')).equals(-42); | 17 expect(JSON.parse(' -42 ')).equals(-42); |
| 18 expect(JSON.parse(' 3e0 ')).equals(3); | 18 expect(JSON.parse(' 3e0 ')).equals(3); |
| 19 expect(JSON.parse(' 3.14 ')).equals(3.14); | 19 expect(JSON.parse(' 3.14 ')).equals(3.14); |
| 20 expect(JSON.parse('true ')).equals(true); | 20 expect(JSON.parse('true ')).equals(true); |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 | 162 |
| 163 expectIsContained(Map expected, Map actual, | 163 expectIsContained(Map expected, Map actual, |
| 164 [String message = '', bool checkValues = true]) { | 164 [String message = '', bool checkValues = true]) { |
| 165 for (final key in expected.getKeys()) { | 165 for (final key in expected.getKeys()) { |
| 166 expect(actual.containsKey(key)).equals(true); | 166 expect(actual.containsKey(key)).equals(true); |
| 167 if (checkValues) { | 167 if (checkValues) { |
| 168 expectValueEquals(expected[key], actual[key],'at key ${key} ${message}'); | 168 expectValueEquals(expected[key], actual[key],'at key ${key} ${message}'); |
| 169 } | 169 } |
| 170 } | 170 } |
| 171 } | 171 } |
| OLD | NEW |