| 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'; |
| 11 import 'package:analyzer/src/generated/engine.dart' | 11 import 'package:analyzer/src/generated/engine.dart' |
| 12 show AnalysisContext, AnalysisEngine, Logger; | 12 show AnalysisContext, AnalysisEngine, Logger; |
| 13 import 'package:analyzer/src/generated/java_engine.dart' show CaughtException; | 13 import 'package:analyzer/src/generated/java_engine.dart' show CaughtException; |
| 14 import 'package:args/args.dart'; | 14 import 'package:args/args.dart'; |
| 15 import 'package:logging/logging.dart' show Level; | 15 import 'package:logging/logging.dart' show Level; |
| 16 import 'package:path/path.dart' as path; | 16 import 'package:path/path.dart' as path; |
| 17 import 'package:test/test.dart'; | 17 import 'package:test/test.dart'; |
| 18 | 18 |
| 19 import 'package:dev_compiler/devc.dart'; | 19 import 'package:dev_compiler/devc.dart'; |
| 20 import 'package:dev_compiler/strong_mode.dart'; | |
| 21 import 'package:dev_compiler/src/compiler.dart' show defaultRuntimeFiles; | 20 import 'package:dev_compiler/src/compiler.dart' show defaultRuntimeFiles; |
| 22 import 'package:dev_compiler/src/options.dart'; | 21 import 'package:dev_compiler/src/options.dart'; |
| 23 | 22 |
| 24 import 'testing.dart' show realSdkContext, testDirectory; | 23 import 'testing.dart' show realSdkContext, testDirectory; |
| 25 import 'multitest.dart'; | 24 import 'multitest.dart'; |
| 26 | 25 |
| 27 final ArgParser argParser = new ArgParser() | 26 final ArgParser argParser = new ArgParser() |
| 28 ..addOption('dart-sdk', help: 'Dart SDK Path', defaultsTo: null); | 27 ..addOption('dart-sdk', help: 'Dart SDK Path', defaultsTo: null); |
| 29 | 28 |
| 30 final inputDir = path.join(testDirectory, 'codegen'); | 29 final inputDir = path.join(testDirectory, 'codegen'); |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 setUp(() { | 176 setUp(() { |
| 178 savedLogger = AnalysisEngine.instance.logger; | 177 savedLogger = AnalysisEngine.instance.logger; |
| 179 AnalysisEngine.instance.logger = new PrintLogger(); | 178 AnalysisEngine.instance.logger = new PrintLogger(); |
| 180 }); | 179 }); |
| 181 tearDown(() { | 180 tearDown(() { |
| 182 AnalysisEngine.instance.logger = savedLogger; | 181 AnalysisEngine.instance.logger = savedLogger; |
| 183 }); | 182 }); |
| 184 | 183 |
| 185 test('devc dart:core', () { | 184 test('devc dart:core', () { |
| 186 var testSdkContext = createAnalysisContextWithSources( | 185 var testSdkContext = createAnalysisContextWithSources( |
| 187 new StrongModeOptions(), | |
| 188 new SourceResolverOptions( | 186 new SourceResolverOptions( |
| 189 dartSdkPath: | 187 dartSdkPath: |
| 190 path.join(testDirectory, '..', 'tool', 'generated_sdk'))); | 188 path.join(testDirectory, '..', 'tool', 'generated_sdk'))); |
| 191 | 189 |
| 192 // Get the test SDK. We use a checked in copy so test expectations can | 190 // Get the test SDK. We use a checked in copy so test expectations can |
| 193 // be generated against a specific SDK version. | 191 // be generated against a specific SDK version. |
| 194 var compiler = createCompiler(testSdkContext, checkSdk: true); | 192 var compiler = createCompiler(testSdkContext, checkSdk: true); |
| 195 compile(compiler, 'dart:core'); | 193 compile(compiler, 'dart:core'); |
| 196 var outFile = new File(path.join(expectDir, 'dart/core.js')); | 194 var outFile = new File(path.join(expectDir, 'dart/core.js')); |
| 197 expect(outFile.existsSync(), true, | 195 expect(outFile.existsSync(), true, |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 print('[AnalysisEngine] error $message $exception'); | 241 print('[AnalysisEngine] error $message $exception'); |
| 244 } | 242 } |
| 245 | 243 |
| 246 @override void logError2(String message, Object exception) { | 244 @override void logError2(String message, Object exception) { |
| 247 print('[AnalysisEngine] error $message $exception'); | 245 print('[AnalysisEngine] error $message $exception'); |
| 248 } | 246 } |
| 249 | 247 |
| 250 void logInformation(String message, [CaughtException exception]) {} | 248 void logInformation(String message, [CaughtException exception]) {} |
| 251 void logInformation2(String message, Object exception) {} | 249 void logInformation2(String message, Object exception) {} |
| 252 } | 250 } |
| OLD | NEW |