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

Unified Diff: tests/corelib/list_set_range_test.dart

Issue 13863012: Refactor List.setRange function. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebase Created 7 years, 8 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
Index: tests/corelib/list_set_range_test.dart
diff --git a/tests/corelib/list_set_range_test.dart b/tests/corelib/list_set_range_test.dart
index a693584d324bb1d5806970c222ccf21a0dda934b..da4dda701b7e44d2ec03d565c352c2d7098ca08d 100644
--- a/tests/corelib/list_set_range_test.dart
+++ b/tests/corelib/list_set_range_test.dart
@@ -8,8 +8,8 @@ main() {
var list = [];
list.setRange(0, 0, const []);
list.setRange(0, 0, []);
- list.setRange(0, 0, const [], 1);
- list.setRange(0, 0, [], 1);
+ expectIOORE(() { list.setRange(0, 0, const [], 1); });
+ expectIOORE(() { list.setRange(0, 0, [], 1); });
Expect.equals(0, list.length);
expectIOORE(() { list.setRange(0, 1, []); });
expectIOORE(() { list.setRange(0, 1, [], 1); });
@@ -44,13 +44,13 @@ main() {
list.setRange(0, 4, [1, 2, 3, 4]);
Expect.listEquals([1, 2, 3, 4], list);
- list.setRange(2, 2, [5, 6, 7, 8]);
+ list.setRange(2, 4, [5, 6, 7, 8]);
Expect.listEquals([1, 2, 5, 6], list);
- expectIOORE(() { list.setRange(4, 1, [5, 6, 7, 8]); });
+ expectIOORE(() { list.setRange(4, 5, [5, 6, 7, 8]); });
Expect.listEquals([1, 2, 5, 6], list);
- list.setRange(1, 2, [9, 10, 11, 12]);
+ list.setRange(1, 3, [9, 10, 11, 12]);
Expect.listEquals([1, 9, 10, 6], list);
testNegativeIndices();
@@ -68,18 +68,15 @@ void testNegativeIndices() {
expectIOORE(() { list.setRange(0, 1, [1], -1); });
// A negative length throws an ArgumentError.
- Expect.throws(() { list.setRange(0, -1, [1]); },
- (e) => e is ArgumentError);
+ expectIOORE(() { list.setRange(0, -1, [1]); });
- Expect.throws(() { list.setRange(-1, -1, [1], -1); },
- (e) => e is ArgumentError);
+ expectIOORE(() { list.setRange(-1, -2, [1], -1); });
Expect.listEquals([1, 2], list);
- // A zero length prevails, and does not throw an exception.
- list.setRange(-1, 0, [1]);
+ expectIOORE(() { list.setRange(-1, -1, [1]); });
Expect.listEquals([1, 2], list);
- list.setRange(0, 0, [1], -1);
+ expectIOORE(() { list.setRange(0, 0, [1], -1); });
Expect.listEquals([1, 2], list);
}
@@ -87,6 +84,6 @@ void testNonExtendableList() {
var list = new List<int>(6);
Expect.listEquals([null, null, null, null, null, null], list);
list.setRange(0, 3, [1, 2, 3, 4]);
- list.setRange(3, 3, [1, 2, 3, 4]);
+ list.setRange(3, 6, [1, 2, 3, 4]);
Expect.listEquals([1, 2, 3, 1, 2, 3], list);
}

Powered by Google App Engine
This is Rietveld 408576698