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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 setUp(() { | 200 setUp(() { |
201 savedLogger = AnalysisEngine.instance.logger; | 201 savedLogger = AnalysisEngine.instance.logger; |
202 AnalysisEngine.instance.logger = new PrintLogger(); | 202 AnalysisEngine.instance.logger = new PrintLogger(); |
203 }); | 203 }); |
204 tearDown(() { | 204 tearDown(() { |
205 AnalysisEngine.instance.logger = savedLogger; | 205 AnalysisEngine.instance.logger = savedLogger; |
206 }); | 206 }); |
207 | 207 |
208 test('devc dart:core', () { | 208 test('devc dart:core', () { |
209 var testSdkContext = createAnalysisContextWithSources( | 209 var testSdkContext = createAnalysisContextWithSources( |
210 new SourceResolverOptions( | 210 new SourceResolverOptions(dartSdkPath: path.join( |
211 dartSdkPath: | 211 testDirectory, '..', 'tool', 'generated_sdk'))); |
212 path.join(testDirectory, '..', 'tool', 'generated_sdk'))); | |
213 | 212 |
214 // Get the test SDK. We use a checked in copy so test expectations can | 213 // Get the test SDK. We use a checked in copy so test expectations can |
215 // be generated against a specific SDK version. | 214 // be generated against a specific SDK version. |
216 var compiler = createCompiler(testSdkContext, checkSdk: true); | 215 var compiler = createCompiler(testSdkContext, checkSdk: true); |
217 compile(compiler, 'dart:core'); | 216 compile(compiler, 'dart:core'); |
218 var outFile = new File(path.join(expectDir, 'dart/core.js')); | 217 var outFile = new File(path.join(expectDir, 'dart/core.js')); |
219 expect(outFile.existsSync(), true, | 218 expect(outFile.existsSync(), true, |
220 reason: '${outFile.path} was created for dart:core'); | 219 reason: '${outFile.path} was created for dart:core'); |
221 }); | 220 }); |
222 }); | 221 }); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 for (var filepath in expectedFiles) { | 253 for (var filepath in expectedFiles) { |
255 var outFile = new File(path.join(expectDir, filepath)); | 254 var outFile = new File(path.join(expectDir, filepath)); |
256 expect(outFile.existsSync(), success, | 255 expect(outFile.existsSync(), success, |
257 reason: '${outFile.path} was created iff compilation succeeds'); | 256 reason: '${outFile.path} was created iff compilation succeeds'); |
258 } | 257 } |
259 }); | 258 }); |
260 } | 259 } |
261 | 260 |
262 /// An implementation of analysis engine's [Logger] that prints. | 261 /// An implementation of analysis engine's [Logger] that prints. |
263 class PrintLogger implements Logger { | 262 class PrintLogger implements Logger { |
264 @override void logError(String message, [CaughtException exception]) { | 263 @override |
| 264 void logError(String message, [CaughtException exception]) { |
265 print('[AnalysisEngine] error $message $exception'); | 265 print('[AnalysisEngine] error $message $exception'); |
266 } | 266 } |
267 | 267 |
268 void logInformation(String message, [CaughtException exception]) {} | 268 void logInformation(String message, [CaughtException exception]) {} |
269 void logInformation2(String message, Object exception) {} | 269 void logInformation2(String message, Object exception) {} |
270 } | 270 } |
OLD | NEW |