OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 // Smoke test of the dart2js compiler API. | 5 // Smoke test of the dart2js compiler API. |
6 library analyze_only; | 6 library analyze_only; |
7 | 7 |
8 import "package:expect/expect.dart"; | |
9 import 'dart:async'; | 8 import 'dart:async'; |
10 import "package:async_helper/async_helper.dart"; | |
11 | 9 |
12 import '../../utils/dummy_compiler_test.dart' as dummy; | 10 import 'package:async_helper/async_helper.dart'; |
| 11 import 'package:expect/expect.dart'; |
| 12 |
13 import 'package:compiler/compiler_new.dart'; | 13 import 'package:compiler/compiler_new.dart'; |
14 import 'package:compiler/src/options.dart'; | |
15 import 'package:compiler/src/commandline_options.dart'; | 14 import 'package:compiler/src/commandline_options.dart'; |
16 import 'package:compiler/src/diagnostics/messages.dart' | 15 import 'package:compiler/src/diagnostics/messages.dart' |
17 show MessageKind, MessageTemplate; | 16 show MessageKind, MessageTemplate; |
18 import 'package:compiler/src/old_to_new_api.dart'; | 17 import 'package:compiler/src/old_to_new_api.dart'; |
| 18 import 'package:compiler/src/options.dart'; |
19 | 19 |
| 20 import 'dummy_compiler_test.dart' as dummy; |
20 import 'output_collector.dart'; | 21 import 'output_collector.dart'; |
21 | 22 |
22 runCompiler(String main, List<String> options, | 23 runCompiler(String main, List<String> options, |
23 onValue(String code, List errors, List warnings)) { | 24 onValue(String code, List errors, List warnings)) { |
24 List errors = new List(); | 25 List errors = new List(); |
25 List warnings = new List(); | 26 List warnings = new List(); |
26 | 27 |
27 Future<String> localProvider(Uri uri) { | 28 Future<String> localProvider(Uri uri) { |
28 if (uri.scheme != 'main') return dummy.provider(uri); | 29 if (uri.scheme != 'main') return dummy.provider(uri); |
29 return new Future<String>.value(main); | 30 return new Future<String>.value(main); |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 runCompiler( | 183 runCompiler( |
183 """main() {} | 184 """main() {} |
184 foo() native 'foo';""", | 185 foo() native 'foo';""", |
185 [Flags.analyzeOnly], (String code, List errors, List warnings) { | 186 [Flags.analyzeOnly], (String code, List errors, List warnings) { |
186 Expect.isNull(code); | 187 Expect.isNull(code); |
187 Expect.isTrue( | 188 Expect.isTrue( |
188 errors.single.startsWith("'native' modifier is not supported.")); | 189 errors.single.startsWith("'native' modifier is not supported.")); |
189 Expect.isTrue(warnings.isEmpty); | 190 Expect.isTrue(warnings.isEmpty); |
190 }); | 191 }); |
191 } | 192 } |
OLD | NEW |