Index: tests/corelib/string_fromcharcodes_test.dart |
diff --git a/tests/corelib/string_fromcharcodes_test.dart b/tests/corelib/string_fromcharcodes_test.dart |
index 5b33b6569df30d277ea536a9ce034282238ca761..99c4643cac257b42b871191566b6ba90fbe64419 100644 |
--- a/tests/corelib/string_fromcharcodes_test.dart |
+++ b/tests/corelib/string_fromcharcodes_test.dart |
@@ -149,6 +149,11 @@ main() { |
test(tailSurrogate, [0xDBFF, 0xDFFF], 1); |
test("\u{10FFFF}", [0x10FFFF], 0, 1); |
+ void testThrowsRange(iterable, [start = 0, end]) { |
+ Expect.throws(() => new String.fromCharCodes(iterable, start, end), |
+ (e) => e is RangeError); |
+ } |
+ |
// Test varying slices of the code units of a string. |
testSubstring(string) { |
var codes = string.codeUnits; |
@@ -172,13 +177,12 @@ main() { |
} |
} |
- Expect.throws(() => new String.fromCharCodes(iterable, -1)); |
- Expect.throws(() => new String.fromCharCodes(iterable, 0, -1)); |
- Expect.throws(() => new String.fromCharCodes(iterable, 2, 1)); |
- Expect.throws(() => new String.fromCharCodes(iterable, 0, length + 1)); |
- Expect.throws(() => new String.fromCharCodes(iterable, length + 1)); |
- Expect.throws(() => new String.fromCharCodes(iterable, length + 1, |
- length + 2)); |
+ testThrowsRange(iterable, -1); |
+ testThrowsRange(iterable, 0, -1); |
+ testThrowsRange(iterable, 2, 1); |
+ testThrowsRange(iterable, 0, length + 1); |
+ testThrowsRange(iterable, length + 1); |
+ testThrowsRange(iterable, length + 1, length + 2); |
} |
} |