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

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

Issue 2981343002: improve fasta closing brace recovery (Closed)
Patch Set: rebase Created 3 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 | « pkg/front_end/test/scanner_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/error_token_test.dart
diff --git a/tests/compiler/dart2js/error_token_test.dart b/tests/compiler/dart2js/error_token_test.dart
index 6c99b6d4b2212e4f98b6e105582d5984c6bfbf0c..0423c875bc11387c55f1169e87a05383b34ea4d7 100644
--- a/tests/compiler/dart2js/error_token_test.dart
+++ b/tests/compiler/dart2js/error_token_test.dart
@@ -12,7 +12,8 @@ import "package:compiler/src/diagnostics/messages.dart";
import 'package:expect/expect.dart';
import 'memory_compiler.dart';
-Future runTest(String code, {MessageKind error}) async {
+Future runTest(String code,
+ {MessageKind error, int expectedWarningCount: 0}) async {
DiagnosticCollector diagnostics = new DiagnosticCollector();
OutputCollector output = new OutputCollector();
await runCompiler(
@@ -22,10 +23,9 @@ Future runTest(String code, {MessageKind error}) async {
outputProvider: output);
Expect.equals(error != null ? 1 : 0, diagnostics.errors.length);
- if (error != null) {
+ if (error != null)
Expect.equals(error, diagnostics.errors.first.message.kind);
- }
- Expect.equals(0, diagnostics.warnings.length);
+ Expect.equals(expectedWarningCount, diagnostics.warnings.length);
Expect.equals(0, diagnostics.hints.length);
Expect.equals(0, diagnostics.infos.length);
}
@@ -34,23 +34,25 @@ void main() {
asyncTest(() async {
await runTest(
'''
-main() {}
+main() {Foo.bar();}
class Foo {
static void bar() {
baz());
}
}
''',
- error: MessageKind.UNMATCHED_TOKEN);
+ error: MessageKind.MISSING_TOKEN_AFTER_THIS,
+ expectedWarningCount: 1);
await runTest(
'''
-main() {}
+main() {new C(v);}
class C {
C(v) {
throw '');
}
}''',
- error: MessageKind.UNMATCHED_TOKEN);
+ error: MessageKind.MISSING_TOKEN_AFTER_THIS,
+ expectedWarningCount: 1);
});
}
« no previous file with comments | « pkg/front_end/test/scanner_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698