aboutsummaryrefslogtreecommitdiff
path: root/value/src/test/java/com/google
diff options
context:
space:
mode:
authoremcmanus <emcmanus@google.com>2018-01-22 17:04:06 -0800
committerRon Shapiro <shapiro.rd@gmail.com>2018-01-24 16:00:42 -0500
commit5dd87e2769b93a9146217f7ff7042be69889141d (patch)
tree84ca285242149492edea886532413913fe08d0c7 /value/src/test/java/com/google
parent5344acf2525afaee2874e581b0243a580c6d934d (diff)
downloadauto-5dd87e2769b93a9146217f7ff7042be69889141d.tar.gz
Make reference handling in odd cases more similar to Velocity. If you have `${` not followed by an identifier (so not `${foo.bar}` or whatever) then those are just two plain-text characters. If you have `$foo.!` rather than `$foo.bar` then the `.!` are just plain-text characters.
RELNOTES=n/a ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=182860539
Diffstat (limited to 'value/src/test/java/com/google')
-rw-r--r--value/src/test/java/com/google/auto/value/processor/escapevelocity/TemplateTest.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/value/src/test/java/com/google/auto/value/processor/escapevelocity/TemplateTest.java b/value/src/test/java/com/google/auto/value/processor/escapevelocity/TemplateTest.java
index 16b06b83..32bd0103 100644
--- a/value/src/test/java/com/google/auto/value/processor/escapevelocity/TemplateTest.java
+++ b/value/src/test/java/com/google/auto/value/processor/escapevelocity/TemplateTest.java
@@ -203,6 +203,11 @@ public class TemplateTest {
compare("=${t.name}=", ImmutableMap.of("t", Thread.currentThread()));
}
+ @Test
+ public void substituteNotPropertyId() {
+ compare("$foo.!", ImmutableMap.of("foo", false));
+ }
+
/* TODO(emcmanus): make this work.
@Test
public void substituteNotPropertyId() {
@@ -699,6 +704,14 @@ public class TemplateTest {
}
@Test
+ public void badBraceReference() throws IOException {
+ String template = "line 1\nline 2\nbar${foo.!}baz";
+ thrown.expect(ParseException.class);
+ thrown.expectMessage("Expected }, on line 3, at text starting: .!}baz");
+ Template.parseFrom(new StringReader(template));
+ }
+
+ @Test
public void undefinedMacro() throws IOException {
String template = "#oops()";
thrown.expect(ParseException.class);