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

Unified Diff: test/codegen_test.dart

Issue 1978983002: Delete stale .js or .err files when generating codegen output. (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Created 4 years, 7 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: test/codegen_test.dart
diff --git a/test/codegen_test.dart b/test/codegen_test.dart
index 83a4927d5cf41ee3f4b160c4be8193a7b6cbc7fa..7e895d79fd3f552b22c1500e5d58159a567a060e 100644
--- a/test/codegen_test.dart
+++ b/test/codegen_test.dart
@@ -140,16 +140,29 @@ void _writeModule(String outPath, JSModuleFile result) {
if (errors.isNotEmpty && !errors.endsWith('\n')) errors += '\n';
new File(outPath + '.txt').writeAsStringSync(errors);
+ var jsFile = new File(outPath + '.js');
+ var errorFile = new File(outPath + '.err');
+
if (result.isValid) {
- new File(outPath + '.js').writeAsStringSync(result.code);
+ jsFile.writeAsStringSync(result.code);
if (result.sourceMap != null) {
var mapPath = outPath + '.js.map';
new File(mapPath)
.writeAsStringSync(JSON.encode(result.placeSourceMap(mapPath)));
}
+
+ // There are no errors, so delete any stale ".err" file.
+ if (errorFile.existsSync()) {
+ errorFile.deleteSync();
+ }
} else {
// Also write the errors to a '.err' file for easy counting.
- new File(outPath + '.err').writeAsStringSync(errors);
+ errorFile.writeAsStringSync(errors);
+
+ // There are errors, so delete any stale ".js" file.
+ if (jsFile.existsSync()) {
+ jsFile.deleteSync();
+ }
}
}
« 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