| 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 "package:expect/expect.dart"; | 7 import "package:expect/expect.dart"; |
| 8 import "dart:json"; | 8 import "dart:json"; |
| 9 | 9 |
| 10 bool badFormat(e) => e is FormatException; | 10 bool badFormat(e) => e is FormatException; |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 } | 108 } |
| 109 } | 109 } |
| 110 // Doubles overflow to Infinity. | 110 // Doubles overflow to Infinity. |
| 111 testJson("1e+400", double.INFINITY); | 111 testJson("1e+400", double.INFINITY); |
| 112 // (Integers do not, but we don't have those on dart2js). | 112 // (Integers do not, but we don't have those on dart2js). |
| 113 | 113 |
| 114 // Integer part cannot be omitted: | 114 // Integer part cannot be omitted: |
| 115 testError(integers: ""); | 115 testError(integers: ""); |
| 116 | 116 |
| 117 // Test for "Initial zero only allowed for zero integer part" moved to | 117 // Test for "Initial zero only allowed for zero integer part" moved to |
| 118 // json_strict_test.dart because IE's JSON.parse accepts additional initial | 118 // json_strict_test.dart because IE's JSON.decode accepts additional initial |
| 119 // zeros. | 119 // zeros. |
| 120 | 120 |
| 121 // Only minus allowed as sign. | 121 // Only minus allowed as sign. |
| 122 testError(signs: "+"); | 122 testError(signs: "+"); |
| 123 // Requires digits after decimal point. | 123 // Requires digits after decimal point. |
| 124 testError(fractions: "."); | 124 testError(fractions: "."); |
| 125 // Requires exponent digts, and only digits. | 125 // Requires exponent digts, and only digits. |
| 126 testError(exponents: ["e", "e+", "e-", "e.0"]); | 126 testError(exponents: ["e", "e+", "e-", "e.0"]); |
| 127 | 127 |
| 128 // No whitespace inside numbers. | 128 // No whitespace inside numbers. |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 } | 260 } |
| 261 | 261 |
| 262 main() { | 262 main() { |
| 263 testNumbers(); | 263 testNumbers(); |
| 264 testStrings(); | 264 testStrings(); |
| 265 testWords(); | 265 testWords(); |
| 266 testObjects(); | 266 testObjects(); |
| 267 testArrays(); | 267 testArrays(); |
| 268 testWhitespace(); | 268 testWhitespace(); |
| 269 } | 269 } |
| OLD | NEW |