| 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"; | 8 import "package:expect/expect.dart"; |
| 9 import 'dart:async'; | 9 import 'dart:async'; |
| 10 import "package:async_helper/async_helper.dart"; | 10 import "package:async_helper/async_helper.dart"; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 print('options: $options\n'); | 57 print('options: $options\n'); |
| 58 print('threw:\n $error\n$stack'); | 58 print('threw:\n $error\n$stack'); |
| 59 print('-----------------------------------------------\n\n'); | 59 print('-----------------------------------------------\n\n'); |
| 60 throw error; | 60 throw error; |
| 61 }); | 61 }); |
| 62 } | 62 } |
| 63 | 63 |
| 64 main() { | 64 main() { |
| 65 runCompiler( | 65 runCompiler( |
| 66 "", | 66 "", |
| 67 [], | 67 ['--generate-code-with-compile-time-errors'], |
| 68 (String code, List errors, List warnings) { | 68 (String code, List errors, List warnings) { |
| 69 Expect.isNotNull(code); | 69 Expect.isNotNull(code); |
| 70 Expect.isTrue(errors.isEmpty, 'errors is not empty: $errors'); | 70 Expect.isTrue(errors.isEmpty, 'errors is not empty: $errors'); |
| 71 Expect.equals( | 71 Expect.equals( |
| 72 "${MessageKind.MISSING_MAIN.message({'main': 'main'})}", | 72 "${MessageKind.MISSING_MAIN.message({'main': 'main'})}", |
| 73 warnings.single); | 73 warnings.single); |
| 74 }); | 74 }); |
| 75 | 75 |
| 76 runCompiler( | 76 runCompiler( |
| 77 "main() {}", | 77 "main() {}", |
| 78 [], | 78 ['--generate-code-with-compile-time-errors'], |
| 79 (String code, List errors, List warnings) { | 79 (String code, List errors, List warnings) { |
| 80 Expect.isNotNull(code); | 80 Expect.isNotNull(code); |
| 81 Expect.isTrue(errors.isEmpty); | 81 Expect.isTrue(errors.isEmpty); |
| 82 Expect.isTrue(warnings.isEmpty); | 82 Expect.isTrue(warnings.isEmpty); |
| 83 }); | 83 }); |
| 84 | 84 |
| 85 runCompiler( | 85 runCompiler( |
| 86 "", | 86 "", |
| 87 ['--analyze-only'], | 87 ['--analyze-only'], |
| 88 (String code, List errors, List warnings) { | 88 (String code, List errors, List warnings) { |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 // --analyze-signatures-only implies --analyze-only | 171 // --analyze-signatures-only implies --analyze-only |
| 172 runCompiler( | 172 runCompiler( |
| 173 "", | 173 "", |
| 174 ['--analyze-signatures-only', '--analyze-all'], | 174 ['--analyze-signatures-only', '--analyze-all'], |
| 175 (String code, List errors, List warnings) { | 175 (String code, List errors, List warnings) { |
| 176 Expect.isNull(code); | 176 Expect.isNull(code); |
| 177 Expect.isTrue(errors.isEmpty); | 177 Expect.isTrue(errors.isEmpty); |
| 178 Expect.isTrue(warnings.isEmpty); | 178 Expect.isTrue(warnings.isEmpty); |
| 179 }); | 179 }); |
| 180 } | 180 } |
| OLD | NEW |