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

Unified Diff: pkg/dev_compiler/test/codegen_test.dart

Issue 2971443002: Output errors for tests that fail to compile (Closed)
Patch Set: Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/dev_compiler/test/codegen_test.dart
diff --git a/pkg/dev_compiler/test/codegen_test.dart b/pkg/dev_compiler/test/codegen_test.dart
index 333b8187ecc97b4f3d0651e96940ac87f2357811..04e074d01601aef7ffde02320c2fb69c7d87a045 100644
--- a/pkg/dev_compiler/test/codegen_test.dart
+++ b/pkg/dev_compiler/test/codegen_test.dart
@@ -174,17 +174,21 @@ main(List<String> arguments) {
expect(crashing, isTrue,
reason: "test $name crashes during compilation.\n"
"$exception\n$stackTrace");
- } else if (inconsistent) {
+ return;
+ }
+
+ // Write out JavaScript and/or compilation errors/warnings.
+ _writeModule(
+ path.join(codegenOutputDir, name),
+ isTopLevelTest ? path.join(codegenExpectDir, name) : null,
+ moduleFormat,
+ module);
+
+ if (inconsistent) {
// An inconsistent test will only compile on some platforms (see
// comment below). It should not crash however.
expect(crashing, isFalse, reason: "test $name no longer crashes.");
} else if (module.isValid) {
- _writeModule(
- path.join(codegenOutputDir, name),
- isTopLevelTest ? path.join(codegenExpectDir, name) : null,
- moduleFormat,
- module);
-
expect(crashing, isFalse, reason: "test $name no longer crashes.");
// TODO(vsm): We don't seem to trip on non-strong errors?
// expect(expectedCompileTimeError, isFalse,
@@ -224,7 +228,9 @@ void _writeModule(String outPath, String expectPath, ModuleFormat format,
if (errors.isNotEmpty && !errors.endsWith('\n')) errors += '\n';
new File(outPath + '.txt').writeAsStringSync(errors);
- result.writeCodeSync(format, outPath + '.js');
+ if (result.isValid) {
+ result.writeCodeSync(format, outPath + '.js');
+ }
if (result.summaryBytes != null) {
new File(outPath + '.sum').writeAsBytesSync(result.summaryBytes);
« 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