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 /// Tests code generation. | 5 /// Tests code generation. |
6 /// Runs Dart Dev Compiler on all input in the `codegen` directory and checks | 6 /// Runs Dart Dev Compiler on all input in the `codegen` directory and checks |
7 /// that the output is what we expected. | 7 /// that the output is what we expected. |
8 library dev_compiler.test.codegen_test; | 8 library dev_compiler.test.codegen_test; |
9 | 9 |
10 import 'dart:io'; | 10 import 'dart:io'; |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 if (multitests.contains(filePath)) continue; | 144 if (multitests.contains(filePath)) continue; |
145 | 145 |
146 var filename = path.basenameWithoutExtension(filePath); | 146 var filename = path.basenameWithoutExtension(filePath); |
147 | 147 |
148 test('$filename.dart', () { | 148 test('$filename.dart', () { |
149 // TODO(jmesserly): this was added to get some coverage of source maps | 149 // TODO(jmesserly): this was added to get some coverage of source maps |
150 // and closure annotations. | 150 // and closure annotations. |
151 // We need a more comprehensive strategy to test them. | 151 // We need a more comprehensive strategy to test them. |
152 var sourceMaps = filename == 'map_keys'; | 152 var sourceMaps = filename == 'map_keys'; |
153 var closure = filename == 'closure'; | 153 var closure = filename == 'closure'; |
154 var moduleFormat = | 154 var moduleFormat = filename == 'es6_modules' |
155 filename == 'es6_modules' ? ModuleFormat.es6 : ModuleFormat.legacy
; | 155 ? ModuleFormat.es6 |
| 156 : filename == 'node_modules' |
| 157 ? ModuleFormat.node |
| 158 : ModuleFormat.legacy; |
156 var success; | 159 var success; |
157 // TODO(vsm): Is it okay to reuse the same context here? If there is | 160 // TODO(vsm): Is it okay to reuse the same context here? If there is |
158 // overlap between test files, we may need separate ones for each | 161 // overlap between test files, we may need separate ones for each |
159 // compiler. | 162 // compiler. |
160 var compiler = | 163 var compiler = |
161 (sourceMaps || closure || moduleFormat != ModuleFormat.legacy) | 164 (sourceMaps || closure || moduleFormat != ModuleFormat.legacy) |
162 ? createCompiler(realSdkContext, | 165 ? createCompiler(realSdkContext, |
163 sourceMaps: sourceMaps, | 166 sourceMaps: sourceMaps, |
164 closure: closure, | 167 closure: closure, |
165 moduleFormat: moduleFormat) | 168 moduleFormat: moduleFormat) |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 print('[AnalysisEngine] error $message $exception'); | 253 print('[AnalysisEngine] error $message $exception'); |
251 } | 254 } |
252 | 255 |
253 @override void logError2(String message, Object exception) { | 256 @override void logError2(String message, Object exception) { |
254 print('[AnalysisEngine] error $message $exception'); | 257 print('[AnalysisEngine] error $message $exception'); |
255 } | 258 } |
256 | 259 |
257 void logInformation(String message, [CaughtException exception]) {} | 260 void logInformation(String message, [CaughtException exception]) {} |
258 void logInformation2(String message, Object exception) {} | 261 void logInformation2(String message, Object exception) {} |
259 } | 262 } |
OLD | NEW |