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

Side by Side Diff: test/codegen_test.dart

Issue 985933004: Do cleanup instead of excluding runtime files in diff (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 9 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 | « .gitignore ('k') | test/test.sh » ('j') | 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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 var filePath = path.join(inputDir, 'html_input.html'); 144 var filePath = path.join(inputDir, 'html_input.html');
145 compilerMessages.writeln('// Messages from compiling html_input.html'); 145 compilerMessages.writeln('// Messages from compiling html_input.html');
146 146
147 var result = compile(filePath, realSdk); 147 var result = compile(filePath, realSdk);
148 var success = !result.failure; 148 var success = !result.failure;
149 149
150 // Write compiler messages to disk. 150 // Write compiler messages to disk.
151 new File(path.join(actualDir, 'html_input.txt')) 151 new File(path.join(actualDir, 'html_input.txt'))
152 .writeAsStringSync(compilerMessages.toString()); 152 .writeAsStringSync(compilerMessages.toString());
153 153
154 var outFile = new File(path.join(actualDir, 'html_input.html')); 154 var expectedFiles = [
155 expect(outFile.existsSync(), success, 155 'html_input.html',
156 reason: '${outFile.path} was created iff compilation succeeds'); 156 'dir/html_input_a.js',
157 'dir/html_input_b.js',
158 'dir/html_input_c.js',
159 'dir/html_input_d.js',
160 'dir/html_input_e.js',
161 'dev_compiler/runtime/dart_core.js',
162 'dev_compiler/runtime/dart_runtime.js',
163 'dev_compiler/runtime/harmony_feature_check.js',
164 ];
165 for (var filepath in expectedFiles) {
166 var outFile = new File(path.join(actualDir, filepath));
167 expect(outFile.existsSync(), success,
168 reason: '${outFile.path} was created iff compilation succeeds');
169 }
170
171 var notExpectedFiles = [
172 'dev_compiler/runtime/messages_widget.js',
173 'dev_compiler/runtime/messages.css'
174 ];
175 for (var filepath in notExpectedFiles) {
176 var outFile = new File(path.join(actualDir, filepath));
177 expect(outFile.existsSync(), isFalse,
178 reason: '${outFile.path} should only be generated in server mode');
179 }
157 }); 180 });
158 181
159 test('devc jscodegen html_input.html server mode', () { 182 test('devc jscodegen html_input.html server mode', () {
160 var filePath = path.join(inputDir, 'html_input.html'); 183 var filePath = path.join(inputDir, 'html_input.html');
161 compilerMessages.writeln('// Messages from compiling html_input.html'); 184 compilerMessages.writeln('// Messages from compiling html_input.html');
162 185
163 var result = compile(filePath, realSdk, serverMode: true); 186 var result = compile(filePath, realSdk, serverMode: true);
164 var success = !result.failure; 187 var success = !result.failure;
165 188
166 // Write compiler messages to disk. 189 // Write compiler messages to disk.
167 new File(path.join(actualDir, 'server_mode', 'html_input.txt')) 190 new File(path.join(actualDir, 'server_mode', 'html_input.txt'))
168 .writeAsStringSync(compilerMessages.toString()); 191 .writeAsStringSync(compilerMessages.toString());
169 192
170 var outFile = 193 var expectedFiles = [
171 new File(path.join(actualDir, 'server_mode', 'html_input.html')); 194 'html_input.html',
172 expect(outFile.existsSync(), success, 195 'dir/html_input_a.js',
173 reason: '${outFile.path} was created iff compilation succeeds'); 196 'dir/html_input_b.js',
197 'dir/html_input_c.js',
198 'dir/html_input_d.js',
199 'dir/html_input_e.js',
200 'dev_compiler/runtime/dart_core.js',
201 'dev_compiler/runtime/dart_runtime.js',
202 'dev_compiler/runtime/harmony_feature_check.js',
203 'dev_compiler/runtime/messages_widget.js',
204 'dev_compiler/runtime/messages.css'
205 ];
206 for (var filepath in expectedFiles) {
207 var outFile = new File(path.join(actualDir, 'server_mode', filepath));
208 expect(outFile.existsSync(), success,
209 reason: '${outFile.path} was created iff compilation succeeds');
210 }
174 }); 211 });
175 } 212 }
176 } 213 }
177 214
178 /// An implementation of analysis engine's [Logger] that prints. 215 /// An implementation of analysis engine's [Logger] that prints.
179 class PrintLogger implements Logger { 216 class PrintLogger implements Logger {
180 @override void logError(String message, [CaughtException exception]) { 217 @override void logError(String message, [CaughtException exception]) {
181 print('[AnalysisEngine] error $message $exception'); 218 print('[AnalysisEngine] error $message $exception');
182 } 219 }
183 220
184 @override void logError2(String message, Object exception) { 221 @override void logError2(String message, Object exception) {
185 print('[AnalysisEngine] error $message $exception'); 222 print('[AnalysisEngine] error $message $exception');
186 } 223 }
187 224
188 void logInformation(String message, [CaughtException exception]) {} 225 void logInformation(String message, [CaughtException exception]) {}
189 void logInformation2(String message, Object exception) {} 226 void logInformation2(String message, Object exception) {}
190 } 227 }
OLDNEW
« no previous file with comments | « .gitignore ('k') | test/test.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698