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

Unified Diff: tests/compiler/dart2js/exit_code_test.dart

Issue 1077373003: Add fatal-warnings flag, that turns warnings into compilation errors (the name (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 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 | « pkg/compiler/lib/src/dart2js.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/compiler/dart2js/exit_code_test.dart
diff --git a/tests/compiler/dart2js/exit_code_test.dart b/tests/compiler/dart2js/exit_code_test.dart
index b70fe4ab17df4b862cee7950a397c6e96688e4fa..0303d28e755760451e3a09124f046cccba8ad4c8 100644
--- a/tests/compiler/dart2js/exit_code_test.dart
+++ b/tests/compiler/dart2js/exit_code_test.dart
@@ -137,7 +137,8 @@ class TestResolver extends ResolverTask {
int checkedResults = 0;
-Future testExitCode(String marker, String type, int expectedExitCode) {
+Future testExitCode(
+ String marker, String type, int expectedExitCode, List options) {
bool testOccurred = false;
void onTest(String testMarker, String testType) {
@@ -196,17 +197,19 @@ Future testExitCode(String marker, String type, int expectedExitCode) {
entry.exitFunc = exit;
entry.compileFunc = compile;
- Future result = entry.internalMain(
- ["tests/compiler/dart2js/exit_code_helper.dart"]);
+ List<String> args = new List<String>.from(options)
+ ..add("tests/compiler/dart2js/exit_code_helper.dart");
+ Future result = entry.internalMain(args);
return result.catchError((e, s) {
// Capture crashes.
}).whenComplete(checkResult);
});
}
-Future testExitCodes(String marker, Map<String,int> expectedExitCodes) {
+Future testExitCodes(
+ String marker, Map<String,int> expectedExitCodes, List<String> options) {
return Future.forEach(expectedExitCodes.keys, (String type) {
- return testExitCode(marker, type, expectedExitCodes[type]);
+ return testExitCode(marker, type, expectedExitCodes[type], options);
});
}
@@ -214,23 +217,30 @@ void main() {
bool isCheckedMode = false;
assert((isCheckedMode = true));
- final beforeRun = {
- '': 0,
- 'NoSuchMethodError': 253,
- 'assert': isCheckedMode ? 253 : 0,
- 'invariant': 253
- };
+ Map _expectedExitCode({bool beforeRun: false, bool fatalWarnings: false}) {
+ if (beforeRun) {
+ return {
+ '': 0,
+ 'NoSuchMethodError': 253,
+ 'assert': isCheckedMode ? 253 : 0,
+ 'invariant': 253
+ };
+ }
- final duringRun = {
- '': 0,
- 'NoSuchMethodError': 253,
- 'assert': isCheckedMode ? 253 : 0,
- 'invariant': 253,
- 'warning': 0,
- 'error': 1,
- 'internalError': 253,
- };
+ // duringRun:
+ return {
+ '': 0,
+ 'NoSuchMethodError': 253,
+ 'assert': isCheckedMode ? 253 : 0,
+ 'invariant': 253,
+ 'warning': fatalWarnings ? 1 : 0,
+ 'error': 1,
+ 'internalError': 253,
+ };
+ }
+ const beforeRun = false;
+ const duringRun = true;
final tests = {
'Compiler': beforeRun,
'Compiler.run': beforeRun,
@@ -242,18 +252,20 @@ void main() {
'Compiler.codegen': duringRun,
'ResolverTask.computeClassMembers': duringRun,
};
-
- asyncStart();
- Future.forEach(tests.keys, (marker) {
- return testExitCodes(marker, tests[marker]);
- }).then((_) {
- int countResults(Map runType) {
- return runType.length *
- tests.values.where((r) => r == runType).length;
+ int totalExpectedErrors = 0;
+
+ asyncTest(() async {
+ for (String marker in tests.keys) {
+ var expected = _expectedExitCode(beforeRun: tests[marker]);
+ totalExpectedErrors += expected.length;
+ await testExitCodes(marker, expected, []);
+
+ expected = _expectedExitCode(
+ beforeRun: tests[marker], fatalWarnings: true);
+ totalExpectedErrors += expected.length;
+ await testExitCodes(marker, expected, ['--fatal-warnings']);
}
- Expect.equals(countResults(beforeRun) + countResults(duringRun),
- checkedResults);
- asyncEnd();
+ Expect.equals(totalExpectedErrors, checkedResults);
});
}
« no previous file with comments | « pkg/compiler/lib/src/dart2js.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698