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

Unified Diff: tests/corelib/string_fromcharcodes_test.dart

Issue 605213002: Change restrictions on start/end on String.fromCharCodes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address commments. 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/core/string.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 1897453674b86ac1acfc8aca28e5f59467c648e8..5b33b6569df30d277ea536a9ce034282238ca761 100644
--- a/tests/corelib/string_fromcharcodes_test.dart
+++ b/tests/corelib/string_fromcharcodes_test.dart
@@ -104,7 +104,7 @@ main() {
testThrows([-1]);
testThrows(new List(1)..[0] = -1);
testThrows(const [-1]);
- //testThrows(new Int8List(1)..[0] = -1);
+ testThrows(new Int8List(1)..[0] = -1);
testThrows(new Int16List(1)..[0] = -1);
testThrows(new Int32List(1)..[0] = -1);
testThrows([0x110000]);
@@ -130,28 +130,19 @@ main() {
test("BCDEFGH", iterable, 1);
test("H", iterable, 7);
test("", iterable, 8);
- test("", iterable, 9);
// start = 0, end varies.
test("ABCDEFGH", iterable, 0);
test("A", iterable, 0, 1);
test("AB", iterable, 0, 2);
test("ABCDEFG", iterable, 0, 7);
test("ABCDEFGH", iterable, 0, 8);
- test("ABCDEFGH", iterable, 0, 9);
test("", iterable, 0, 0);
- test("", iterable, 0, -1);
// Both varying.
test("ABCDEFGH", iterable, 0, 8);
- test("ABCDEFGH", iterable, 0, 9);
test("AB", iterable, 0, 2);
test("GH", iterable, 6, 8);
test("DE", iterable, 3, 5);
test("", iterable, 3, 3);
- test("", iterable, 5, 3);
- test("", iterable, 4, -1);
- test("", iterable, 8, -1);
- test("", iterable, 0, -1);
- test("", iterable, 9, 9);
}
// Can split surrogates in input, but not a single big code point.
test(leadSurrogate, [0xDBFF, 0xDFFF], 0, 1);
@@ -180,7 +171,14 @@ main() {
test(string.substring(i, i + j), iterable, i, i + j);
}
}
- Expect.equals(string, new String.fromCharCodes(iterable, 0, length + 1));
+
+ 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));
}
}
« no previous file with comments | « sdk/lib/core/string.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698