Handle CRLF in skipNewline mode.

This commit is contained in:
Michael Bayne
2014-12-01 16:35:22 -08:00
parent f838c91f99
commit 614bb82b17
2 changed files with 25 additions and 6 deletions
@@ -447,6 +447,25 @@ public class MustacheTest
"endlist", tmpl, context("items", Collections.emptyList()));
}
@Test public void testNewlineSkippingCRLF () {
String tmpl = "list:\r\n" +
"{{#items}}\r\n" +
"{{this}}\r\n" +
"{{/items}}\r\n" +
"{{^items}}\r\n" +
"no items\r\n" +
"{{/items}}\r\n" +
"endlist";
test("list:\r\n" +
"one\r\n" +
"two\r\n" +
"three\r\n" +
"endlist", tmpl, context("items", Arrays.asList("one", "two", "three")));
test("list:\r\n" +
"no items\r\n" +
"endlist", tmpl, context("items", Collections.emptyList()));
}
@Test public void testNewlineNonSkipping () {
// only when a section tag is by itself on a line should we absorb the newline following it
String tmpl = "thing?: {{#thing}}yes{{/thing}}{{^thing}}no{{/thing}}\n" +