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

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

Issue 131853003: Reenable analyze_api and add exceptions to white-list. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add comments and messages. Created 6 years, 11 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 | « tests/compiler/dart2js/analyze_api_test.dart ('k') | tests/compiler/dart2js/dart2js.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
}
« no previous file with comments | « tests/compiler/dart2js/analyze_api_test.dart ('k') | tests/compiler/dart2js/dart2js.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698