OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 // Dart test for testing String.allMatches. | 4 // Dart test for testing String.allMatches. |
5 | 5 |
6 import "package:expect/expect.dart"; | |
7 | |
8 String str = "this is a string with hello here and hello there"; | 6 String str = "this is a string with hello here and hello there"; |
9 | 7 |
10 main() { | 8 main() { |
11 testNoMatch(); | 9 testNoMatch(); |
12 testOneMatch(); | 10 testOneMatch(); |
13 testTwoMatches(); | 11 testTwoMatches(); |
14 testEmptyPattern(); | 12 testEmptyPattern(); |
15 testEmptyString(); | 13 testEmptyString(); |
16 testEmptyPatternAndString(); | 14 testEmptyPatternAndString(); |
17 } | 15 } |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 Iterable<Match> matches = pattern.allMatches(str); | 68 Iterable<Match> matches = pattern.allMatches(str); |
71 Expect.isFalse(matches.iterator.moveNext()); | 69 Expect.isFalse(matches.iterator.moveNext()); |
72 } | 70 } |
73 | 71 |
74 testEmptyPatternAndString() { | 72 testEmptyPatternAndString() { |
75 String pattern = ""; | 73 String pattern = ""; |
76 String str = ""; | 74 String str = ""; |
77 Iterable<Match> matches = pattern.allMatches(str); | 75 Iterable<Match> matches = pattern.allMatches(str); |
78 Expect.isTrue(matches.iterator.moveNext()); | 76 Expect.isTrue(matches.iterator.moveNext()); |
79 } | 77 } |
OLD | NEW |