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

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

Issue 9006033: Issue926: NPE while traversing nodes + invalid string interpolation (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Not ready for review Created 9 years 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 | « compiler/java/com/google/dart/compiler/parser/DartParser.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: compiler/javatests/com/google/dart/compiler/parser/NegativeParserTest.java
diff --git a/compiler/javatests/com/google/dart/compiler/parser/NegativeParserTest.java b/compiler/javatests/com/google/dart/compiler/parser/NegativeParserTest.java
index d148b2e97d6ecea77ddb9e97c8f3070178930854..3ef6567fc588aadba6a1862f2c15a0b3b4ffcefc 100644
--- a/compiler/javatests/com/google/dart/compiler/parser/NegativeParserTest.java
+++ b/compiler/javatests/com/google/dart/compiler/parser/NegativeParserTest.java
@@ -308,4 +308,31 @@ public class NegativeParserTest extends CompilerTestCase {
errEx(ParserErrorCode.EXPECTED_TOKEN, 3, 7, 5),
errEx(ParserErrorCode.UNEXPECTED_TOKEN, 4, 19, 5));
}
+
+ public void testInvalidStringInterpolation() {
+ parseExpectErrors(Joiner.on("\n").join(
+ "void main() {",
+ " print(\"1 ${42} 2 ${} 3\");",
+ " print(\"1 ${42} 2 ${10;} 3\");",
+ " print(\"1 ${42} 2 ${10,20} 3\");",
+ " print(\"1 ${42} 2 ${10 20} 3\");",
+ " print(\"$\");",
+ " print(\"$",
+ "}"),
+ errEx(ParserErrorCode.UNEXPECTED_TOKEN, 2, 22, 1),
+ errEx(ParserErrorCode.EXPECTED_TOKEN, 2, 23, 3),
+ errEx(ParserErrorCode.EXPECTED_TOKEN, 3, 24, 1),
+ errEx(ParserErrorCode.UNEXPECTED_TOKEN_IN_STRING_INTERPOLATION, 3, 25, 1),
+ errEx(ParserErrorCode.EXPECTED_TOKEN, 4, 24, 1),
+ errEx(ParserErrorCode.UNEXPECTED_TOKEN_IN_STRING_INTERPOLATION, 4, 25, 2),
+ errEx(ParserErrorCode.UNEXPECTED_TOKEN_IN_STRING_INTERPOLATION, 4, 27, 1),
+ errEx(ParserErrorCode.EXPECTED_TOKEN, 5, 25, 2),
+ errEx(ParserErrorCode.UNEXPECTED_TOKEN_IN_STRING_INTERPOLATION, 5, 27, 1),
+ errEx(ParserErrorCode.UNEXPECTED_TOKEN_IN_STRING_INTERPOLATION, 6, 11, 0),
+ errEx(ParserErrorCode.UNEXPECTED_TOKEN_IN_STRING_INTERPOLATION, 7, 11, 0),
+ errEx(ParserErrorCode.UNEXPECTED_TOKEN_IN_STRING_INTERPOLATION, 7, 11, 1),
+ errEx(ParserErrorCode.UNEXPECTED_TOKEN_IN_STRING_INTERPOLATION, 8, 1, 1),
+ errEx(ParserErrorCode.INCOMPLETE_STRING_LITERAL, 8, 1, 1),
+ errEx(ParserErrorCode.EXPECTED_COMMA_OR_RIGHT_PAREN, 8, 2, 0));
+ }
}
« no previous file with comments | « compiler/java/com/google/dart/compiler/parser/DartParser.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698