| Index: tests/compiler/dart2js/missing_file_test.dart
|
| diff --git a/tests/compiler/dart2js/missing_file_test.dart b/tests/compiler/dart2js/missing_file_test.dart
|
| index 630063b8efe28d122dd2180d2ab825df1f01b500..7d88eb8eb56029b250a41c93e053734c063fa68d 100644
|
| --- a/tests/compiler/dart2js/missing_file_test.dart
|
| +++ b/tests/compiler/dart2js/missing_file_test.dart
|
| @@ -6,17 +6,11 @@
|
|
|
| library dart2js.test.missing_file;
|
|
|
| -import 'package:expect/expect.dart';
|
| -import "package:async_helper/async_helper.dart";
|
| -import 'memory_source_file_helper.dart';
|
| -
|
| -import 'package:compiler/src/dart2jslib.dart'
|
| - show NullSink;
|
| -
|
| -import 'package:compiler/compiler.dart'
|
| - show DiagnosticHandler, Diagnostic;
|
| -
|
| import 'dart:async';
|
| +import 'package:async_helper/async_helper.dart';
|
| +import 'package:compiler/src/dart2jslib.dart';
|
| +import 'package:expect/expect.dart';
|
| +import 'memory_compiler.dart';
|
|
|
| const MEMORY_SOURCE_FILES = const {
|
| 'main.dart': '''
|
| @@ -29,40 +23,18 @@ main() {}
|
|
|
| Future runCompiler(Uri main, String expectedMessage) {
|
| print("\n\n\n");
|
| - Uri script = currentDirectory.resolveUri(Platform.script);
|
| - Uri libraryRoot = script.resolve('../../../sdk/');
|
| - Uri packageRoot = script.resolve('./packages/');
|
| -
|
| - var provider = new MemorySourceFileProvider(MEMORY_SOURCE_FILES);
|
| - var handler = new FormattingDiagnosticHandler(provider);
|
| - var errors = [];
|
| -
|
| - void diagnosticHandler(Uri uri, int begin, int end, String message,
|
| - Diagnostic kind) {
|
| - if (kind == Diagnostic.ERROR) {
|
| - errors.add(message);
|
| - }
|
| - handler(uri, begin, end, message, kind);
|
| - }
|
| -
|
| -
|
| - EventSink<String> outputProvider(String name, String extension) {
|
| - if (name != '') throw 'Attempt to output file "$name.$extension"';
|
| - return new NullSink('$name.$extension');
|
| - }
|
|
|
| - Compiler compiler = new Compiler(provider,
|
| - outputProvider,
|
| - diagnosticHandler,
|
| - libraryRoot,
|
| - packageRoot,
|
| - [],
|
| - {});
|
| + DiagnosticCollector diagnostics = new DiagnosticCollector();
|
| + OutputCollector output = new OutputCollector();
|
| + Compiler compiler = compilerFor(
|
| + MEMORY_SOURCE_FILES,
|
| + diagnosticHandler: diagnostics,
|
| + outputProvider: output);
|
|
|
| return compiler.run(main).then((_) {
|
| - Expect.equals(1, errors.length);
|
| - Expect.equals(expectedMessage,
|
| - errors[0]);
|
| + Expect.isFalse(output.hasExtraOutput);
|
| + Expect.equals(1, diagnostics.errors.length);
|
| + Expect.equals(expectedMessage, diagnostics.errors.first.message);
|
| });
|
| }
|
|
|
|
|