| Index: tests/corelib/integer_to_radix_string_test.dart
|
| diff --git a/tests/corelib/integer_to_radix_string_test.dart b/tests/corelib/integer_to_radix_string_test.dart
|
| index 35454bfde973d7ce67e3dd6e879076792c5e7f8c..24343931f7c8c1193cb4686c8b7cb5b90c7fed5e 100644
|
| --- a/tests/corelib/integer_to_radix_string_test.dart
|
| +++ b/tests/corelib/integer_to_radix_string_test.dart
|
| @@ -3,6 +3,25 @@
|
| // BSD-style license that can be found in the LICENSE file.
|
|
|
| main() {
|
| - // Just make sure that we use lower-case characters.
|
| - Expect.equals("abcd", (0xabcd).toRadixString(16));
|
| -}
|
| + // Test that we accept radix 2 to 36 and that we use lower-case
|
| + // letters.
|
| + var expected = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
|
| + 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j',
|
| + 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
|
| + 'u', 'v', 'w', 'x', 'y', 'z'];
|
| + for (var radix = 2; radix < 37; radix++) {
|
| + for (var i = 0; i < radix; i++) {
|
| + Expect.equals(expected[i], i.toRadixString(radix));
|
| + }
|
| + }
|
| +
|
| + var illegalRadices = [ -1, 0, 1, 37 ];
|
| + for (var radix in illegalRadices) {
|
| + try {
|
| + 42.toRadixString(radix);
|
| + Expect.fail("Exception expected");
|
| + } on IllegalArgumentException catch (e) {
|
| + // Nothing to do.
|
| + }
|
| + }
|
| +}
|
|
|