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

Side by Side Diff: test/codegen_test.dart

Issue 1378763006: Fix build - create output dir if needed (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 2 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 } 85 }
86 86
87 bool compile(BatchCompiler compiler, String filePath) { 87 bool compile(BatchCompiler compiler, String filePath) {
88 compiler.compileFromUriString(filePath, (String url) { 88 compiler.compileFromUriString(filePath, (String url) {
89 // Write compiler messages to disk. 89 // Write compiler messages to disk.
90 var messagePath = '${path.withoutExtension(url)}.txt'; 90 var messagePath = '${path.withoutExtension(url)}.txt';
91 var file = new File(messagePath); 91 var file = new File(messagePath);
92 var message = ''' 92 var message = '''
93 // Messages from compiling ${path.basenameWithoutExtension(url)}.dart 93 // Messages from compiling ${path.basenameWithoutExtension(url)}.dart
94 $compilerMessages'''; 94 $compilerMessages''';
95 var dir = file.parent;
96 if (!dir.existsSync()) dir.createSync(recursive: true);
95 file.writeAsStringSync(message); 97 file.writeAsStringSync(message);
96 compilerMessages.clear(); 98 compilerMessages.clear();
97 }); 99 });
98 return !compiler.failure; 100 return !compiler.failure;
99 } 101 }
100 102
101 var multitests = new Set<String>(); 103 var multitests = new Set<String>();
102 { 104 {
103 // Expand wacky multitests into a bunch of test files. 105 // Expand wacky multitests into a bunch of test files.
104 // We'll compile each one as if it was an input. 106 // We'll compile each one as if it was an input.
(...skipping 20 matching lines...) Expand all
125 } 127 }
126 } 128 }
127 129
128 var batchCompiler = createCompiler(realSdkContext); 130 var batchCompiler = createCompiler(realSdkContext);
129 131
130 for (var dir in [null, 'language']) { 132 for (var dir in [null, 'language']) {
131 if (codeCoverage && dir == 'language') continue; 133 if (codeCoverage && dir == 'language') continue;
132 134
133 group('dartdevc ' + path.join('test', 'codegen', dir), () { 135 group('dartdevc ' + path.join('test', 'codegen', dir), () {
134 var outDir = new Directory(path.join(expectDir, dir)); 136 var outDir = new Directory(path.join(expectDir, dir));
135 if (!outDir.existsSync()) outDir.createSync(recursive: true); 137 if (!outDir.existsSync()) outDir.createSync(recursive: true);
Jennifer Messerly 2015/10/03 00:23:02 hmm, shouldn't this line do what we need? ideally
136 138
137 var testFiles = _findTests(path.join(inputDir, dir), filePattern); 139 var testFiles = _findTests(path.join(inputDir, dir), filePattern);
138 for (var filePath in testFiles) { 140 for (var filePath in testFiles) {
139 if (multitests.contains(filePath)) continue; 141 if (multitests.contains(filePath)) continue;
140 142
141 var filename = path.basenameWithoutExtension(filePath); 143 var filename = path.basenameWithoutExtension(filePath);
142 144
143 test('$filename.dart', () { 145 test('$filename.dart', () {
144 // TODO(jmesserly): this was added to get some coverage of source maps 146 // TODO(jmesserly): this was added to get some coverage of source maps
145 // and closure annotations. 147 // and closure annotations.
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 print('[AnalysisEngine] error $message $exception'); 243 print('[AnalysisEngine] error $message $exception');
242 } 244 }
243 245
244 @override void logError2(String message, Object exception) { 246 @override void logError2(String message, Object exception) {
245 print('[AnalysisEngine] error $message $exception'); 247 print('[AnalysisEngine] error $message $exception');
246 } 248 }
247 249
248 void logInformation(String message, [CaughtException exception]) {} 250 void logInformation(String message, [CaughtException exception]) {}
249 void logInformation2(String message, Object exception) {} 251 void logInformation2(String message, Object exception) {}
250 } 252 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698