| 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 import "package:expect/expect.dart"; |
| 6 |
| 5 void main() { | 7 void main() { |
| 6 bool checkedMode = false; | 8 bool checkedMode = false; |
| 7 assert(checkedMode = true); | 9 assert(checkedMode = true); |
| 8 | 10 |
| 9 for (int i = 0; i < 36 * 36 + 1; i++) { | 11 for (int i = 0; i < 36 * 36 + 1; i++) { |
| 10 for (int r = 2; r <= 36; r++) { | 12 for (int r = 2; r <= 36; r++) { |
| 11 String radixString = i.toRadixString(r); | 13 String radixString = i.toRadixString(r); |
| 12 Expect.equals(i, int.parse(radixString, radix: r), ""); | 14 Expect.equals(i, int.parse(radixString, radix: r), ""); |
| 13 Expect.equals(i, int.parse(" $radixString", radix: r), ""); | 15 Expect.equals(i, int.parse(" $radixString", radix: r), ""); |
| 14 Expect.equals(i, int.parse("$radixString ", radix: r), ""); | 16 Expect.equals(i, int.parse("$radixString ", radix: r), ""); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 testBadArguments("0", 0); | 81 testBadArguments("0", 0); |
| 80 testBadArguments("0", 1); | 82 testBadArguments("0", 1); |
| 81 testBadArguments("0", 37); | 83 testBadArguments("0", 37); |
| 82 | 84 |
| 83 // If handleError isn't an unary function, and it's called, it also throws | 85 // If handleError isn't an unary function, and it's called, it also throws |
| 84 // (either TypeError in checked mode, or some failure in unchecked mode). | 86 // (either TypeError in checked mode, or some failure in unchecked mode). |
| 85 Expect.throws(() => int.parse("9", radix: 8, onError: "not a function")); | 87 Expect.throws(() => int.parse("9", radix: 8, onError: "not a function")); |
| 86 Expect.throws(() => int.parse("9", radix: 8, onError: () => 42)); | 88 Expect.throws(() => int.parse("9", radix: 8, onError: () => 42)); |
| 87 Expect.throws(() => int.parse("9", radix: 8, onError: (v1, v2) => 42)); | 89 Expect.throws(() => int.parse("9", radix: 8, onError: (v1, v2) => 42)); |
| 88 } | 90 } |
| OLD | NEW |