Skip to content

Commit 8c97ec4

Browse files
committed
ISSUR-280: example of delaying parsing and execution when you don't need it cached, though you could still cache it yourself.
1 parent 43fd04a commit 8c97ec4

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

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

+17
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,23 @@ public void testRootCheck() throws MustacheException, IOException, ExecutionExce
254254
}
255255
}
256256

257+
public void testIssue280() throws IOException {
258+
MustacheFactory c = createMustacheFactory();
259+
StringWriter sw = new StringWriter();
260+
Mustache m = c.compile(new StringReader("{{{template}}}"), "test");
261+
Object o = new Object() {
262+
String template() throws IOException {
263+
MustacheFactory c = createMustacheFactory();
264+
StringWriter sw = new StringWriter();
265+
Mustache m = c.compile("template.html");
266+
m.execute(sw, new Object()).flush();
267+
return sw.toString();
268+
}
269+
};
270+
m.execute(sw, o).flush();
271+
assertTrue(sw.toString().startsWith("<html>"));
272+
}
273+
257274
public void testSimpleFiltered() throws MustacheException, IOException, ExecutionException, InterruptedException {
258275
MustacheFactory c = new DefaultMustacheFactory(root) {
259276
@Override

0 commit comments

Comments
 (0)