Factor the tests a bit.
This commit is contained in:
@@ -429,40 +429,29 @@ public class MustacheTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test public void testNewlineSkipping () {
|
@Test public void testNewlineSkipping () {
|
||||||
String tmpl = "list:\n" +
|
testNewlineSkipping("\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()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test public void testNewlineSkippingCRLF () {
|
@Test public void testNewlineSkippingCRLF () {
|
||||||
String tmpl = "list:\r\n" +
|
testNewlineSkipping("\r\n");
|
||||||
"{{#items}}\r\n" +
|
}
|
||||||
"{{this}}\r\n" +
|
|
||||||
"{{/items}}\r\n" +
|
protected void testNewlineSkipping (String sep) {
|
||||||
"{{^items}}\r\n" +
|
String tmpl = "list:" + sep +
|
||||||
"no items\r\n" +
|
"{{#items}}" + sep +
|
||||||
"{{/items}}\r\n" +
|
"{{this}}" + sep +
|
||||||
|
"{{/items}}" + sep +
|
||||||
|
"{{^items}}" + sep +
|
||||||
|
"no items" + sep +
|
||||||
|
"{{/items}}" + sep +
|
||||||
"endlist";
|
"endlist";
|
||||||
test("list:\r\n" +
|
test("list:" + sep +
|
||||||
"one\r\n" +
|
"one" + sep +
|
||||||
"two\r\n" +
|
"two" + sep +
|
||||||
"three\r\n" +
|
"three" + sep +
|
||||||
"endlist", tmpl, context("items", Arrays.asList("one", "two", "three")));
|
"endlist", tmpl, context("items", Arrays.asList("one", "two", "three")));
|
||||||
test("list:\r\n" +
|
test("list:" + sep +
|
||||||
"no items\r\n" +
|
"no items" + sep +
|
||||||
"endlist", tmpl, context("items", Collections.emptyList()));
|
"endlist", tmpl, context("items", Collections.emptyList()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user