| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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:expect/expect.dart"; | 5 import 'dart:async'; |
| 6 import 'package:expect/expect.dart'; |
| 7 import 'package:async_helper/async_helper.dart'; |
| 6 import 'compiler_helper.dart'; | 8 import 'compiler_helper.dart'; |
| 7 | 9 |
| 8 const String TEST_ONE = r""" | 10 const String TEST_ONE = r""" |
| 9 foo(a) { | 11 foo(a) { |
| 10 int x = 0; | 12 int x = 0; |
| 11 for (int i in a) { | 13 for (int i in a) { |
| 12 x += i; | 14 x += i; |
| 13 } | 15 } |
| 14 return x; | 16 return x; |
| 15 } | 17 } |
| 16 """; | 18 """; |
| 17 | 19 |
| 18 const String TEST_TWO = r""" | 20 const String TEST_TWO = r""" |
| 19 foo(a) { | 21 foo(a) { |
| 20 int x = 0; | 22 int x = 0; |
| 21 for (int i in a) { | 23 for (int i in a) { |
| 22 if (i == 5) continue; | 24 if (i == 5) continue; |
| 23 x += i; | 25 x += i; |
| 24 } | 26 } |
| 25 return x; | 27 return x; |
| 26 } | 28 } |
| 27 """; | 29 """; |
| 28 | 30 |
| 29 main() { | 31 main() { |
| 30 String generated = compile(TEST_ONE, entry: 'foo'); | 32 asyncTest(() => Future.wait([ |
| 31 Expect.isTrue(!generated.contains(r'break')); | 33 compile(TEST_ONE, entry: 'foo', check: (String generated) { |
| 32 generated = compile(TEST_TWO, entry: 'foo'); | 34 Expect.isTrue(!generated.contains(r'break')); |
| 33 Expect.isTrue(generated.contains(r'continue')); | 35 }), |
| 36 compile(TEST_TWO, entry: 'foo', check: (String generated) { |
| 37 Expect.isTrue(generated.contains(r'continue')); |
| 38 }), |
| 39 ])); |
| 34 } | 40 } |
| OLD | NEW |