| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 "package:expect/expect.dart"; |
| 6 import "package:async_helper/async_helper.dart"; | 6 import "package:async_helper/async_helper.dart"; |
| 7 import 'compiler_helper.dart'; | 7 import 'compiler_helper.dart'; |
| 8 | 8 |
| 9 String TEST = r''' | 9 String TEST = r''' |
| 10 main() { | 10 main() { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 var a; | 22 var a; |
| 23 for (var i=0; i<10; run(() => i++)) { | 23 for (var i=0; i<10; run(() => i++)) { |
| 24 a = () => i; | 24 a = () => i; |
| 25 } | 25 } |
| 26 print(a()); | 26 print(a()); |
| 27 } | 27 } |
| 28 '''; | 28 '''; |
| 29 | 29 |
| 30 main() { | 30 main() { |
| 31 asyncTest(() => compileAll(TEST).then((generated) { | 31 asyncTest(() => compileAll(TEST).then((generated) { |
| 32 Expect.isTrue(generated.contains('main_closure(i)'), | 32 Expect.isTrue(generated.contains('main_closure(i)'), |
| 33 'for-loop variable was boxed'); | 33 'for-loop variable was boxed'); |
| 34 })); | 34 })); |
| 35 asyncTest(() => compileAll(NEGATIVE_TEST).then((generated) { | 35 asyncTest(() => compileAll(NEGATIVE_TEST).then((generated) { |
| 36 Expect.isFalse(generated.contains('main_closure(i)'), | 36 Expect.isFalse(generated.contains('main_closure(i)'), |
| 37 'for-loop variable was not boxed'); | 37 'for-loop variable was not boxed'); |
| 38 })); | 38 })); |
| 39 } | 39 } |
| OLD | NEW |