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

Unified Diff: tests/corelib/regexp/regexp_kde_test.dart

Issue 2771453003: Format all tests. (Closed)
Patch Set: Format files Created 3 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
Index: tests/corelib/regexp/regexp_kde_test.dart
diff --git a/tests/corelib/regexp/regexp_kde_test.dart b/tests/corelib/regexp/regexp_kde_test.dart
index b4873c47d0250e066e5f447e58c8b32282bc6842..71d5b9c8eaae58cfb380d469f08d29cc47390fdc 100644
--- a/tests/corelib/regexp/regexp_kde_test.dart
+++ b/tests/corelib/regexp/regexp_kde_test.dart
@@ -34,55 +34,84 @@ void main() {
shouldBe(new RegExp(r"(b)c").firstMatch('abcd'), ["bc", "b"]);
- shouldBe(firstMatch('abcdefghi', new RegExp(r"(abc)def(ghi)")), ['abcdefghi', 'abc', 'ghi']);
- shouldBe(new RegExp(r"(abc)def(ghi)").firstMatch('abcdefghi'), ['abcdefghi', 'abc', 'ghi']);
+ shouldBe(firstMatch('abcdefghi', new RegExp(r"(abc)def(ghi)")),
+ ['abcdefghi', 'abc', 'ghi']);
+ shouldBe(new RegExp(r"(abc)def(ghi)").firstMatch('abcdefghi'),
+ ['abcdefghi', 'abc', 'ghi']);
- shouldBe(firstMatch('abcdefghi', new RegExp(r"(a(b(c(d(e)f)g)h)i)")), ['abcdefghi', 'abcdefghi', 'bcdefgh', 'cdefg', 'def', 'e']);
+ shouldBe(firstMatch('abcdefghi', new RegExp(r"(a(b(c(d(e)f)g)h)i)")),
+ ['abcdefghi', 'abcdefghi', 'bcdefgh', 'cdefg', 'def', 'e']);
- shouldBe(firstMatch('(100px 200px 150px 15px)', new RegExp(r"\((\d+)(px)* (\d+)(px)* (\d+)(px)* (\d+)(px)*\)")),
- ['(100px 200px 150px 15px)', '100', 'px', '200', 'px', '150', 'px', '15', 'px']);
- shouldBeNull(firstMatch('', new RegExp(r"\((\d+)(px)* (\d+)(px)* (\d+)(px)* (\d+)(px)*\)")));
+ shouldBe(
+ firstMatch('(100px 200px 150px 15px)',
+ new RegExp(r"\((\d+)(px)* (\d+)(px)* (\d+)(px)* (\d+)(px)*\)")),
+ [
+ '(100px 200px 150px 15px)',
+ '100',
+ 'px',
+ '200',
+ 'px',
+ '150',
+ 'px',
+ '15',
+ 'px'
+ ]);
+ shouldBeNull(firstMatch(
+ '', new RegExp(r"\((\d+)(px)* (\d+)(px)* (\d+)(px)* (\d+)(px)*\)")));
var invalidChars = new RegExp(r"[^@\.\w]"); // #47092
shouldBeTrue(firstMatch('faure@kde.org', invalidChars) == null);
shouldBeFalse(firstMatch('faure-kde@kde.org', invalidChars) == null);
- assertEquals('test1test2'.replaceAll('test','X'),'X1X2');
- assertEquals('test1test2'.replaceAll(new RegExp(r"\d"),'X'),'testXtestX');
- assertEquals('1test2test3'.replaceAll(new RegExp(r"\d"),''),'testtest');
- assertEquals('test1test2'.replaceAll(new RegExp(r"test"),'X'),'X1X2');
- assertEquals('1test2test3'.replaceAll(new RegExp(r"\d"),''),'testtest');
- assertEquals('1test2test3'.replaceAll(new RegExp(r"x"),''),'1test2test3');
- assertEquals('test1test2'.replaceAllMapped(new RegExp(r"(te)(st)"),
- (m) => "${m.group(2)}${m.group(1)}"),'stte1stte2');
- assertEquals('foo+bar'.replaceAll(new RegExp(r"\+"),'%2B'), 'foo%2Bbar');
- var caught = false; try { new RegExp("+"); } catch (e) { caught = true; }
+ assertEquals('test1test2'.replaceAll('test', 'X'), 'X1X2');
+ assertEquals('test1test2'.replaceAll(new RegExp(r"\d"), 'X'), 'testXtestX');
+ assertEquals('1test2test3'.replaceAll(new RegExp(r"\d"), ''), 'testtest');
+ assertEquals('test1test2'.replaceAll(new RegExp(r"test"), 'X'), 'X1X2');
+ assertEquals('1test2test3'.replaceAll(new RegExp(r"\d"), ''), 'testtest');
+ assertEquals('1test2test3'.replaceAll(new RegExp(r"x"), ''), '1test2test3');
+ assertEquals(
+ 'test1test2'.replaceAllMapped(
+ new RegExp(r"(te)(st)"), (m) => "${m.group(2)}${m.group(1)}"),
+ 'stte1stte2');
+ assertEquals('foo+bar'.replaceAll(new RegExp(r"\+"), '%2B'), 'foo%2Bbar');
+ var caught = false;
+ try {
+ new RegExp("+");
+ } catch (e) {
+ caught = true;
+ }
shouldBeTrue(caught); // #40435
- assertEquals('foo'.replaceAll(new RegExp(r"z?"),'x'), 'xfxoxox');
- assertEquals('test test'.replaceAll(new RegExp(r"\s*"),''),'testtest'); // #50985
- assertEquals('abc\$%@'.replaceAll(new RegExp(r"[^0-9a-z]*", caseSensitive: false),''),'abc'); // #50848
- assertEquals('ab'.replaceAll(new RegExp(r"[^\d\.]*", caseSensitive: false),''),''); // #75292
- assertEquals('1ab'.replaceAll(new RegExp(r"[^\d\.]*", caseSensitive: false),''),'1'); // #75292
+ assertEquals('foo'.replaceAll(new RegExp(r"z?"), 'x'), 'xfxoxox');
+ assertEquals(
+ 'test test'.replaceAll(new RegExp(r"\s*"), ''), 'testtest'); // #50985
+ assertEquals(
+ 'abc\$%@'.replaceAll(new RegExp(r"[^0-9a-z]*", caseSensitive: false), ''),
+ 'abc'); // #50848
+ assertEquals(
+ 'ab'.replaceAll(new RegExp(r"[^\d\.]*", caseSensitive: false), ''),
+ ''); // #75292
+ assertEquals(
+ '1ab'.replaceAll(new RegExp(r"[^\d\.]*", caseSensitive: false), ''),
+ '1'); // #75292
- Expect.listEquals('1test2test3blah'.split(new RegExp(r"test")), ['1', '2', '3blah']);
+ Expect.listEquals(
+ '1test2test3blah'.split(new RegExp(r"test")), ['1', '2', '3blah']);
var reg = new RegExp(r"(\d\d )");
var str = '98 76 blah';
- shouldBe(reg.firstMatch(str),['98 ', '98 ']);
+ shouldBe(reg.firstMatch(str), ['98 ', '98 ']);
str = "For more information, see Chapter 3.4.5.1";
var re = new RegExp(r"(chapter \d+(\.\d)*)", caseSensitive: false);
// This returns the array containing Chapter 3.4.5.1,Chapter 3.4.5.1,.1
// 'Chapter 3.4.5.1' is the first match and the first value remembered from (Chapter \d+(\.\d)*).
// '.1' is the second value remembered from (\.\d)
- shouldBe(firstMatch(str, re),['Chapter 3.4.5.1', 'Chapter 3.4.5.1', '.1']);
+ shouldBe(firstMatch(str, re), ['Chapter 3.4.5.1', 'Chapter 3.4.5.1', '.1']);
str = "abcDdcba";
// The returned array contains D, d.
re = new RegExp(r"d", caseSensitive: false);
var matches = re.allMatches(str);
- Expect.listEquals(
- matches.map((m) => m.group(0)).toList(),
- ['D', 'd']);
+ Expect.listEquals(matches.map((m) => m.group(0)).toList(), ['D', 'd']);
// unicode escape sequence
shouldBe(firstMatch('abc', new RegExp(r"\u0062")), ['b']);

Powered by Google App Engine
This is Rietveld 408576698