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

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

Issue 1168393003: Enforce LF line endings in the git database. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: rebase Created 5 years, 6 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/exit_code_helper.dart ('k') | tests/compiler/dart2js/import_mirrors_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/compiler/dart2js/frontend_checker.dart
diff --git a/tests/compiler/dart2js/frontend_checker.dart b/tests/compiler/dart2js/frontend_checker.dart
index b4bd3a0ad1f53ccedb3b3606b53fa13fb4c42cc1..91fb719d6c08809d040c84d3e5e6eff8707e2ee3 100644
--- a/tests/compiler/dart2js/frontend_checker.dart
+++ b/tests/compiler/dart2js/frontend_checker.dart
@@ -1,110 +1,110 @@
-// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
-// 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.
-
-// Checks that dart2js produces the expected static type warnings and
-// compile-time errors for the provided multitests.
-
-import 'dart:async';
-import 'dart:io';
-
-import 'package:async_helper/async_helper.dart';
-import 'package:compiler/src/util/uri_extras.dart'
- show relativize;
-import 'memory_compiler.dart';
-
-import '../../../tools/testing/dart/multitest.dart'
- show ExtractTestsFromMultitest;
-import '../../../tools/testing/dart/path.dart'
- show Path;
-
-
-/// Check the analysis of the multitests in [testFiles] to result in the
-/// expected static warnings and compile-time errors.
-///
-/// [testFiles] is a map of the test files to be checked together with their
-/// associated white listing.
-///
-/// For instance if [testFiles] contain the mapping
-/// 'language/async_await_syntax_test.dart': const ['a03b', 'a04b']
-/// the multitests in 'language/async_await_syntax_test.dart' are checked but
-/// the subtests 'a03b' and 'a04c' are expected to fail.
-void check(Map<String, List<String>> testFiles,
- {List<String> arguments: const <String>[],
- List<String> options: const <String>[]}) {
- bool outcomeMismatch = false;
- bool verbose = arguments.contains('-v');
- var cachedCompiler;
- asyncTest(() => Future.forEach(testFiles.keys, (String testFile) {
- Map<String, String> testSources = {};
- Map<String, Set<String>> testOutcomes = {};
- String fileName = 'tests/$testFile';
- ExtractTestsFromMultitest(new Path(fileName), testSources, testOutcomes);
- return Future.forEach(testSources.keys, (String testName) {
- String testFileName = '$fileName/$testName';
- Set<String> expectedOutcome = testOutcomes[testName];
- bool expectFailure = testFiles[testFile].contains(testName);
- DiagnosticCollector collector = new DiagnosticCollector();
- var compiler = compilerFor(
- {testFileName: testSources[testName]},
- diagnosticHandler: collector,
- options: ['--analyze-only']..addAll(options),
- showDiagnostics: verbose,
- cachedCompiler: cachedCompiler);
- return compiler.run(Uri.parse('memory:$testFileName')).then((_) {
- bool unexpectedResult = false;
- if (expectedOutcome.contains('compile-time error')) {
- if (collector.errors.isEmpty) {
- print('$testFileName: Missing compile-time error.');
- unexpectedResult = true;
- }
- } else if (expectedOutcome.contains('static type warning')) {
- if (collector.warnings.isEmpty) {
- print('$testFileName: Missing static type warning.');
- unexpectedResult = true;
- }
- } else {
- // Expect ok.
- if (!collector.errors.isEmpty ||
- !collector.warnings.isEmpty) {
- collector.errors.forEach((message) {
- print('$testFileName: Unexpected error: ${message.message}');
- });
- collector.warnings.forEach((message) {
- print('$testFileName: Unexpected warning: ${message.message}');
- });
- unexpectedResult = true;
- }
- }
- if (expectFailure) {
- if (unexpectedResult) {
- unexpectedResult = false;
- } else {
- print('$testFileName: The test is white-listed '
- 'and therefore expected to fail.');
- unexpectedResult = true;
- }
- }
- if (unexpectedResult) {
- outcomeMismatch = true;
- }
- cachedCompiler = compiler;
- });
- });
- }).then((_) {
- if (outcomeMismatch) {
- String testFileName =
- relativize(Uri.base, Platform.script, Platform.isWindows);
- print('''
-
-===
-=== ERROR: Unexpected result of analysis.
-===
-=== Please update the white-listing in $testFileName
-===
-
-''');
- exit(1);
- }
- }));
-}
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
+// 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.
+
+// Checks that dart2js produces the expected static type warnings and
+// compile-time errors for the provided multitests.
+
+import 'dart:async';
+import 'dart:io';
+
+import 'package:async_helper/async_helper.dart';
+import 'package:compiler/src/util/uri_extras.dart'
+ show relativize;
+import 'memory_compiler.dart';
+
+import '../../../tools/testing/dart/multitest.dart'
+ show ExtractTestsFromMultitest;
+import '../../../tools/testing/dart/path.dart'
+ show Path;
+
+
+/// Check the analysis of the multitests in [testFiles] to result in the
+/// expected static warnings and compile-time errors.
+///
+/// [testFiles] is a map of the test files to be checked together with their
+/// associated white listing.
+///
+/// For instance if [testFiles] contain the mapping
+/// 'language/async_await_syntax_test.dart': const ['a03b', 'a04b']
+/// the multitests in 'language/async_await_syntax_test.dart' are checked but
+/// the subtests 'a03b' and 'a04c' are expected to fail.
+void check(Map<String, List<String>> testFiles,
+ {List<String> arguments: const <String>[],
+ List<String> options: const <String>[]}) {
+ bool outcomeMismatch = false;
+ bool verbose = arguments.contains('-v');
+ var cachedCompiler;
+ asyncTest(() => Future.forEach(testFiles.keys, (String testFile) {
+ Map<String, String> testSources = {};
+ Map<String, Set<String>> testOutcomes = {};
+ String fileName = 'tests/$testFile';
+ ExtractTestsFromMultitest(new Path(fileName), testSources, testOutcomes);
+ return Future.forEach(testSources.keys, (String testName) {
+ String testFileName = '$fileName/$testName';
+ Set<String> expectedOutcome = testOutcomes[testName];
+ bool expectFailure = testFiles[testFile].contains(testName);
+ DiagnosticCollector collector = new DiagnosticCollector();
+ var compiler = compilerFor(
+ {testFileName: testSources[testName]},
+ diagnosticHandler: collector,
+ options: ['--analyze-only']..addAll(options),
+ showDiagnostics: verbose,
+ cachedCompiler: cachedCompiler);
+ return compiler.run(Uri.parse('memory:$testFileName')).then((_) {
+ bool unexpectedResult = false;
+ if (expectedOutcome.contains('compile-time error')) {
+ if (collector.errors.isEmpty) {
+ print('$testFileName: Missing compile-time error.');
+ unexpectedResult = true;
+ }
+ } else if (expectedOutcome.contains('static type warning')) {
+ if (collector.warnings.isEmpty) {
+ print('$testFileName: Missing static type warning.');
+ unexpectedResult = true;
+ }
+ } else {
+ // Expect ok.
+ if (!collector.errors.isEmpty ||
+ !collector.warnings.isEmpty) {
+ collector.errors.forEach((message) {
+ print('$testFileName: Unexpected error: ${message.message}');
+ });
+ collector.warnings.forEach((message) {
+ print('$testFileName: Unexpected warning: ${message.message}');
+ });
+ unexpectedResult = true;
+ }
+ }
+ if (expectFailure) {
+ if (unexpectedResult) {
+ unexpectedResult = false;
+ } else {
+ print('$testFileName: The test is white-listed '
+ 'and therefore expected to fail.');
+ unexpectedResult = true;
+ }
+ }
+ if (unexpectedResult) {
+ outcomeMismatch = true;
+ }
+ cachedCompiler = compiler;
+ });
+ });
+ }).then((_) {
+ if (outcomeMismatch) {
+ String testFileName =
+ relativize(Uri.base, Platform.script, Platform.isWindows);
+ print('''
+
+===
+=== ERROR: Unexpected result of analysis.
+===
+=== Please update the white-listing in $testFileName
+===
+
+''');
+ exit(1);
+ }
+ }));
+}
« no previous file with comments | « tests/compiler/dart2js/exit_code_helper.dart ('k') | tests/compiler/dart2js/import_mirrors_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698