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

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

Issue 9664052: - Fix use of String operator + in language and corelib tests. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 9 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 5311)
+++ tests/corelib/src/RegExpAllMatchesTest.dart (working copy)
@@ -31,22 +31,22 @@
static testForEach() {
var matches = new RegExp("foo").allMatches("foo foo");
- var str = "";
+ var strbuf = new StringBuffer();
matches.forEach((Match m) {
- str += m.group(0);
+ strbuf.add(m.group(0));
});
- Expect.equals("foofoo", str);
+ Expect.equals("foofoo", strbuf.toString());
}
static testMap() {
var matches = new RegExp("foo?").allMatches("foo fo foo fo");
- var mapped = matches.map((Match m) => m.group(0) + "bar");
+ var mapped = matches.map((Match m) => m.group(0).concat("bar"));
kasperl 2012/03/12 06:55:42 I'd suggest using string interpolation here: =
Ivan Posva 2012/04/11 14:26:00 Done.
Expect.equals(4, mapped.length);
- var str = "";
+ var strbuf = new StringBuffer();
for (String s in mapped) {
- str += s;
+ strbuf.add(s);
}
- Expect.equals("foobarfobarfoobarfobar", str);
+ Expect.equals("foobarfobarfoobarfobar", strbuf.toString());
}
static testFilter() {
@@ -55,11 +55,11 @@
return m.group(0) == 'foo';
});
Expect.equals(2, filtered.length);
- var str = "";
+ var strbuf = new StringBuffer();
for (Match m in filtered) {
- str += m.group(0);
+ strbuf.add(m.group(0));
}
- Expect.equals("foofoo", str);
+ Expect.equals("foofoo", strbuf.toString());
}
static testEvery() {
« no previous file with comments | « no previous file | tests/language/src/CallThroughGetterTest.dart » ('j') | tests/language/src/CallThroughGetterTest.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698