From dfdf343b2dc809081a17d143bb1f859a227e3c75 Mon Sep 17 00:00:00 2001 From: Uwe Tews Date: Wed, 21 Mar 2018 07:35:25 +0100 Subject: [PATCH] https://github.com/smarty-php/smarty/issues/422 --- .../_Issues/422/NestedLoopIssue422Test.php | 35 +++++++++++++++++++ .../_Issues/422/cache/dummy.txt | 1 + .../_Issues/422/templates/422_test.tpl | 8 +++++ .../_Issues/422/templates_c/dummy.txt | 1 + 4 files changed, 45 insertions(+) create mode 100644 tests/UnitTests/TemplateSource/_Issues/422/NestedLoopIssue422Test.php create mode 100644 tests/UnitTests/TemplateSource/_Issues/422/cache/dummy.txt create mode 100644 tests/UnitTests/TemplateSource/_Issues/422/templates/422_test.tpl create mode 100644 tests/UnitTests/TemplateSource/_Issues/422/templates_c/dummy.txt diff --git a/tests/UnitTests/TemplateSource/_Issues/422/NestedLoopIssue422Test.php b/tests/UnitTests/TemplateSource/_Issues/422/NestedLoopIssue422Test.php new file mode 100644 index 00000000..c541b3cb --- /dev/null +++ b/tests/UnitTests/TemplateSource/_Issues/422/NestedLoopIssue422Test.php @@ -0,0 +1,35 @@ +setUpSmarty(dirname(__FILE__)); + } + + public function testInit() + { + $this->cleanDirs(); + } + + public function testnested422() + { + $this->assertEquals('loop: 1inner: 0loop: 2inner: 1', $this->smarty->fetch('422_test.tpl')); + } + +} diff --git a/tests/UnitTests/TemplateSource/_Issues/422/cache/dummy.txt b/tests/UnitTests/TemplateSource/_Issues/422/cache/dummy.txt new file mode 100644 index 00000000..2995a4d0 --- /dev/null +++ b/tests/UnitTests/TemplateSource/_Issues/422/cache/dummy.txt @@ -0,0 +1 @@ +dummy \ No newline at end of file diff --git a/tests/UnitTests/TemplateSource/_Issues/422/templates/422_test.tpl b/tests/UnitTests/TemplateSource/_Issues/422/templates/422_test.tpl new file mode 100644 index 00000000..09fb9d41 --- /dev/null +++ b/tests/UnitTests/TemplateSource/_Issues/422/templates/422_test.tpl @@ -0,0 +1,8 @@ +{strip} +{assign var=samplearr value=[["list" => []],["list" => ["item"]]]} +{foreach $samplearr as $v} + {section name=inner loop=$v.list} + {/section} + loop: {$v@iteration} + inner: {$smarty.section.inner.total} +{/foreach} \ No newline at end of file diff --git a/tests/UnitTests/TemplateSource/_Issues/422/templates_c/dummy.txt b/tests/UnitTests/TemplateSource/_Issues/422/templates_c/dummy.txt new file mode 100644 index 00000000..2995a4d0 --- /dev/null +++ b/tests/UnitTests/TemplateSource/_Issues/422/templates_c/dummy.txt @@ -0,0 +1 @@ +dummy \ No newline at end of file