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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 forceCompile: checkSdk), | 69 forceCompile: checkSdk), |
70 useColors: false, | 70 useColors: false, |
71 checkSdk: checkSdk, | 71 checkSdk: checkSdk, |
72 runtimeDir: runtimeDir, | 72 runtimeDir: runtimeDir, |
73 inputs: [entryPoint], | 73 inputs: [entryPoint], |
74 inputBaseDir: inputDir); | 74 inputBaseDir: inputDir); |
75 var reporter = createErrorReporter(context, options); | 75 var reporter = createErrorReporter(context, options); |
76 return new BatchCompiler(context, options, reporter: reporter).run(); | 76 return new BatchCompiler(context, options, reporter: reporter).run(); |
77 } | 77 } |
78 | 78 |
79 // Remove old output, and `packages` symlinks which mess up the diff. | |
80 var dir = new Directory(expectDir); | |
81 if (dir.existsSync()) dir.deleteSync(recursive: true); | |
82 var packagesDirs = new Directory(inputDir) | |
83 .listSync(recursive: true) | |
84 .where((d) => d is Directory && path.basename(d.path) == 'packages'); | |
85 packagesDirs.forEach((d) => d.deleteSync()); | |
86 | |
87 { | 79 { |
88 // Expand wacky multitests into a bunch of test files. | 80 // Expand wacky multitests into a bunch of test files. |
89 // We'll compile each one as if it was an input. | 81 // We'll compile each one as if it was an input. |
90 var languageDir = path.join(inputDir, 'language'); | 82 var languageDir = path.join(inputDir, 'language'); |
91 var testFiles = _findTests(languageDir, filePattern); | 83 var testFiles = _findTests(languageDir, filePattern); |
92 | 84 |
93 for (var filePath in testFiles) { | 85 for (var filePath in testFiles) { |
94 if (filePath.endsWith('_multi.dart')) continue; | 86 if (filePath.endsWith('_multi.dart')) continue; |
95 | 87 |
96 var contents = new File(filePath).readAsStringSync(); | 88 var contents = new File(filePath).readAsStringSync(); |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 print('[AnalysisEngine] error $message $exception'); | 235 print('[AnalysisEngine] error $message $exception'); |
244 } | 236 } |
245 | 237 |
246 @override void logError2(String message, Object exception) { | 238 @override void logError2(String message, Object exception) { |
247 print('[AnalysisEngine] error $message $exception'); | 239 print('[AnalysisEngine] error $message $exception'); |
248 } | 240 } |
249 | 241 |
250 void logInformation(String message, [CaughtException exception]) {} | 242 void logInformation(String message, [CaughtException exception]) {} |
251 void logInformation2(String message, Object exception) {} | 243 void logInformation2(String message, Object exception) {} |
252 } | 244 } |
OLD | NEW |