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

Unified Diff: tests/corelib/list_removeat_test.dart

Issue 13877006: Add missing functions to ListMixin. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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
« no previous file with comments | « tests/corelib/list_insert_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/corelib/list_removeat_test.dart
diff --git a/tests/corelib/list_removeat_test.dart b/tests/corelib/list_removeat_test.dart
index d8dbf880a0562930dcb8e20a5ced734ad18fb388..d9c745367dfccdd9db173e1c82b191441647a66f 100644
--- a/tests/corelib/list_removeat_test.dart
+++ b/tests/corelib/list_removeat_test.dart
@@ -3,11 +3,23 @@
// BSD-style license that can be found in the LICENSE file.
import "package:expect/expect.dart";
+import 'dart:collection';
-void main() {
- // Normal modifiable list.
- var l1 = [0, 1, 2, 3, 4];
+class MyList extends ListBase {
+ List list;
+ MyList(this.list);
+
+ get length => list.length;
+ set length(val) { list.length = val; }
+
+ operator [](index) => list[index];
+ operator []=(index, val) => list[index] = val;
+
+ String toString() => "[" + join(", ") + "]";
+}
+// l1 must be a modifiable list with 5 elements from 0 to 4.
+void testModifiableList(l1) {
bool checkedMode = false;
assert(checkedMode = true);
@@ -42,6 +54,12 @@ void main() {
Expect.equals(3, l1[1], "l1-2[1]");
Expect.equals(4, l1[2], "l1-2[2]");
Expect.equals(3, l1.length, "length-2");
+}
+
+void main() {
+ // Normal modifiable list.
+ testModifiableList([0, 1, 2, 3, 4]);
+ testModifiableList(new MyList([0, 1, 2, 3, 4]));
// Fixed size list.
var l2 = new List(5);
« no previous file with comments | « tests/corelib/list_insert_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698