| Index: tests/corelib/int_parse_radix_test.dart
|
| diff --git a/tests/corelib/int_parse_radix_test.dart b/tests/corelib/int_parse_radix_test.dart
|
| index 120936dce1ec1eb2de6e38112f3573b0cc697e3e..9430e8f434cca540d3d9874fc7941c71e2c21269 100644
|
| --- a/tests/corelib/int_parse_radix_test.dart
|
| +++ b/tests/corelib/int_parse_radix_test.dart
|
| @@ -8,13 +8,22 @@ import "dart:math" show pow;
|
| void main() {
|
| bool checkedMode = false;
|
| assert(checkedMode = true);
|
| - const String oneByteWhiteSpace = "\x09\x0a\x0b\x0c\x0d \x85\xa0";
|
| + const String oneByteWhiteSpace = "\x09\x0a\x0b\x0c\x0d\x20"
|
| + "\x85" /// 01: ok
|
| + "\xa0";
|
| const String whiteSpace = "$oneByteWhiteSpace\u1680\u180e"
|
| "\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a"
|
| "\u2028\u2029\u202f\u205f\u3000\ufeff";
|
|
|
| var digits = "0123456789abcdefghijklmnopqrstuvwxyz";
|
| var zeros = "0" * 64;
|
| +
|
| + for (int i = 0; i < whiteSpace.length; i++) {
|
| + var ws = whiteSpace[i];
|
| + print(ws.codeUnitAt(0).toRadixString(16));
|
| + Expect.equals(0, int.parse("${ws}0${ws}", radix: 2));
|
| + }
|
| +
|
| void testParse(int result, String radixString, int radix) {
|
| var m = "$radixString/$radix->$result";
|
| Expect.equals(result,
|
| @@ -53,20 +62,21 @@ void main() {
|
| }
|
| }
|
|
|
| - for (int i = 2; i <= 36; i++) {
|
| - // Test with bignums.
|
| - var digit = digits[i - 1];
|
| - testParse(pow(i, 64) - 1, digit * 64, i);
|
| - testParse(0, zeros, i);
|
| - }
|
| + for (int i = 2; i <= 36; i++) { /// 02: ok
|
| + // Test with bignums. /// 02: continued
|
| + var digit = digits[i - 1]; /// 02: continued
|
| + testParse(pow(i, 64) - 1, digit * 64, i); /// 02: continued
|
| + testParse(0, zeros, i); /// 02: continued
|
| + } /// 02: continued
|
|
|
| // Allow both upper- and lower-case letters.
|
| Expect.equals(0xABCD, int.parse("ABCD", radix: 16));
|
| Expect.equals(0xABCD, int.parse("abcd", radix: 16));
|
| Expect.equals(15628859, int.parse("09azAZ", radix: 36));
|
| // Big number.
|
| - Expect.equals(0x12345678123456781234567812345678,
|
| - int.parse("0x12345678123456781234567812345678"));
|
| + Expect.equals(0x12345678123456781234567812345678, /// 02: continued
|
| + int.parse("0x1234567812345678" /// 02: continued
|
| + "1234567812345678")); /// 02: continued
|
| // Allow whitespace before and after the number.
|
| Expect.equals(1, int.parse(" 1", radix: 2));
|
| Expect.equals(1, int.parse("1 ", radix: 2));
|
|
|