Fix: parse error if macro defined without arguments

This commit is contained in:
bzick
2015-04-26 22:24:20 +03:00
parent c34d45698a
commit 9269b6b4ad
3 changed files with 276 additions and 105 deletions

View File

@@ -7,22 +7,28 @@ class MacrosTest extends TestCase
public function setUp()
{
parent::setUp();
$this->tpl(
"math.tpl",
'
{macro plus(x, y)}
x + y = {$x + $y}
{/macro}
$this->tpl("math.tpl",
'{macro plus(x, y)}
x + y = {$x + $y}
{/macro}
{macro minus(x, y, z=0)}
x - y - z = {$x - $y - $z}
{/macro}
{macro minus(x, y, z=0)}
x - y - z = {$x - $y - $z}
{/macro}
{macro multi(x, y)}
x * y = {$x * $y}
{/macro}
{macro multi(x, y)}
x * y = {$x * $y}
{/macro}
Math: {macro.plus x=2 y=3}, {macro.minus x=10 y=4}
{macro e()}
2.71827
{/macro}
{macro pi}
3.14159
{/macro}
Math: {macro.plus x=2 y=3}, {macro.minus x=10 y=4}
'
);
@@ -99,6 +105,10 @@ class MacrosTest extends TestCase
exit;
}
/**
* @throws \Exception
* @group macros
*/
public function testMacros()
{
$tpl = $this->fenom->compile('math.tpl');