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

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

Issue 2345083003: dart2js: run dartfmt on tests (Closed)
Patch Set: revert another multipart test Created 4 years, 3 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/value_range_test.dart ('k') | tests/compiler/dart2js/world_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/compiler/dart2js/warnings_checker.dart
diff --git a/tests/compiler/dart2js/warnings_checker.dart b/tests/compiler/dart2js/warnings_checker.dart
index 3e50eaec9366e74cd5249b5f15c4cacc6dee9d81..fdbd12cba50e07bc42bcd48f88de616f364e2208 100644
--- a/tests/compiler/dart2js/warnings_checker.dart
+++ b/tests/compiler/dart2js/warnings_checker.dart
@@ -23,61 +23,62 @@ void checkWarnings(Map<String, dynamic> tests, [List<String> arguments]) {
bool warningsMismatch = false;
bool verbose = arguments != null && arguments.contains('-v');
asyncTest(() => Future.forEach(tests.keys, (String test) async {
- Uri uri = script.resolve('../../$test');
- String source = UTF8.decode(readAll(uriPathToNative(uri.path)));
- SourceFile file = new StringSourceFile(
- uri, relativize(currentDirectory, uri, isWindows), source);
- Map<int,String> expectedWarnings = {};
- int lineNo = 0;
- for (String line in source.split('\n')) {
- if (line.contains('///') &&
- (line.contains('static type warning') ||
- line.contains('static warning'))) {
- expectedWarnings[lineNo] = line;
- }
- lineNo++;
- }
- Set<int> unseenWarnings = new Set<int>.from(expectedWarnings.keys);
- DiagnosticCollector collector = new DiagnosticCollector();
- await runCompiler(
- entryPoint: uri,
- diagnosticHandler: collector,
- options: [Flags.analyzeOnly],
- showDiagnostics: verbose);
- Map<String, List<int>> statusMap = tests[test];
- // Line numbers with known unexpected warnings.
- List<int> unexpectedStatus = [];
- if (statusMap != null && statusMap.containsKey('unexpected')) {
- unexpectedStatus = statusMap['unexpected'];
- }
- // Line numbers with known missing warnings.
- List<int> missingStatus = [];
- if (statusMap != null && statusMap.containsKey('missing')) {
- missingStatus = statusMap['missing'];
- }
- for (CollectedMessage message in collector.warnings) {
- Expect.equals(uri, message.uri);
- int lineNo = file.getLine(message.begin);
- if (expectedWarnings.containsKey(lineNo)) {
- unseenWarnings.remove(lineNo);
- } else if (!unexpectedStatus.contains(lineNo+1)) {
- warningsMismatch = true;
- print(file.getLocationMessage(
- 'Unexpected warning: ${message.message}',
- message.begin, message.end));
- }
- }
- if (!unseenWarnings.isEmpty) {
- for (int lineNo in unseenWarnings) {
- if (!missingStatus.contains(lineNo+1)) {
- warningsMismatch = true;
- String line = expectedWarnings[lineNo];
- print('$uri [${lineNo+1}]: Missing static type warning.');
- print(line);
+ Uri uri = script.resolve('../../$test');
+ String source = UTF8.decode(readAll(uriPathToNative(uri.path)));
+ SourceFile file = new StringSourceFile(
+ uri, relativize(currentDirectory, uri, isWindows), source);
+ Map<int, String> expectedWarnings = {};
+ int lineNo = 0;
+ for (String line in source.split('\n')) {
+ if (line.contains('///') &&
+ (line.contains('static type warning') ||
+ line.contains('static warning'))) {
+ expectedWarnings[lineNo] = line;
+ }
+ lineNo++;
}
- }
- }
- }).then((_) {
- Expect.isFalse(warningsMismatch);
- }));
+ Set<int> unseenWarnings = new Set<int>.from(expectedWarnings.keys);
+ DiagnosticCollector collector = new DiagnosticCollector();
+ await runCompiler(
+ entryPoint: uri,
+ diagnosticHandler: collector,
+ options: [Flags.analyzeOnly],
+ showDiagnostics: verbose);
+ Map<String, List<int>> statusMap = tests[test];
+ // Line numbers with known unexpected warnings.
+ List<int> unexpectedStatus = [];
+ if (statusMap != null && statusMap.containsKey('unexpected')) {
+ unexpectedStatus = statusMap['unexpected'];
+ }
+ // Line numbers with known missing warnings.
+ List<int> missingStatus = [];
+ if (statusMap != null && statusMap.containsKey('missing')) {
+ missingStatus = statusMap['missing'];
+ }
+ for (CollectedMessage message in collector.warnings) {
+ Expect.equals(uri, message.uri);
+ int lineNo = file.getLine(message.begin);
+ if (expectedWarnings.containsKey(lineNo)) {
+ unseenWarnings.remove(lineNo);
+ } else if (!unexpectedStatus.contains(lineNo + 1)) {
+ warningsMismatch = true;
+ print(file.getLocationMessage(
+ 'Unexpected warning: ${message.message}',
+ message.begin,
+ message.end));
+ }
+ }
+ if (!unseenWarnings.isEmpty) {
+ for (int lineNo in unseenWarnings) {
+ if (!missingStatus.contains(lineNo + 1)) {
+ warningsMismatch = true;
+ String line = expectedWarnings[lineNo];
+ print('$uri [${lineNo+1}]: Missing static type warning.');
+ print(line);
+ }
+ }
+ }
+ }).then((_) {
+ Expect.isFalse(warningsMismatch);
+ }));
}
« no previous file with comments | « tests/compiler/dart2js/value_range_test.dart ('k') | tests/compiler/dart2js/world_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698