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

Unified Diff: tests/corelib/collection_removes_test.dart

Issue 14048002: Make the analyzer happy about collections. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Reupload. 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 | « sdk/lib/core/list.dart ('k') | tests/corelib/list_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/corelib/collection_removes_test.dart
diff --git a/tests/corelib/collection_removes_test.dart b/tests/corelib/collection_removes_test.dart
index c22ad21848b4a18560f0555b6c6f79a7c8c3d314..ade1509c02e6d2bc6f1e7a2cf79c9ca5a9a4abaa 100644
--- a/tests/corelib/collection_removes_test.dart
+++ b/tests/corelib/collection_removes_test.dart
@@ -2,6 +2,7 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+import "dart:collection";
import "package:expect/expect.dart";
testRemove(Collection base) {
@@ -106,7 +107,25 @@ void main() {
testRetainAll(base.toSet(), deltaSet);
testRemoveWhere(base.toSet(), deltaSet.contains);
testRetainWhere(base.toSet(), (e) => !deltaSet.contains(e));
+
+ // Test the ListBase class's List implementation.
+ testRemoveAll(new MyList(base.toList()), delta);
+ testRemoveAll(new MyList(base.toList()), deltaSet);
+ testRetainAll(new MyList(base.toList()), delta);
+ testRetainAll(new MyList(base.toList()), deltaSet);
+ testRemoveWhere(new MyList(base.toList()), deltaSet.contains);
+ testRetainWhere(new MyList(base.toList()),
+ (e) => !deltaSet.contains(e));
+
}
}
}
+class MyList<E> extends ListBase<E> {
+ List<E> _source;
+ MyList(this._source);
+ int get length => _source.length;
+ void set length(int length) { _source.length = length; }
+ E operator[](int index) => _source[index];
+ void operator[]=(int index, E value) { _source[index] = value; }
+}
« no previous file with comments | « sdk/lib/core/list.dart ('k') | tests/corelib/list_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698