Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(173)

Side by Side Diff: test/codegen_test.dart

Issue 1676463002: Type annotations instead of closure comments. (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 ModuleFormat moduleFormat: ModuleFormat.legacy}) { 71 ModuleFormat moduleFormat: ModuleFormat.legacy}) {
72 // TODO(jmesserly): add a way to specify flags in the test file, so 72 // TODO(jmesserly): add a way to specify flags in the test file, so
73 // they're more self-contained. 73 // they're more self-contained.
74 var runtimeDir = path.join(path.dirname(testDirectory), 'lib', 'runtime'); 74 var runtimeDir = path.join(path.dirname(testDirectory), 'lib', 'runtime');
75 var options = new CompilerOptions( 75 var options = new CompilerOptions(
76 codegenOptions: new CodegenOptions( 76 codegenOptions: new CodegenOptions(
77 outputDir: expectDir, 77 outputDir: expectDir,
78 emitSourceMaps: sourceMaps, 78 emitSourceMaps: sourceMaps,
79 closure: closure, 79 closure: closure,
80 forceCompile: checkSdk, 80 forceCompile: checkSdk,
81 destructureNamedParams: closure,
81 moduleFormat: moduleFormat), 82 moduleFormat: moduleFormat),
82 useColors: false, 83 useColors: false,
83 checkSdk: checkSdk, 84 checkSdk: checkSdk,
84 runtimeDir: runtimeDir, 85 runtimeDir: runtimeDir,
85 inputBaseDir: inputDir); 86 inputBaseDir: inputDir);
86 var reporter = createErrorReporter(context, options); 87 var reporter = createErrorReporter(context, options);
87 return new BatchCompiler(context, options, reporter: reporter); 88 return new BatchCompiler(context, options, reporter: reporter);
88 } 89 }
89 90
90 bool compile(BatchCompiler compiler, String filePath) { 91 bool compile(BatchCompiler compiler, String filePath) {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 var outDir = new Directory(path.join(expectDir, dir)); 140 var outDir = new Directory(path.join(expectDir, dir));
140 if (!outDir.existsSync()) outDir.createSync(recursive: true); 141 if (!outDir.existsSync()) outDir.createSync(recursive: true);
141 142
142 var testFiles = _findTests(path.join(inputDir, dir), filePattern); 143 var testFiles = _findTests(path.join(inputDir, dir), filePattern);
143 for (var filePath in testFiles) { 144 for (var filePath in testFiles) {
144 if (multitests.contains(filePath)) continue; 145 if (multitests.contains(filePath)) continue;
145 146
146 var filename = path.basenameWithoutExtension(filePath); 147 var filename = path.basenameWithoutExtension(filePath);
147 148
148 test('$filename.dart', () { 149 test('$filename.dart', () {
149 // TODO(jmesserly): this was added to get some coverage of source maps 150 // TODO(jmesserly): this was added to get some coverage of source maps
Jennifer Messerly 2016/02/09 16:41:58 This TODO is getting more relevant over time eh? :
ochafik 2016/02/10 18:12:46 Yes please, would be awesome! (sorry for letting t
150 // and closure annotations. 151 // and closure annotations.
151 // We need a more comprehensive strategy to test them. 152 // We need a more comprehensive strategy to test them.
152 var sourceMaps = filename == 'map_keys'; 153 var sourceMaps = filename == 'map_keys';
153 var closure = filename == 'closure'; 154 var closure = filename == 'closure';
154 var moduleFormat = filename == 'es6_modules' 155 var moduleFormat = filename == 'es6_modules' || closure
155 ? ModuleFormat.es6 156 ? ModuleFormat.es6
156 : filename == 'node_modules' 157 : filename == 'node_modules'
157 ? ModuleFormat.node 158 ? ModuleFormat.node
158 : ModuleFormat.legacy; 159 : ModuleFormat.legacy;
159 var success; 160 var success;
160 // TODO(vsm): Is it okay to reuse the same context here? If there is 161 // TODO(vsm): Is it okay to reuse the same context here? If there is
161 // overlap between test files, we may need separate ones for each 162 // overlap between test files, we may need separate ones for each
162 // compiler. 163 // compiler.
163 var compiler = 164 var compiler =
164 (sourceMaps || closure || moduleFormat != ModuleFormat.legacy) 165 (sourceMaps || closure || moduleFormat != ModuleFormat.legacy)
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 250
250 /// An implementation of analysis engine's [Logger] that prints. 251 /// An implementation of analysis engine's [Logger] that prints.
251 class PrintLogger implements Logger { 252 class PrintLogger implements Logger {
252 @override void logError(String message, [CaughtException exception]) { 253 @override void logError(String message, [CaughtException exception]) {
253 print('[AnalysisEngine] error $message $exception'); 254 print('[AnalysisEngine] error $message $exception');
254 } 255 }
255 256
256 void logInformation(String message, [CaughtException exception]) {} 257 void logInformation(String message, [CaughtException exception]) {}
257 void logInformation2(String message, Object exception) {} 258 void logInformation2(String message, Object exception) {}
258 } 259 }
OLDNEW
« test/codegen/expect/closure.js ('K') | « test/codegen/expect/map_keys.js.map ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698