Chromium Code Reviews| Index: tests/language/reg_exp_test.dart |
| diff --git a/tests/language/reg_exp_test.dart b/tests/language/reg_exp_test.dart |
| index c51663c3b63bb6224dc9c1b3305637ebc87529af..600b34435d443165a2bebc0951d9036547a3e24f 100644 |
| --- a/tests/language/reg_exp_test.dart |
| +++ b/tests/language/reg_exp_test.dart |
| @@ -21,6 +21,23 @@ void main() { |
| Expect.listEquals(["", "a", "", "", "a", ""], |
| exp.allMatches(str).map((x)=>x[0]).toList()); |
| + // Check that allMatches works with optional start index. |
|
Anders Johnsen
2014/08/11 11:57:01
Should the RegExp '.*' match
regExp.allMatches
Lasse Reichstein Nielsen
2014/08/11 12:35:35
It should. I'll add a test for it.
|
| + exp = new RegExp("as{2}"); |
| + str = "assassin"; |
| + Expect.equals(2, exp.allMatches(str).length); |
| + Expect.equals(2, exp.allMatches(str, 0).length); |
| + Expect.equals(1, exp.allMatches(str, 1).length); |
| + Expect.equals(0, exp.allMatches(str, 4).length); |
| + Expect.equals(0, exp.allMatches(str, str.length).length); |
| + Expect.throws(() => exp.allMatches(str, -1)); |
| + Expect.throws(() => exp.allMatches(str, str.length + 1)); |
| + |
| + // The "^" must only match at the beginning of the string. |
| + // Using a start-index doesn't change where the string starts. |
| + exp = new RegExp("^ass"); |
| + Expect.equals(1, exp.allMatches(str, 0).length); |
| + Expect.equals(0, exp.allMatches(str, 3).length); |
| + |
| // Regression test for http://dartbug.com/2980 |
| exp = new RegExp("^", multiLine: true); // Any zero-length match will work. |
| str = "foo\nbar\nbaz"; |