| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 | 4 |
| 5 import 'package:test/test.dart'; | 5 import 'package:test/test.dart'; |
| 6 | 6 |
| 7 import 'helper.dart' show check; | 7 import 'helper.dart' show check; |
| 8 | 8 |
| 9 main() { | 9 main() { |
| 10 test('for loop', () { | 10 test('for loop', () { |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 var a = 0; | 77 var a = 0; |
| 78 main() { | 78 main() { |
| 79 var sum = 0; | 79 var sum = 0; |
| 80 for (a in [1, 2, 3]) { | 80 for (a in [1, 2, 3]) { |
| 81 sum += a; | 81 sum += a; |
| 82 } | 82 } |
| 83 return sum; | 83 return sum; |
| 84 }'''; | 84 }'''; |
| 85 return check(code, disableTypeInference: false); | 85 return check(code, disableTypeInference: false); |
| 86 }); | 86 }); |
| 87 |
| 88 test('for loop with break to label', () { |
| 89 String code = ''' |
| 90 var a = 0; |
| 91 main() { |
| 92 var sum = 0; |
| 93 outer: for (a in [1, 2, 3]) { |
| 94 for (int i = 0; i < 10; i++) { |
| 95 sum += a; |
| 96 if (a + i < 5) |
| 97 break outer; |
| 98 } |
| 99 } |
| 100 return sum; |
| 101 }'''; |
| 102 return check(code, disableTypeInference: false); |
| 103 }); |
| 87 } | 104 } |
| OLD | NEW |