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 'compiler_helper.dart'; | 6 import 'compiler_helper.dart'; |
6 | 7 |
7 const String TEST_ONE = r""" | 8 const String TEST_ONE = r""" |
8 foo(a) { | 9 foo(a) { |
9 int x = 0; | 10 int x = 0; |
10 for (int i in a) { | 11 for (int i in a) { |
11 x += i; | 12 x += i; |
12 } | 13 } |
13 return x; | 14 return x; |
14 } | 15 } |
15 """; | 16 """; |
16 | 17 |
17 const String TEST_TWO = r""" | 18 const String TEST_TWO = r""" |
18 foo(a) { | 19 foo(a) { |
19 int x = 0; | 20 int x = 0; |
20 for (int i in a) { | 21 for (int i in a) { |
21 if (i == 5) continue; | 22 if (i == 5) continue; |
22 x += i; | 23 x += i; |
23 } | 24 } |
24 return x; | 25 return x; |
25 } | 26 } |
26 """; | 27 """; |
27 | 28 |
28 main() { | 29 main() { |
29 String generated = compile(TEST_ONE, entry: 'foo'); | 30 String generated = compile(TEST_ONE, entry: 'foo'); |
30 Expect.isTrue(!generated.contains(r'break')); | 31 Expect.isTrue(!generated.contains(r'break')); |
31 generated = compile(TEST_TWO, entry: 'foo'); | 32 generated = compile(TEST_TWO, entry: 'foo'); |
32 Expect.isTrue(generated.contains(r'continue')); | 33 Expect.isTrue(generated.contains(r'continue')); |
33 } | 34 } |
OLD | NEW |