Skip to content

Commit ebf8cbe

Browse files
committed
add another test for recursion.
1 parent 60d1340 commit ebf8cbe

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

compiler/src/test/java/com/github/mustachejava/InterpreterTest.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,19 @@ protected DefaultMustacheFactory createMustacheFactory() {
5050
return new DefaultMustacheFactory(root);
5151
}
5252

53+
public void testRecurision() throws IOException {
54+
MustacheFactory c = createMustacheFactory();
55+
Mustache m = c.compile("recursion.html");
56+
StringWriter sw = new StringWriter();
57+
m.execute(sw, new Object() {
58+
Object value = new Object() {
59+
boolean value = false;
60+
};
61+
});
62+
assertEquals(getContents(root, "recursion.txt"), sw.toString());
63+
64+
}
65+
5366
public void testSimplePragma() throws MustacheException, IOException, ExecutionException, InterruptedException {
5467
MustacheFactory c = createMustacheFactory();
5568
Mustache m = c.compile("simplepragma.html");

src/test/resources/recursion.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Test
2+
{{#value}}
3+
{{>recursion}}
4+
{{/value}}

src/test/resources/recursion.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Test
2+
Test
3+

0 commit comments

Comments
 (0)