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

Unified Diff: compiler/javatests/com/google/dart/compiler/parser/SyntaxTest.java

Issue 11280155: Issue 6908. Fix parsing look for receiver.() in switch. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month 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: compiler/javatests/com/google/dart/compiler/parser/SyntaxTest.java
diff --git a/compiler/javatests/com/google/dart/compiler/parser/SyntaxTest.java b/compiler/javatests/com/google/dart/compiler/parser/SyntaxTest.java
index 5b4ab919fcf3fd88805102ca36d7190e31d05e6e..c18fd6503c7f3638f6c49d725016e818af24e60b 100644
--- a/compiler/javatests/com/google/dart/compiler/parser/SyntaxTest.java
+++ b/compiler/javatests/com/google/dart/compiler/parser/SyntaxTest.java
@@ -40,6 +40,9 @@ import com.google.dart.compiler.ast.DartVariable;
import com.google.dart.compiler.ast.DartVariableStatement;
import com.google.dart.compiler.ast.NodeList;
+import static com.google.dart.compiler.common.ErrorExpectation.assertErrors;
+import static com.google.dart.compiler.common.ErrorExpectation.errEx;
+
import java.util.List;
public class SyntaxTest extends AbstractParserTest {
@@ -84,6 +87,28 @@ public class SyntaxTest extends AbstractParserTest {
ParserErrorCode.EXPECTED_TOKEN, 3, 12);
}
+ /**
+ * There was bug that handling missing identifier (method name) after "cursor." in switch caused
+ * infinite parsing loop.
+ * <p>
+ * http://code.google.com/p/dart/issues/detail?id=6908
+ */
+ public void test_switch_noMethodName_inCase() {
+ DartParserRunner runner = parseSource(Joiner.on("\n").join(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "void main() {",
+ " print((e) {",
+ " switch (e) {",
+ " case 'Up': cursor.();",
+ " case 'Down':",
+ " }",
+ " }); ",
+ "}",
+ ""));
+ assertErrors(runner.getErrors(),
+ errEx(ParserErrorCode.INVALID_IDENTIFIER, 5, 24, 1));
+ }
+
public void test_getter() {
parseUnit("getter.dart", Joiner.on("\n").join(
"class G {",

Powered by Google App Engine
This is Rietveld 408576698