aboutsummaryrefslogtreecommitdiff
path: root/javatests
diff options
context:
space:
mode:
authorcushon <cushon@google.com>2018-10-01 16:59:25 -0700
committerLiam Miller-Cushon <cushon@google.com>2018-10-17 20:45:16 -0700
commit4b6a14fefe99e5f172d233a5ccb7d124afa43c0f (patch)
tree37541dda2848c8ab8e95c02f6db3ae06a76991e2 /javatests
parent72e07cbbf3b539f280cc7059c03123d3433b7512 (diff)
downloadturbine-4b6a14fefe99e5f172d233a5ccb7d124afa43c0f.tar.gz
Report better errors for unterminated string literals
MOE_MIGRATED_REVID=215306391
Diffstat (limited to 'javatests')
-rw-r--r--javatests/com/google/turbine/parse/ParseErrorTest.java16
1 files changed, 16 insertions, 0 deletions
diff --git a/javatests/com/google/turbine/parse/ParseErrorTest.java b/javatests/com/google/turbine/parse/ParseErrorTest.java
index c728c8a..30ff061 100644
--- a/javatests/com/google/turbine/parse/ParseErrorTest.java
+++ b/javatests/com/google/turbine/parse/ParseErrorTest.java
@@ -154,6 +154,22 @@ public class ParseErrorTest {
}
}
+ @Test
+ public void unterminatedString() {
+ String input = "class T { String s = \"hello\nworld\"; }";
+ try {
+ Parser.parse(input);
+ fail("expected parsing to fail");
+ } catch (TurbineError e) {
+ assertThat(e.getMessage())
+ .isEqualTo(
+ lines(
+ "<>:1: error: unterminated string literal", //
+ "class T { String s = \"hello",
+ " ^"));
+ }
+ }
+
private static String lines(String... lines) {
return Joiner.on(System.lineSeparator()).join(lines);
}