Index: tests/compiler/dart2js/analyze_helper.dart |
diff --git a/tests/compiler/dart2js/analyze_helper.dart b/tests/compiler/dart2js/analyze_helper.dart |
index 2461c984ac897314d62b9178427f154b75c16847..70a1f225680a0cd6d4fc0d449ba77f95f94a09c6 100644 |
--- a/tests/compiler/dart2js/analyze_helper.dart |
+++ b/tests/compiler/dart2js/analyze_helper.dart |
@@ -41,9 +41,11 @@ class CollectingDiagnosticHandler extends FormattingDiagnosticHandler { |
Map<String, Map<dynamic/*String|MessageKind*/, int>> whiteListMap |
= new Map<String, Map<dynamic/*String|MessageKind*/, int>>(); |
+ List<MessageKind> skipList; |
CollectingDiagnosticHandler( |
Map<String, List/*<String|MessageKind>*/> whiteList, |
+ this.skipList, |
SourceFileProvider provider) |
: super(provider) { |
whiteList.forEach((String file, List/*<String|MessageKind>*/ messageParts) { |
@@ -89,6 +91,9 @@ class CollectingDiagnosticHandler extends FormattingDiagnosticHandler { |
if (uri == null) { |
return false; |
} |
+ if (skipList.contains(message.kind)) { |
+ return true; |
+ } |
String path = uri.path; |
for (String file in whiteListMap.keys) { |
if (path.contains(file)) { |
@@ -169,11 +174,17 @@ enum AnalysisMode { |
TREE_SHAKING, |
} |
+/// Analyzes the file(s) in [uriList] using the provided [mode] and checks that |
+/// no messages (errors, warnings or hints) are emitted. |
+/// |
+/// Messages can be generally allowed using [skipList] or on a per-file basis |
+/// using [whiteList]. |
Future analyze(List<Uri> uriList, |
Map<String, List/*<String|MessageKind>*/> whiteList, |
{AnalysisMode mode: AnalysisMode.ALL, |
CheckResults checkResults, |
- List<String> options: const <String>[]}) async { |
+ List<String> options: const <String>[], |
+ List<MessageKind> skipList: const <MessageKind>[]}) async { |
String testFileName = |
relativize(Uri.base, Platform.script, Platform.isWindows); |
@@ -191,7 +202,7 @@ Future analyze(List<Uri> uriList, |
var packageRoot = |
currentDirectory.resolve(Platform.packageRoot); |
var provider = new CompilerSourceFileProvider(); |
- var handler = new CollectingDiagnosticHandler(whiteList, provider); |
+ var handler = new CollectingDiagnosticHandler(whiteList, skipList, provider); |
options = <String>[Flags.analyzeOnly, '--categories=Client,Server', |
Flags.showPackageWarnings]..addAll(options); |
switch (mode) { |