Permalink
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...
2 parents 1da1327 + 27239e0 commit d30e9fdd312d3f4928e2e2308935d73ae987dc54 @spullara committed Aug 19, 2012
@@ -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();
@@ -1 +1,3 @@
-dummy
+precontent
+
+postcontent
@@ -0,0 +1,7 @@
+{{<subsubmiddle}}
+
+{{$content}}
+third
+{{/content}}
+
+{{/subsubmiddle}}
@@ -0,0 +1,4 @@
+precontent
+third
+
+postcontent
@@ -1,3 +1,5 @@
{{$content_base}}
-dummy
+precontent
+{{$content}}{{/content}}
+postcontent
{{/content_base}}

0 comments on commit d30e9fd

Please sign in to comment.