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

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

Issue 1247773002: Add access the Message in CompilerDiagnostics.report. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comment. Created 5 years, 5 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/memory_compiler.dart ('k') | tests/compiler/dart2js/package_root_test.dart » ('j') | 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 7d88eb8eb56029b250a41c93e053734c063fa68d..26a4e9b0d445fd8a063366aeba468c974422c5c5 100644
--- a/tests/compiler/dart2js/missing_file_test.dart
+++ b/tests/compiler/dart2js/missing_file_test.dart
@@ -21,34 +21,28 @@ main() {}
''',
};
-Future runCompiler(Uri main, String expectedMessage) {
+Future runTest(Uri main, MessageKind expectedMessageKind) async {
print("\n\n\n");
DiagnosticCollector diagnostics = new DiagnosticCollector();
OutputCollector output = new OutputCollector();
- Compiler compiler = compilerFor(
- MEMORY_SOURCE_FILES,
+ await runCompiler(
+ memorySourceFiles: MEMORY_SOURCE_FILES,
diagnosticHandler: diagnostics,
outputProvider: output);
- return compiler.run(main).then((_) {
- Expect.isFalse(output.hasExtraOutput);
- Expect.equals(1, diagnostics.errors.length);
- Expect.equals(expectedMessage, diagnostics.errors.first.message);
- });
+ Expect.isFalse(output.hasExtraOutput);
+ Expect.equals(1, diagnostics.errors.length);
+ Expect.equals(expectedMessageKind, diagnostics.errors.first.message.kind);
}
void main() {
- asyncTest(() => Future.forEach([
- () => runCompiler(
- Uri.parse('memory:main.dart'),
- "Can't read 'memory:foo.dart' "
- "(Exception: No such file memory:foo.dart)."),
- () => runCompiler(
- Uri.parse('memory:foo.dart'),
- "Exception: No such file memory:foo.dart"),
- () => runCompiler(
- Uri.parse('dart:foo'),
- "Library not found 'dart:foo'."),
- ], (f) => f()));
+ asyncTest(() async {
+ await runTest(
+ Uri.parse('memory:main.dart'), MessageKind.READ_SCRIPT_ERROR);
+ await runTest(
+ Uri.parse('memory:foo.dart'), MessageKind.READ_SCRIPT_ERROR);
+ await runTest(
+ Uri.parse('dart:foo'), MessageKind.READ_SCRIPT_ERROR);
+ });
}
« no previous file with comments | « tests/compiler/dart2js/memory_compiler.dart ('k') | tests/compiler/dart2js/package_root_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698