Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #48 from gw0/bug-subblockcaching

Improved inheritance test with sub sub replacing block that fails while caching
  • Loading branch information...
commit d30e9fdd312d3f4928e2e2308935d73ae987dc54 2 parents 1da1327 + 27239e0
@spullara authored
View
15 compiler/src/test/java/com/github/mustachejava/ExtensionTest.java
@@ -109,6 +109,7 @@ public void testClientMethod() throws MustacheException, IOException, ExecutionE
assertEquals(getContents(root, "client.txt"), sw.toString());
}
+ @Test
public void testSubSubCaching() throws MustacheException, IOException, ExecutionException, InterruptedException {
MustacheFactory c = new DefaultMustacheFactory(root);
Mustache m = c.compile("subsubchild1.html");
@@ -122,6 +123,20 @@ public void testSubSubCaching() throws MustacheException, IOException, Execution
assertEquals(getContents(root, "subsubchild2.txt"), sw.toString());
}
+ @Test
+ public void testSubSubCaching2() throws MustacheException, IOException, ExecutionException, InterruptedException {
+ MustacheFactory c = new DefaultMustacheFactory(root);
+ Mustache m = c.compile("subsubchild1.html");
+ StringWriter sw = new StringWriter();
+ m.execute(sw, new Object() {});
+ assertEquals(getContents(root, "subsubchild1.txt"), sw.toString());
+
+ m = c.compile("subsubchild3.html");
+ sw = new StringWriter();
+ m.execute(sw, new Object() {});
+ assertEquals(getContents(root, "subsubchild3.txt"), sw.toString());
+ }
+
protected String getContents(File root, String file) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(new File(root, file)),"UTF-8"));
StringWriter capture = new StringWriter();
View
4 compiler/src/test/resources/subsubchild2.txt
@@ -1 +1,3 @@
-dummy
+precontent
+
+postcontent
View
7 compiler/src/test/resources/subsubchild3.html
@@ -0,0 +1,7 @@
+{{<subsubmiddle}}
+
+{{$content}}
+third
+{{/content}}
+
+{{/subsubmiddle}}
View
4 compiler/src/test/resources/subsubchild3.txt
@@ -0,0 +1,4 @@
+precontent
+third
+
+postcontent
View
4 compiler/src/test/resources/subsubsuper.html
@@ -1,3 +1,5 @@
{{$content_base}}
-dummy
+precontent
+{{$content}}{{/content}}
+postcontent
{{/content_base}}
Please sign in to comment.
Something went wrong with that request. Please try again.