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 ddc.test.codegen_test; | 8 library ddc.test.codegen_test; |
9 | 9 |
10 import 'dart:io'; | 10 import 'dart:io'; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 var paths = new Directory(inputDir) | 53 var paths = new Directory(inputDir) |
54 .listSync() | 54 .listSync() |
55 .where((f) => f is File) | 55 .where((f) => f is File) |
56 .map((f) => f.path) | 56 .map((f) => f.path) |
57 .where((p) => p.endsWith('.dart') && filePattern.hasMatch(p)); | 57 .where((p) => p.endsWith('.dart') && filePattern.hasMatch(p)); |
58 | 58 |
59 var options = new CompilerOptions( | 59 var options = new CompilerOptions( |
60 outputDir: actualDir, | 60 outputDir: actualDir, |
61 useColors: false, | 61 useColors: false, |
62 outputDart: dartGen, | 62 outputDart: dartGen, |
63 formatOutput: dartGen); | 63 formatOutput: dartGen, |
| 64 emitSourceMaps: false); |
64 var realSdk = new TypeResolver.fromDir(getSdkDir(arguments).path, options); | 65 var realSdk = new TypeResolver.fromDir(getSdkDir(arguments).path, options); |
65 | 66 |
66 // Validate that old output is gone before running. | 67 // Validate that old output is gone before running. |
67 // TODO(jmesserly): it'd be nice to do all cleanup here, including removing | 68 // TODO(jmesserly): it'd be nice to do all cleanup here, including removing |
68 // pub's 'packages' symlinks which mess up the diff. That way this test | 69 // pub's 'packages' symlinks which mess up the diff. That way this test |
69 // can be self contained instead of depending on a shell script. | 70 // can be self contained instead of depending on a shell script. |
70 if (new Directory(actualDir).existsSync()) { | 71 if (new Directory(actualDir).existsSync()) { |
71 throw 'Old compiler output should be cleaned up first. Use ./test/test.sh'; | 72 throw 'Old compiler output should be cleaned up first. Use ./test/test.sh'; |
72 } | 73 } |
73 | 74 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 // Get the test SDK. We use a checked in copy so test expectations can be | 113 // Get the test SDK. We use a checked in copy so test expectations can be |
113 // generated against a specific SDK version. | 114 // generated against a specific SDK version. |
114 // TODO(jmesserly): eventually we should track compiler messages. | 115 // TODO(jmesserly): eventually we should track compiler messages. |
115 // For now we're just trying to get decent code generation. | 116 // For now we're just trying to get decent code generation. |
116 var options = new CompilerOptions( | 117 var options = new CompilerOptions( |
117 outputDir: actualDir, | 118 outputDir: actualDir, |
118 checkSdk: true, | 119 checkSdk: true, |
119 forceCompile: true, | 120 forceCompile: true, |
120 outputDart: dartGen, | 121 outputDart: dartGen, |
121 formatOutput: dartGen, | 122 formatOutput: dartGen, |
122 cheapTestFormat: true); | 123 cheapTestFormat: true, |
| 124 emitSourceMaps: false); |
123 var sdkPath = dartGen | 125 var sdkPath = dartGen |
124 ? path.join(testDir, '..', 'tool', 'input_sdk_src') | 126 ? path.join(testDir, '..', 'tool', 'input_sdk_src') |
125 : path.join(testDir, 'generated_sdk'); | 127 : path.join(testDir, 'generated_sdk'); |
126 var testSdk = new TypeResolver.fromDir(sdkPath, options); | 128 var testSdk = new TypeResolver.fromDir(sdkPath, options); |
127 compile('dart:core', testSdk, options); | 129 compile('dart:core', testSdk, options); |
128 var outputDir = new Directory(path.join(actualDir, 'core')); | 130 var outputDir = new Directory(path.join(actualDir, 'core')); |
129 expect(outputDir.existsSync(), true, | 131 expect(outputDir.existsSync(), true, |
130 reason: '${outputDir.path} was created for dart:core'); | 132 reason: '${outputDir.path} was created for dart:core'); |
131 }); | 133 }); |
132 }); | 134 }); |
(...skipping 23 matching lines...) Expand all Loading... |
156 print('[AnalysisEngine] error $message $exception'); | 158 print('[AnalysisEngine] error $message $exception'); |
157 } | 159 } |
158 | 160 |
159 @override void logError2(String message, Object exception) { | 161 @override void logError2(String message, Object exception) { |
160 print('[AnalysisEngine] error $message $exception'); | 162 print('[AnalysisEngine] error $message $exception'); |
161 } | 163 } |
162 | 164 |
163 void logInformation(String message, [CaughtException exception]) {} | 165 void logInformation(String message, [CaughtException exception]) {} |
164 void logInformation2(String message, Object exception) {} | 166 void logInformation2(String message, Object exception) {} |
165 } | 167 } |
OLD | NEW |