| 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 'dart:async'; | 8 import 'dart:async'; |
| 9 import 'dart:uri'; | 9 import 'dart:uri'; |
| 10 | 10 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 }""", | 101 }""", |
| 102 ['--analyze-only'], | 102 ['--analyze-only'], |
| 103 (String code, List errors, List warnings) { | 103 (String code, List errors, List warnings) { |
| 104 Expect.isNull(code); | 104 Expect.isNull(code); |
| 105 Expect.isTrue(errors.isEmpty); | 105 Expect.isTrue(errors.isEmpty); |
| 106 Expect.equals(1, warnings.length); | 106 Expect.equals(1, warnings.length); |
| 107 Expect.equals('Warning: cannot resolve type Foo', warnings[0].toString()); | 107 Expect.equals('Warning: cannot resolve type Foo', warnings[0].toString()); |
| 108 }); | 108 }); |
| 109 | 109 |
| 110 runCompiler( | 110 runCompiler( |
| 111 """main() { |
| 112 Foo foo; // Unresolved and analyzed. |
| 113 }""", |
| 114 ['--analyze-only', '--analyze-signatures-only'], |
| 115 (String code, List errors, List warnings) { |
| 116 Expect.isNull(code); |
| 117 Expect.isTrue(errors.isEmpty); |
| 118 Expect.isTrue(warnings.isEmpty); |
| 119 }); |
| 120 |
| 121 runCompiler( |
| 111 "Foo foo; // Unresolved and analyzed.", | 122 "Foo foo; // Unresolved and analyzed.", |
| 112 ['--analyze-only', '--analyze-all'], | 123 ['--analyze-only', '--analyze-all'], |
| 113 (String code, List errors, List warnings) { | 124 (String code, List errors, List warnings) { |
| 114 Expect.isNull(code); | 125 Expect.isNull(code); |
| 115 Expect.isTrue(errors.isEmpty); | 126 Expect.isTrue(errors.isEmpty); |
| 116 Expect.equals('Warning: cannot resolve type Foo', warnings[0].toString()); | 127 Expect.equals('Warning: cannot resolve type Foo', warnings[0].toString()); |
| 117 }); | 128 }); |
| 118 | 129 |
| 119 runCompiler( | 130 runCompiler( |
| 120 """Foo foo; // Unresolved and analyzed. | 131 """Foo foo; // Unresolved and analyzed. |
| 121 main() {}""", | 132 main() {}""", |
| 122 ['--analyze-only', '--analyze-all'], | 133 ['--analyze-only', '--analyze-all'], |
| 123 (String code, List errors, List warnings) { | 134 (String code, List errors, List warnings) { |
| 124 Expect.isNull(code); | 135 Expect.isNull(code); |
| 125 Expect.isTrue(errors.isEmpty); | 136 Expect.isTrue(errors.isEmpty); |
| 126 Expect.equals(1, warnings.length); | 137 Expect.equals(1, warnings.length); |
| 127 Expect.equals('Warning: cannot resolve type Foo', warnings[0].toString()); | 138 Expect.equals('Warning: cannot resolve type Foo', warnings[0].toString()); |
| 128 }); | 139 }); |
| 140 |
| 141 runCompiler( |
| 142 "", |
| 143 ['--analyze-only', '--analyze-all'], |
| 144 (String code, List errors, List warnings) { |
| 145 Expect.isNull(code); |
| 146 Expect.isTrue(errors.isEmpty); |
| 147 Expect.isTrue(warnings.isEmpty); |
| 148 }); |
| 149 |
| 150 // --analyze-signatures-only implies --analyze-only |
| 151 runCompiler( |
| 152 "", |
| 153 ['--analyze-signatures-only', '--analyze-all'], |
| 154 (String code, List errors, List warnings) { |
| 155 Expect.isNull(code); |
| 156 Expect.isTrue(errors.isEmpty); |
| 157 Expect.isTrue(warnings.isEmpty); |
| 158 }); |
| 129 } | 159 } |
| OLD | NEW |