Correct number of braces for error message

This commit is contained in:
robbytx
2014-03-12 13:00:27 -05:00
committed by Michael Bayne
parent df1cf9286f
commit 5c3a93e079
2 changed files with 10 additions and 1 deletions
@@ -457,7 +457,7 @@ public class Mustache
int end3 = (char)source.read();
if (end3 != '}') {
throw new MustacheParseException(
"Invalid triple-mustache tag: {{{" + text + "}}", line);
"Invalid triple-mustache tag: {{{" + text.substring(1) + "}}", line);
}
} catch (IOException e) {
throw new MustacheException(e);
@@ -583,6 +583,15 @@ public class MustacheTest
});
}
@Test public void testInvalidTripleMustache () {
try {
Mustache.compiler().compile("{{{foo}}");
fail("Expected MustacheParseException");
} catch (MustacheParseException e) {
assertEquals("Invalid triple-mustache tag: {{{foo}} @ line 1", e.getMessage());
}
}
@Test public void testNullValueGetsNullDefault () {
test(Mustache.compiler().nullValue("foo"),
"foobar", "{{nullvar}}{{nonnullvar}}", new Object() {