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

Unified Diff: tests/corelib/src/GrowableObjectArrayVMTest.dart

Issue 9114021: Added method map to Collection interface and all its implementations (except classes generated fr... (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 8 years, 11 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 | « runtime/lib/growable_array.dart ('k') | tests/corelib/src/ListTest.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/corelib/src/GrowableObjectArrayVMTest.dart
===================================================================
--- tests/corelib/src/GrowableObjectArrayVMTest.dart (revision 3161)
+++ tests/corelib/src/GrowableObjectArrayVMTest.dart (working copy)
@@ -32,6 +32,27 @@
Expect.equals(-1, array.lastIndexOf(4, 2));
Expect.equals(5, array.length);
+
+ testMap(int n) => n + 2;
+
+ GrowableObjectArray mapped = array.map(testMap);
+
+ Expect.equals(5, mapped.length);
+
+ Expect.equals(3, mapped[0]);
+ Expect.equals(4, mapped[1]);
+ Expect.equals(5, mapped[2]);
+ Expect.equals(6, mapped[3]);
+ Expect.equals(3, mapped[4]);
+
+ Expect.equals(5, array.length);
+
+ Expect.equals(1, array[0]);
+ Expect.equals(2, array[1]);
+ Expect.equals(3, array[2]);
+ Expect.equals(4, array[3]);
+ Expect.equals(1, array[4]);
+
bool found = false;
array = array.filter(bool _(e) {
return found || !(found = (e == 1));
« no previous file with comments | « runtime/lib/growable_array.dart ('k') | tests/corelib/src/ListTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698