| 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();
|
| + }
|
| }
|
| }
|
|
|
|
|