| Index: tests/compiler/dart2js/gvn_test.dart
|
| ===================================================================
|
| --- tests/compiler/dart2js/gvn_test.dart (revision 17440)
|
| +++ tests/compiler/dart2js/gvn_test.dart (working copy)
|
| @@ -13,10 +13,21 @@
|
| }
|
| """;
|
|
|
| +// Check that modulo does not have any side effect and we are
|
| +// GVN'ing the length of [:list:].
|
| +const String TEST_TWO = r"""
|
| +void foo(a) {
|
| + var list = new List<int>();
|
| + list[0] = list[0 % a];
|
| + list[1] = list[1 % a];
|
| +}
|
| +""";
|
| +
|
| main() {
|
| String generated = compile(TEST_ONE, entry: 'foo');
|
| RegExp regexp = new RegExp(r"1 \+ [a-z]+");
|
| - Iterator matches = regexp.allMatches(generated).iterator;
|
| - Expect.isTrue(matches.moveNext());
|
| - Expect.isFalse(matches.moveNext());
|
| + checkNumberOfMatches(regexp.allMatches(generated).iterator, 1);
|
| +
|
| + generated = compile(TEST_TWO, entry: 'foo');
|
| + checkNumberOfMatches(new RegExp("length").allMatches(generated).iterator, 1);
|
| }
|
|
|