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

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

Issue 1338783002: Show import chains for unsupported dart:* library imports. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Update cf. comments. Created 5 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/message_kind_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
});
}
« no previous file with comments | « tests/compiler/dart2js/message_kind_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698