Added skipping of newlines immediately following section open and close tags.

This commit is contained in:
Michael Bayne
2010-10-21 23:19:10 +00:00
parent 0bef6a06e5
commit eb225b0b48
2 changed files with 47 additions and 4 deletions
@@ -147,6 +147,25 @@ public class MustacheTest
});
}
@Test public void testNewlineSkipping () {
String tmpl = "list:\n" +
"{{#items}}\n" +
"{{this}}\n" +
"{{/items}}\n" +
"{{^items}}\n" +
"no items\n" +
"{{/items}}\n" +
"endlist";
test("list:\n" +
"one\n" +
"two\n" +
"three\n" +
"endlist", tmpl, context("items", Arrays.asList("one", "two", "three")));
test("list:\n" +
"no items\n" +
"endlist", tmpl, context("items", Collections.emptyList()));
}
protected void test (String expected, String template, Object ctx)
{
assertEquals(expected, Mustache.compiler().compile(template).execute(ctx));