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

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

Issue 1564803002: Specialize message for parts as entry point (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comment Created 4 years, 11 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/diagnostic_helper.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/import_test.dart
diff --git a/tests/compiler/dart2js/import_test.dart b/tests/compiler/dart2js/import_test.dart
index ddd49927583ef6961b0adc86f47454a9c2256db4..0fbe10ed89074d32cc9f6bbe640e6ca0286614fb 100644
--- a/tests/compiler/dart2js/import_test.dart
+++ b/tests/compiler/dart2js/import_test.dart
@@ -9,6 +9,8 @@ library dart2js.test.import;
import 'package:expect/expect.dart';
import 'package:async_helper/async_helper.dart';
+import 'package:compiler/src/diagnostics/messages.dart';
+import 'package:compiler/compiler.dart';
import 'memory_compiler.dart';
const MEMORY_SOURCE_FILES = const {
@@ -26,15 +28,55 @@ main() {
int i = "";
}
''',
+ 'part.dart': '''
+part of lib;
+
+main() {}
+''',
+ 'lib.dart': '''
+library lib;
+
+import 'part.dart';
+
+part 'part.dart';
+''',
};
+testEntryPointIsPart() async {
+ var collector = new DiagnosticCollector();
+ await runCompiler(
+ entryPoint: Uri.parse('memory:part.dart'),
+ memorySourceFiles: MEMORY_SOURCE_FILES,
+ diagnosticHandler: collector);
+
+ collector.checkMessages([
+ const Expected.error(MessageKind.MAIN_HAS_PART_OF)]);
+}
+
+testImportPart() async {
+ var collector = new DiagnosticCollector();
+ await runCompiler(
+ entryPoint: Uri.parse('memory:lib.dart'),
+ memorySourceFiles: MEMORY_SOURCE_FILES,
+ diagnosticHandler: collector);
+
+ collector.checkMessages([
+ const Expected.error(MessageKind.IMPORT_PART_OF),
+ const Expected.info(MessageKind.IMPORT_PART_OF_HERE)]);
+}
+
testMissingImports() async {
var collector = new DiagnosticCollector();
await runCompiler(
memorySourceFiles: MEMORY_SOURCE_FILES,
diagnosticHandler: collector);
- Expect.equals(4, collector.errors.length);
- Expect.equals(1, collector.warnings.length);
+
+ collector.checkMessages([
+ const Expected.error(MessageKind.READ_SCRIPT_ERROR),
+ const Expected.error(MessageKind.LIBRARY_NOT_FOUND),
+ const Expected.error(MessageKind.READ_SCRIPT_ERROR),
+ const Expected.error(MessageKind.READ_SCRIPT_ERROR),
+ const Expected.warning(MessageKind.NOT_ASSIGNABLE)]);
}
testMissingMain() async {
@@ -42,12 +84,14 @@ testMissingMain() async {
await runCompiler(
entryPoint: Uri.parse('memory:missing.dart'),
diagnosticHandler: collector);
- Expect.equals(1, collector.errors.length);
- Expect.equals(0, collector.warnings.length);
+ collector.checkMessages([
+ const Expected.error(MessageKind.READ_SELF_ERROR)]);
}
void main() {
asyncTest(() async {
+ await testEntryPointIsPart();
+ await testImportPart();
await testMissingImports();
await testMissingMain();
});
« no previous file with comments | « tests/compiler/dart2js/diagnostic_helper.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698