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

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

Issue 11367007: Tests owed. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 2 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
Index: dart/tests/compiler/dart2js/parser_test.dart
diff --git a/dart/tests/compiler/dart2js/parser_test.dart b/dart/tests/compiler/dart2js/parser_test.dart
index 3847f48b22cd9cf759c74d19c87c82f39a37ed0d..db4a8cd387d4e6cf64043b49a6f19ed613b71b07 100644
--- a/dart/tests/compiler/dart2js/parser_test.dart
+++ b/dart/tests/compiler/dart2js/parser_test.dart
@@ -265,6 +265,32 @@ void testOperatorParse() {
Expect.isNull(function.getOrSet);
}
+class Collector implements DiagnosticListener {
+ final List<int> tokens = <int>[];
+
+ void cancel(String reason, {node, token, instruction, element}) {
+ tokens.add(token.kind);
+ throw this;
+ }
+
+ void log(message) {
+ print(message);
+ }
+}
+
+void testMissingCloseParen() {
+ final String source =
+'''foo(x { // <= missing closing ")"
+ return x;
+}''';
+ Expect.throws(() => parseMember(source, lc: new Collector()),
+ (Collector c) {
+ Expect.listEquals(const <int>[OPEN_CURLY_BRACKET_TOKEN],
+ c.tokens);
+ return true;
+ });
+}
+
void main() {
testGenericTypes();
// TODO(ahe): Enable this test when we handle library prefixes.
@@ -279,4 +305,5 @@ void main() {
testIndex();
testPostfix();
testOperatorParse();
+ testMissingCloseParen();
}

Powered by Google App Engine
This is Rietveld 408576698