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

Unified Diff: tests/compiler/dart2js/frontend_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/forloop_box_test.dart ('k') | tests/compiler/dart2js/generate_at_use_site_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 8624cfef08639b874143b0af5461980fbab12de7..dc264a254f7077c2c162fd51a697c74be61c4b3a 100644
--- a/tests/compiler/dart2js/frontend_checker.dart
+++ b/tests/compiler/dart2js/frontend_checker.dart
@@ -10,15 +10,12 @@ import 'dart:io';
import 'package:async_helper/async_helper.dart';
import 'package:compiler/src/commandline_options.dart';
-import 'package:compiler/src/util/uri_extras.dart'
- show relativize;
+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;
-
+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.
@@ -31,72 +28,72 @@ import '../../../tools/testing/dart/path.dart'
/// 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>[]}) {
+ {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) async {
- String testFileName = '$fileName/$testName';
- Set<String> expectedOutcome = testOutcomes[testName];
- bool expectFailure = testFiles[testFile].contains(testName);
- DiagnosticCollector collector = new DiagnosticCollector();
- CompilationResult result = await runCompiler(
- entryPoint: Uri.parse('memory:$testFileName'),
- memorySourceFiles: {testFileName: testSources[testName]},
- diagnosticHandler: collector,
- options: [Flags.analyzeOnly]..addAll(options),
- showDiagnostics: verbose,
- cachedCompiler: cachedCompiler);
- var compiler = result.compiler;
- 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('''
+ 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) async {
+ String testFileName = '$fileName/$testName';
+ Set<String> expectedOutcome = testOutcomes[testName];
+ bool expectFailure = testFiles[testFile].contains(testName);
+ DiagnosticCollector collector = new DiagnosticCollector();
+ CompilationResult result = await runCompiler(
+ entryPoint: Uri.parse('memory:$testFileName'),
+ memorySourceFiles: {testFileName: testSources[testName]},
+ diagnosticHandler: collector,
+ options: [Flags.analyzeOnly]..addAll(options),
+ showDiagnostics: verbose,
+ cachedCompiler: cachedCompiler);
+ var compiler = result.compiler;
+ 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.
@@ -105,7 +102,7 @@ void check(Map<String, List<String>> testFiles,
===
''');
- exit(1);
- }
- }));
+ exit(1);
+ }
+ }));
}
« no previous file with comments | « tests/compiler/dart2js/forloop_box_test.dart ('k') | tests/compiler/dart2js/generate_at_use_site_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698