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 efbc43fc2d8461c9d5d2becacea629004482e1fe..457a4f03f232f7bdf1dc915f117bc9e22a68e70a 100644 |
--- a/tests/compiler/dart2js/missing_file_test.dart |
+++ b/tests/compiler/dart2js/missing_file_test.dart |
@@ -14,35 +14,73 @@ import 'memory_compiler.dart'; |
const MEMORY_SOURCE_FILES = const { |
'main.dart': ''' |
- |
import 'foo.dart'; |
+main() {} |
+''', |
+'bar.dart': ''' |
+import 'dart:foo'; |
+main() {} |
+''', |
+ |
+'baz.dart': ''' |
+import 'dart:io'; |
main() {} |
''', |
}; |
-Future runTest(Uri main, MessageKind expectedMessageKind) async { |
- print("\n\n\n"); |
+Future runTest(Uri main, |
+ {MessageKind error, |
+ MessageKind info}) async { |
+ print("----\nentry-point: $main\n"); |
DiagnosticCollector diagnostics = new DiagnosticCollector(); |
OutputCollector output = new OutputCollector(); |
await runCompiler( |
+ entryPoint: main, |
memorySourceFiles: MEMORY_SOURCE_FILES, |
diagnosticHandler: diagnostics, |
outputProvider: output); |
Expect.isFalse(output.hasExtraOutput); |
- Expect.equals(1, diagnostics.errors.length); |
- Expect.equals(expectedMessageKind, diagnostics.errors.first.message.kind); |
+ Expect.equals(error != null ? 1 : 0, diagnostics.errors.length); |
+ if (error != null) { |
+ Expect.equals(error, diagnostics.errors.first.message.kind); |
+ } |
+ Expect.equals(info != null ? 1 : 0, diagnostics.infos.length); |
+ if (info != null) { |
+ Expect.equals(info, diagnostics.infos.first.message.kind); |
+ } |
+ Expect.equals(0, diagnostics.warnings.length); |
+ Expect.equals(0, diagnostics.hints.length); |
} |
void main() { |
asyncTest(() async { |
await runTest( |
- Uri.parse('memory:main.dart'), MessageKind.READ_SCRIPT_ERROR); |
+ Uri.parse('memory:main.dart'), |
+ error: MessageKind.READ_SCRIPT_ERROR); |
+ |
+ await runTest( |
+ Uri.parse('memory:foo.dart'), |
+ error: MessageKind.READ_SELF_ERROR); |
+ |
+ await runTest( |
+ Uri.parse('dart:foo'), |
+ error: MessageKind.LIBRARY_NOT_FOUND); |
+ |
await runTest( |
- Uri.parse('memory:foo.dart'), MessageKind.READ_SCRIPT_ERROR); |
+ Uri.parse('dart:io'), |
+ error: MessageKind.LIBRARY_NOT_SUPPORTED, |
+ info: MessageKind.DISALLOWED_LIBRARY_IMPORT); |
+ |
+ await runTest( |
+ Uri.parse('memory:bar.dart'), |
+ error: MessageKind.LIBRARY_NOT_FOUND); |
+ |
await runTest( |
- Uri.parse('dart:foo'), MessageKind.READ_SCRIPT_ERROR); |
+ Uri.parse('memory:baz.dart'), |
+ error: MessageKind.LIBRARY_NOT_SUPPORTED, |
+ info: MessageKind.DISALLOWED_LIBRARY_IMPORT); |
}); |
} |