Index: test/codegen_test.dart |
diff --git a/test/codegen_test.dart b/test/codegen_test.dart |
index c7f1486d1ef40b4fd7fec2e35ad5f874d2cd4988..90b1e70765b0b91ef976af9e7f473a2240c2a413 100644 |
--- a/test/codegen_test.dart |
+++ b/test/codegen_test.dart |
@@ -164,7 +164,23 @@ void _writeModule(String outPath, JSModuleFile result) { |
} |
} else { |
// Also write the errors to a '.err' file for easy counting. |
- errorFile.writeAsStringSync(errors); |
+ var moduleName = result.name; |
+ var libraryName = path.split(moduleName).last; |
+ var count = "[error]".allMatches(errors).length; |
+ var text = ''' |
+dart_library.library('$moduleName', null, [ |
+ 'dart_sdk', |
+ 'expect' |
+], function(exports, dart_sdk, expect) { |
+ const message = `DDC Compilation Error: $moduleName has $count errors`; |
+ const error = new Error(message); |
+ exports.$libraryName = Object.create(null); |
+ exports.$libraryName.main = function() { |
+ throw error; |
+ } |
+}); |
+ '''; |
+ errorFile.writeAsStringSync(text); |
// There are errors, so delete any stale ".js" file. |
if (jsFile.existsSync()) { |