Big merge from experimental to bleeding edge.
Review URL: https://codereview.chromium.org//11783009 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@16687 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
@@ -18,15 +18,16 @@ testNoMatch() {
|
||||
// Also tests that RegExp groups don't work.
|
||||
String helloPattern = "with (hello)";
|
||||
Iterable<Match> matches = helloPattern.allMatches(str);
|
||||
Expect.isFalse(matches.iterator().hasNext);
|
||||
Expect.isFalse(matches.iterator.moveNext());
|
||||
}
|
||||
|
||||
testOneMatch() {
|
||||
String helloPattern = "with hello";
|
||||
Iterable<Match> matches = helloPattern.allMatches(str);
|
||||
var iterator = matches.iterator();
|
||||
Match match = iterator.next();
|
||||
Expect.isFalse(iterator.hasNext);
|
||||
var iterator = matches.iterator;
|
||||
Expect.isTrue(iterator.moveNext());
|
||||
Match match = iterator.current;
|
||||
Expect.isFalse(iterator.moveNext());
|
||||
Expect.equals(str.indexOf('with', 0), match.start);
|
||||
Expect.equals(str.indexOf('with', 0) + helloPattern.length, match.end);
|
||||
Expect.equals(helloPattern, match.pattern);
|
||||
@@ -58,19 +59,19 @@ testTwoMatches() {
|
||||
testEmptyPattern() {
|
||||
String pattern = "";
|
||||
Iterable<Match> matches = pattern.allMatches(str);
|
||||
Expect.isTrue(matches.iterator().hasNext);
|
||||
Expect.isTrue(matches.iterator.moveNext());
|
||||
}
|
||||
|
||||
testEmptyString() {
|
||||
String pattern = "foo";
|
||||
String str = "";
|
||||
Iterable<Match> matches = pattern.allMatches(str);
|
||||
Expect.isFalse(matches.iterator().hasNext);
|
||||
Expect.isFalse(matches.iterator.moveNext());
|
||||
}
|
||||
|
||||
testEmptyPatternAndString() {
|
||||
String pattern = "";
|
||||
String str = "";
|
||||
Iterable<Match> matches = pattern.allMatches(str);
|
||||
Expect.isTrue(matches.iterator().hasNext);
|
||||
Expect.isTrue(matches.iterator.moveNext());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user