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 library json_test; | 5 library json_test; |
6 | 6 |
7 import "dart:json"; | 7 import "dart:json"; |
8 | 8 |
9 bool badFormat(e) => e is FormatException; | 9 bool badFormat(e) => e is FormatException; |
10 | 10 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 } | 90 } |
91 } | 91 } |
92 } | 92 } |
93 } | 93 } |
94 // Doubles overflow to Infinity. | 94 // Doubles overflow to Infinity. |
95 testJson("1e+400", double.INFINITY); | 95 testJson("1e+400", double.INFINITY); |
96 // (Integers do not, but we don't have those on dart2js). | 96 // (Integers do not, but we don't have those on dart2js). |
97 | 97 |
98 // Integer part cannot be omitted: | 98 // Integer part cannot be omitted: |
99 testError(integers: ""); | 99 testError(integers: ""); |
100 | 100 // Initial zero only allowed for zero integer part. |
101 // Test for "Initial zero only allowed for zero integer part" moved to | 101 testError(integers: ["00", "01"]); |
102 // json_leading_zeros_test.dart because IE's JSON.parse accepts additional | |
103 // initial zeros. | |
104 | |
105 // Only minus allowed as sign. | 102 // Only minus allowed as sign. |
106 testError(signs: "+"); | 103 testError(signs: "+"); |
107 // Requires digits after decimal point. | 104 // Requires digits after decimal point. |
108 testError(fractions: "."); | 105 testError(fractions: "."); |
109 // Requires exponent digts, and only digits. | 106 // Requires exponent digts, and only digits. |
110 testError(exponents: ["e", "e+", "e-", "e.0"]); | 107 testError(exponents: ["e", "e+", "e-", "e.0"]); |
111 | 108 |
112 // No whitespace inside numbers. | 109 // No whitespace inside numbers. |
113 testThrows("- 2.2e+2"); | 110 testThrows("- 2.2e+2"); |
114 testThrows("-2 .2e+2"); | 111 testThrows("-2 .2e+2"); |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 } | 242 } |
246 | 243 |
247 main() { | 244 main() { |
248 testNumbers(); | 245 testNumbers(); |
249 testStrings(); | 246 testStrings(); |
250 testWords(); | 247 testWords(); |
251 testObjects(); | 248 testObjects(); |
252 testArrays(); | 249 testArrays(); |
253 testWhitespace(); | 250 testWhitespace(); |
254 } | 251 } |
OLD | NEW |