| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 // Checks that dart2js produces the expected static type warnings and | 5 // Checks that dart2js produces the expected static type warnings and |
| 6 // compile-time errors for the provided multitests. | 6 // compile-time errors for the provided multitests. |
| 7 | 7 |
| 8 import 'dart:async'; | 8 import 'dart:async'; |
| 9 import 'dart:io'; | 9 import 'dart:io'; |
| 10 | 10 |
| 11 import 'package:async_helper/async_helper.dart'; | 11 import 'package:async_helper/async_helper.dart'; |
| 12 import 'package:compiler/src/commandline_options.dart'; |
| 12 import 'package:compiler/src/util/uri_extras.dart' | 13 import 'package:compiler/src/util/uri_extras.dart' |
| 13 show relativize; | 14 show relativize; |
| 14 import 'memory_compiler.dart'; | 15 import 'memory_compiler.dart'; |
| 15 | 16 |
| 16 import '../../../tools/testing/dart/multitest.dart' | 17 import '../../../tools/testing/dart/multitest.dart' |
| 17 show ExtractTestsFromMultitest; | 18 show ExtractTestsFromMultitest; |
| 18 import '../../../tools/testing/dart/path.dart' | 19 import '../../../tools/testing/dart/path.dart' |
| 19 show Path; | 20 show Path; |
| 20 | 21 |
| 21 | 22 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 42 ExtractTestsFromMultitest(new Path(fileName), testSources, testOutcomes); | 43 ExtractTestsFromMultitest(new Path(fileName), testSources, testOutcomes); |
| 43 return Future.forEach(testSources.keys, (String testName) async { | 44 return Future.forEach(testSources.keys, (String testName) async { |
| 44 String testFileName = '$fileName/$testName'; | 45 String testFileName = '$fileName/$testName'; |
| 45 Set<String> expectedOutcome = testOutcomes[testName]; | 46 Set<String> expectedOutcome = testOutcomes[testName]; |
| 46 bool expectFailure = testFiles[testFile].contains(testName); | 47 bool expectFailure = testFiles[testFile].contains(testName); |
| 47 DiagnosticCollector collector = new DiagnosticCollector(); | 48 DiagnosticCollector collector = new DiagnosticCollector(); |
| 48 CompilationResult result = await runCompiler( | 49 CompilationResult result = await runCompiler( |
| 49 entryPoint: Uri.parse('memory:$testFileName'), | 50 entryPoint: Uri.parse('memory:$testFileName'), |
| 50 memorySourceFiles: {testFileName: testSources[testName]}, | 51 memorySourceFiles: {testFileName: testSources[testName]}, |
| 51 diagnosticHandler: collector, | 52 diagnosticHandler: collector, |
| 52 options: ['--analyze-only']..addAll(options), | 53 options: [Flags.analyzeOnly]..addAll(options), |
| 53 showDiagnostics: verbose, | 54 showDiagnostics: verbose, |
| 54 cachedCompiler: cachedCompiler); | 55 cachedCompiler: cachedCompiler); |
| 55 var compiler = result.compiler; | 56 var compiler = result.compiler; |
| 56 bool unexpectedResult = false; | 57 bool unexpectedResult = false; |
| 57 if (expectedOutcome.contains('compile-time error')) { | 58 if (expectedOutcome.contains('compile-time error')) { |
| 58 if (collector.errors.isEmpty) { | 59 if (collector.errors.isEmpty) { |
| 59 print('$testFileName: Missing compile-time error.'); | 60 print('$testFileName: Missing compile-time error.'); |
| 60 unexpectedResult = true; | 61 unexpectedResult = true; |
| 61 } | 62 } |
| 62 } else if (expectedOutcome.contains('static type warning')) { | 63 } else if (expectedOutcome.contains('static type warning')) { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 === ERROR: Unexpected result of analysis. | 102 === ERROR: Unexpected result of analysis. |
| 102 === | 103 === |
| 103 === Please update the white-listing in $testFileName | 104 === Please update the white-listing in $testFileName |
| 104 === | 105 === |
| 105 | 106 |
| 106 '''); | 107 '''); |
| 107 exit(1); | 108 exit(1); |
| 108 } | 109 } |
| 109 })); | 110 })); |
| 110 } | 111 } |
| OLD | NEW |