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

Unified Diff: tests/corelib/src/RegExpAllMatchesTest.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, 12 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/src/RegExpAllMatchesTest.dart
===================================================================
--- tests/corelib/src/RegExpAllMatchesTest.dart (revision 2973)
+++ tests/corelib/src/RegExpAllMatchesTest.dart (working copy)
@@ -38,6 +38,19 @@
Expect.equals("foofoo", str);
}
+ static testMap() {
+ var matches = new RegExp("foo?").allMatches("foo fo foo fo");
+ var mapped = matches.map((Match m) {
sra1 2012/01/05 22:46:49 nit. could use matches.map((Match m) => m.group(0
+ return m.group(0) + "bar";
+ });
+ Expect.equals(4, mapped.length);
+ var str = "";
+ for (String s in mapped) {
+ str += s;
+ }
+ Expect.equals("foobarfobarfoobarfobar", str);
+ }
+
static testFilter() {
var matches = new RegExp("foo?").allMatches("foo fo foo fo");
var filtered = matches.filter((Match m) {
@@ -91,6 +104,7 @@
static testMain() {
testIterator();
testForEach();
+ testMap();
testFilter();
testEvery();
testSome();

Powered by Google App Engine
This is Rietveld 408576698