| Index: tests/compiler/dart2js/warnings_checker.dart
|
| diff --git a/tests/compiler/dart2js/type_promotion_test.dart b/tests/compiler/dart2js/warnings_checker.dart
|
| similarity index 72%
|
| copy from tests/compiler/dart2js/type_promotion_test.dart
|
| copy to tests/compiler/dart2js/warnings_checker.dart
|
| index a25c2211a6f3a9f44d1ff5dbccb305bebefb422e..1105b38f521d77281a2ba269005696fe085d7668 100644
|
| --- a/tests/compiler/dart2js/type_promotion_test.dart
|
| +++ b/tests/compiler/dart2js/warnings_checker.dart
|
| @@ -2,13 +2,13 @@
|
| // for details. All rights reserved. Use of this source code is governed by a
|
| // BSD-style license that can be found in the LICENSE file.
|
|
|
| -// Test that dart2js produces the expected static type warnings for type
|
| -// promotion langauge tests. This ensures that the analyzer and dart2js agrees
|
| -// on these tests.
|
| +// Test that dart2js produces the expected static type warnings to ensures that
|
| +// the analyzer and dart2js agrees on the tests.
|
|
|
| import 'dart:async';
|
| import 'dart:io';
|
| import 'package:expect/expect.dart';
|
| +import 'package:async_helper/async_helper.dart';
|
| import 'memory_compiler.dart';
|
| import '../../../sdk/lib/_internal/compiler/implementation/filenames.dart';
|
| import '../../../sdk/lib/_internal/compiler/implementation/source_file.dart';
|
| @@ -16,27 +16,11 @@ import '../../../sdk/lib/_internal/compiler/implementation/source_file_provider.
|
| import '../../../sdk/lib/_internal/compiler/implementation/util/uri_extras.dart';
|
| import 'dart:convert';
|
|
|
| -/// Map from test files to a map of their expected status. If the status map is
|
| -/// `null` no warnings must be missing or unexpected, otherwise the status map
|
| -/// can contain a list of line numbers for keys 'missing' and 'unexpected' for
|
| -/// the warnings of each category.
|
| -const Map<String, dynamic> TESTS = const {
|
| - 'language/type_promotion_assign_test.dart': null,
|
| - 'language/type_promotion_closure_test.dart': null,
|
| - 'language/type_promotion_functions_test.dart':
|
| - const {'missing': const [62, 63, 64]}, // Issue 14933.
|
| - 'language/type_promotion_local_test.dart': null,
|
| - 'language/type_promotion_logical_and_test.dart': null,
|
| - 'language/type_promotion_more_specific_test.dart': null,
|
| - 'language/type_promotion_multiple_test.dart': null,
|
| - 'language/type_promotion_parameter_test.dart': null,
|
| -};
|
| -
|
| -void main() {
|
| +void checkWarnings(Map<String, dynamic> tests) {
|
| bool isWindows = Platform.isWindows;
|
| Uri script = currentDirectory.resolveUri(Platform.script);
|
| bool warningsMismatch = false;
|
| - Future.forEach(TESTS.keys, (String test) {
|
| + asyncTest(() => Future.forEach(tests.keys, (String test) {
|
| Uri uri = script.resolve('../../$test');
|
| String source = UTF8.decode(readAll(uriPathToNative(uri.path)));
|
| SourceFile file = new StringSourceFile(
|
| @@ -56,7 +40,7 @@ void main() {
|
| options: ['--analyze-only'],
|
| showDiagnostics: false);
|
| return compiler.run(uri).then((_) {
|
| - Map<String, List<int>> statusMap = TESTS[test];
|
| + Map<String, List<int>> statusMap = tests[test];
|
| // Line numbers with known unexpected warnings.
|
| List<int> unexpectedStatus = [];
|
| if (statusMap != null && statusMap.containsKey('unexpected')) {
|
| @@ -92,5 +76,5 @@ void main() {
|
| });
|
| }).then((_) {
|
| Expect.isFalse(warningsMismatch);
|
| - });
|
| + }));
|
| }
|
|
|