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

Unified Diff: tests/corelib/string_codeunits_test.dart

Issue 12380086: Implement missing functions on ListBase. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebase after revert. Created 7 years, 10 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 | « tests/corelib/corelib.status ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/corelib/string_codeunits_test.dart
diff --git a/tests/corelib/string_codeunits_test.dart b/tests/corelib/string_codeunits_test.dart
index 6e3a282a3ae20b12d11c780f3917a967a7d78dc4..ac6eb97c5cf0efa8cb9899f913573f679bd112fc 100644
--- a/tests/corelib/string_codeunits_test.dart
+++ b/tests/corelib/string_codeunits_test.dart
@@ -25,8 +25,36 @@ main() {
// .map
Expect.listEquals(expectedUnits.map((x) => x.toRadixString(16)).toList(),
units.map((x) => x.toRadixString(16)).toList());
+
+ if (s == "") {
+ Expect.throws(() => units.first, (e) => e is StateError);
+ Expect.throws(() => units.last, (e) => e is StateError);
+ Expect.throws(() => units[0], (e) => e is RangeError);
+ Expect.throws(() => units[0] = 499, (e) => e is UnsupportedError);
+ Expect.listEquals([], units.getRange(0, 0));
+ Expect.equals(-1, units.indexOf(42));
+ Expect.equals(-1, units.lastIndexOf(499));
+ } else {
+ Expect.equals(s.codeUnitAt(0), units.first);
+ Expect.equals(s.codeUnitAt(s.length - 1), units.last);
+ Expect.equals(s.codeUnitAt(0), units[0]);
+ Expect.throws(() { units[0] = 499; }, (e) => e is UnsupportedError);
+ List<int> sub = units.getRange(1, units.length - 1);
+ Expect.listEquals(s.substring(1, s.length).codeUnits, sub);
+ Expect.equals(-1, units.indexOf(-1));
+ Expect.equals(0, units.indexOf(units[0]));
+ Expect.equals(-1, units.lastIndexOf(-1));
+ Expect.equals(units.length - 1, units.lastIndexOf(units[units.length - 1]));
+ }
+
+ Iterable reversed = units.reversed;
+ int i = units.length - 1;
+ for (int codeUnit in reversed) {
+ Expect.equals(units[i--], codeUnit);
+ }
}
+ test("");
test("abc");
test("\x00\u0000\u{000000}");
test("\u{ffff}\u{10000}\u{10ffff}");
« no previous file with comments | « tests/corelib/corelib.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698