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

Side by Side Diff: pkg/dev_compiler/test/codegen_test.dart

Issue 2744853002: Fix expectations (Closed)
Patch Set: Rebase Created 3 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
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 /// 6 ///
7 /// Runs Dart Dev Compiler on all input in the `codegen` directory and checks 7 /// Runs Dart Dev Compiler on all input in the `codegen` directory and checks
8 /// that the output is what we expected. 8 /// that the output is what we expected.
9 library dev_compiler.test.codegen_test; 9 library dev_compiler.test.codegen_test;
10 10
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 } 157 }
158 JSModuleFile module = null; 158 JSModuleFile module = null;
159 var error, trace; 159 var error, trace;
160 try { 160 try {
161 module = compiler.compile(unit, options); 161 module = compiler.compile(unit, options);
162 } catch (e, t) { 162 } catch (e, t) {
163 error = e; 163 error = e;
164 trace = t; 164 trace = t;
165 } 165 }
166 166
167 bool expectedCompileTimeError =
168 contents.contains(': compile-time error\n');
167 bool notStrong = notYetStrongTests.contains(name); 169 bool notStrong = notYetStrongTests.contains(name);
168 bool crashing = _crashingTests.contains(name); 170 bool crashing = _crashingTests.contains(name);
169 171
170 if (module == null) { 172 if (module == null) {
171 expect(crashing, isTrue, 173 expect(crashing, isTrue,
172 reason: "test $name crashes during compilation.\n\n" 174 reason: "test $name crashes during compilation.\n\n"
173 "Exception: $error\n\nStack trace:\n\n$trace"); 175 "Exception: $error\n\nStack trace:\n\n$trace");
174 } else if (module.isValid) { 176 } else if (module.isValid) {
175 _writeModule( 177 _writeModule(
176 path.join(codegenOutputDir, name), 178 path.join(codegenOutputDir, name),
177 isTopLevelTest ? path.join(codegenExpectDir, name) : null, 179 isTopLevelTest ? path.join(codegenExpectDir, name) : null,
178 moduleFormat, 180 moduleFormat,
179 module); 181 module);
180 182
181 expect(crashing, isFalse, reason: "test $name no longer crashes."); 183 expect(crashing, isFalse, reason: "test $name no longer crashes.");
184 // TODO(vsm): We don't seem to trip on non-strong errors?
185 // expect(expectedCompileTimeError, isFalse,
186 // reason: "test $name expected compilation errors, but compiled.");
182 expect(notStrong, isFalse, 187 expect(notStrong, isFalse,
183 reason: "test $name expected strong mode errors, but compiled."); 188 reason: "test $name expected strong mode errors, but compiled.");
184 } else { 189 } else {
185 expect(crashing, isFalse, reason: "test $name no longer crashes."); 190 expect(crashing, isFalse, reason: "test $name no longer crashes.");
186 expect(notStrong, isTrue, 191 var reason =
187 reason: "test $name failed to compile due to strong mode errors:" 192 expectedCompileTimeError ? "expected" : "untriaged strong mode";
193 expect(expectedCompileTimeError || notStrong, isTrue,
194 reason: "test $name failed to compile due to $reason errors:"
188 "\n\n${module.errors.join('\n')}."); 195 "\n\n${module.errors.join('\n')}.");
189 } 196 }
190 }); 197 });
191 } 198 }
192 199
193 if (filePattern.hasMatch('sunflower')) { 200 if (filePattern.hasMatch('sunflower')) {
194 test('sunflower', () { 201 test('sunflower', () {
195 _buildSunflower(sharedCompiler, codegenOutputDir, codegenExpectDir); 202 _buildSunflower(sharedCompiler, codegenOutputDir, codegenExpectDir);
196 }); 203 });
197 } 204 }
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 if (uriContent != null) { 379 if (uriContent != null) {
373 uriContent = uriContent.trim(); 380 uriContent = uriContent.trim();
374 directive.uriContent = uriContent; 381 directive.uriContent = uriContent;
375 } 382 }
376 return (directive as UriBasedDirectiveImpl).validate() == null 383 return (directive as UriBasedDirectiveImpl).validate() == null
377 ? uriContent 384 ? uriContent
378 : null; 385 : null;
379 } 386 }
380 387
381 final _crashingTests = new Set<String>.from([ 388 final _crashingTests = new Set<String>.from([
389 'language/generic_methods_generic_class_tearoff_test',
390 'language/generic_methods_named_parameters_test',
391 'language/generic_methods_optional_parameters_test',
392 'language/generic_methods_tearoff_specialization_test',
393 'language/generic_methods_unused_parameter_test',
382 'language/mixin_illegal_syntax_test_none_multi', 394 'language/mixin_illegal_syntax_test_none_multi',
383 'language/mixin_illegal_syntax_test_01_multi', 395 'language/mixin_illegal_syntax_test_01_multi',
384 'language/mixin_illegal_syntax_test_02_multi', 396 'language/mixin_illegal_syntax_test_02_multi',
385 'language/mixin_illegal_syntax_test_03_multi', 397 'language/mixin_illegal_syntax_test_03_multi',
386 'language/mixin_illegal_syntax_test_04_multi', 398 'language/mixin_illegal_syntax_test_04_multi',
387 'language/mixin_illegal_syntax_test_05_multi', 399 'language/mixin_illegal_syntax_test_05_multi',
388 'language/mixin_illegal_syntax_test_06_multi', 400 'language/mixin_illegal_syntax_test_06_multi',
389 'language/mixin_illegal_syntax_test_07_multi', 401 'language/mixin_illegal_syntax_test_07_multi',
390 'language/mixin_illegal_syntax_test_08_multi', 402 'language/mixin_illegal_syntax_test_08_multi',
391 'language/mixin_illegal_syntax_test_09_multi', 403 'language/mixin_illegal_syntax_test_09_multi',
392 'language/mixin_illegal_syntax_test_10_multi', 404 'language/mixin_illegal_syntax_test_10_multi',
393 'language/mixin_illegal_syntax_test_11_multi', 405 'language/mixin_illegal_syntax_test_11_multi',
394 'language/mixin_illegal_syntax_test_12_multi', 406 'language/mixin_illegal_syntax_test_12_multi',
395 'language/mixin_illegal_syntax_test_13_multi', 407 'language/mixin_illegal_syntax_test_13_multi',
396 'language/mixin_illegal_syntax_test_14_multi', 408 'language/mixin_illegal_syntax_test_14_multi',
397 409
398 // TODO(vsm): Fix these - they import files from a different directory 410 // TODO(vsm): Fix these - they import files from a different directory
399 // - this triggers an invalid library root build error. 411 // - this triggers an invalid library root build error.
400 'lib/html/custom/attribute_changed_callback_test', 412 'lib/html/custom/attribute_changed_callback_test',
401 'lib/html/custom/constructor_calls_created_synchronously_test', 413 'lib/html/custom/constructor_calls_created_synchronously_test',
402 'lib/html/custom/entered_left_view_test', 414 'lib/html/custom/entered_left_view_test',
403 'lib/html/custom/js_custom_test', 415 'lib/html/custom/js_custom_test',
404 'lib/html/custom/mirrors_test', 416 'lib/html/custom/mirrors_test',
405 'lib/html/custom/regress_194523002_test', 417 'lib/html/custom/regress_194523002_test',
406 ]); 418 ]);
OLDNEW
« no previous file with comments | « pkg/dev_compiler/test/browser/language_tests.js ('k') | pkg/dev_compiler/test/not_yet_strong_tests.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698