浏览代码

Add a failing test case for #322

Justin Hileman 8 年之前
父节点
当前提交
9e34408bda
共有 1 个文件被更改,包括 17 次插入0 次删除
  1. 17 0
      test/Mustache/Test/Functional/InheritanceTest.php

+ 17 - 0
test/Mustache/Test/Functional/InheritanceTest.php

@@ -227,6 +227,23 @@ class Mustache_Test_Functional_InheritanceTest extends PHPUnit_Framework_TestCas
         $this->assertEquals('test |override1 default| |override2 default|', $tpl->render($data));
     }
 
+    public function testBlocksDoNotLeakBetweenPartials()
+    {
+        $partials = array(
+            'partial' => '|{{$a}}A{{/a}} {{$b}}B{{/b}}|',
+        );
+
+        $this->mustache->setPartials($partials);
+
+        $tpl = $this->mustache->loadTemplate(
+            'test {{<partial}}{{$a}}C{{/a}}{{/partial}} {{<partial}}{{$b}}D{{/b}}{{/partial}}'
+        );
+
+        $data = array();
+
+        $this->assertEquals('test |C B| |A D|', $tpl->render($data));
+    }
+
     public function testDataDoesNotOverrideBlock()
     {
         $partials = array(