Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(414)

Unified Diff: tests/corelib/string_fromcharcodes_test.dart

Issue 608213002: Fix bad call of RangeError.value in String.fromCharCodes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/_internal/compiler/js_lib/core_patch.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
}
« no previous file with comments | « sdk/lib/_internal/compiler/js_lib/core_patch.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698