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