| Index: tests/compiler/dart2js/analyze_helper.dart
|
| diff --git a/tests/compiler/dart2js/analyze_helper.dart b/tests/compiler/dart2js/analyze_helper.dart
|
| index 2c2c02d85e1981640dbe4785abfb78207282dd6e..47deb90bd118d596fa4572fe52d408c5abcfb1b9 100644
|
| --- a/tests/compiler/dart2js/analyze_helper.dart
|
| +++ b/tests/compiler/dart2js/analyze_helper.dart
|
| @@ -4,7 +4,6 @@
|
|
|
| library analyze_helper;
|
|
|
| -import "package:expect/expect.dart";
|
| import 'dart:async';
|
| import 'dart:io';
|
| import '../../../sdk/lib/_internal/compiler/compiler.dart' as api;
|
| @@ -13,6 +12,7 @@ import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart'
|
| hide Compiler;
|
| import '../../../sdk/lib/_internal/compiler/implementation/filenames.dart';
|
| import '../../../sdk/lib/_internal/compiler/implementation/source_file_provider.dart';
|
| +import '../../../sdk/lib/_internal/compiler/implementation/util/uri_extras.dart';
|
|
|
| /**
|
| * Map of whitelisted warnings and errors.
|
| @@ -46,12 +46,10 @@ class CollectingDiagnosticHandler extends FormattingDiagnosticHandler {
|
| });
|
| }
|
|
|
| - void checkResults() {
|
| - Expect.isFalse(hasWarnings);
|
| - Expect.isFalse(hasHint);
|
| - Expect.isFalse(hasErrors);
|
| - Expect.isTrue(checkWhiteListUse());
|
| + bool checkResults() {
|
| + bool validWhiteListUse = checkWhiteListUse();
|
| reportWhiteListUse();
|
| + return !hasWarnings && !hasHint && !hasErrors && validWhiteListUse;
|
| }
|
|
|
| bool checkWhiteListUse() {
|
| @@ -126,6 +124,19 @@ class CollectingDiagnosticHandler extends FormattingDiagnosticHandler {
|
| Future analyze(List<Uri> uriList,
|
| Map<String, List<String>> whiteList,
|
| {bool analyzeAll: true}) {
|
| + String testFileName =
|
| + relativize(Uri.base, Platform.script, Platform.isWindows);
|
| +
|
| + print("""
|
| +
|
| +
|
| +===
|
| +=== NOTE: If this test fails, update [WHITE_LIST] in $testFileName
|
| +===
|
| +
|
| +
|
| +""");
|
| +
|
| var libraryRoot = currentDirectory.resolve('sdk/');
|
| var provider = new CompilerSourceFileProvider();
|
| var handler = new CollectingDiagnosticHandler(whiteList, provider);
|
| @@ -138,14 +149,27 @@ Future analyze(List<Uri> uriList,
|
| libraryRoot, libraryRoot,
|
| options,
|
| {});
|
| + String MESSAGE = """
|
| +
|
| +
|
| +===
|
| +=== ERROR: Unexpected result of analysis.
|
| +===
|
| +=== Please update [WHITE_LIST] in $testFileName
|
| +===
|
| +""";
|
| +
|
| + void onCompletion(_) {
|
| + bool result = handler.checkResults();
|
| + if (!result) {
|
| + print(MESSAGE);
|
| + exit(1);
|
| + }
|
| + }
|
| if (analyzeAll) {
|
| compiler.librariesToAnalyzeWhenRun = uriList;
|
| - return compiler.run(null).then((_) {
|
| - handler.checkResults();
|
| - });
|
| + return compiler.run(null).then(onCompletion);
|
| } else {
|
| - return compiler.run(uriList.single).then((_) {
|
| - handler.checkResults();
|
| - });
|
| + return compiler.run(uriList.single).then(onCompletion);
|
| }
|
| }
|
|
|