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 // Test that parameters keep their names in the output. | 4 // Test that parameters keep their names in the output. |
5 | 5 |
6 import 'package:async_helper/async_helper.dart'; | 6 import 'package:async_helper/async_helper.dart'; |
7 import 'package:expect/expect.dart'; | 7 import 'package:expect/expect.dart'; |
8 import 'compiler_helper.dart'; | 8 import 'compiler_helper.dart'; |
9 | 9 |
10 main() { | 10 main() { |
11 // For a function with only one variable we declare it inline for more | 11 // For a function with only one variable we declare it inline for more |
12 // compactness. Test that we don't also declare it at the start of the | 12 // compactness. Test that we don't also declare it at the start of the |
13 // method. | 13 // method. |
14 asyncTest(() => compile( | 14 asyncTest(() => compile( |
15 'final List a = const ["bar", "baz"];' | 15 'final List a = const ["bar", "baz"];' |
16 'int foo() {' | 16 'int foo() {' |
17 ' for (int i = 0; i < a.length; i++) {' | 17 ' for (int i = 0; i < a.length; i++) {' |
18 ' print(a[i]);' | 18 ' print(a[i]);' |
19 ' }' | 19 ' }' |
20 '}', | 20 '}', |
21 entry: 'foo', minify: false).then((String generated) { | 21 entry: 'foo', |
22 RegExp re = new RegExp(r"var "); | 22 minify: false).then((String generated) { |
23 Expect.isTrue(re.hasMatch(generated)); | 23 RegExp re = new RegExp(r"var "); |
24 print(generated); | 24 Expect.isTrue(re.hasMatch(generated)); |
25 Expect.equals(1, re.allMatches(generated).length); | 25 print(generated); |
26 })); | 26 Expect.equals(1, re.allMatches(generated).length); |
| 27 })); |
27 } | 28 } |
OLD | NEW |