Commit 9364271e by seldaek

Fixes parsing of multi-line if (and other) statements

git-svn-id: http://svn.dwoo.org/trunk@327 0598d79b-80c4-4d41-97ba-ac86fbbd088b
parent 9eb8c960
...@@ -2493,6 +2493,7 @@ class Dwoo_Compiler implements Dwoo_ICompiler ...@@ -2493,6 +2493,7 @@ class Dwoo_Compiler implements Dwoo_ICompiler
} }
$src = $substr; $src = $substr;
$substr = trim($substr);
if (strtolower($substr) === 'false' || strtolower($substr) === 'no' || strtolower($substr) === 'off') { if (strtolower($substr) === 'false' || strtolower($substr) === 'no' || strtolower($substr) === 'off') {
if ($this->debug) echo 'BOOLEAN(FALSE) PARSED<br />'; if ($this->debug) echo 'BOOLEAN(FALSE) PARSED<br />';
......
...@@ -672,7 +672,7 @@ replace="BAR" ...@@ -672,7 +672,7 @@ replace="BAR"
$tpl->forceCompilation(); $tpl->forceCompilation();
$this->assertEquals('foo', $this->dwoo->get($tpl, array(), $this->compiler)); $this->assertEquals('foo', $this->dwoo->get($tpl, array(), $this->compiler));
} }
public function testStaticPropertyAccess() public function testStaticPropertyAccess()
{ {
$tpl = new Dwoo_Template_String('{StaticHelper::$foo}/{StaticHelper::$foo * StaticHelper::$foo + 5}/{upper StaticHelper::$foo}/{StaticHelper::$foo++}/{StaticHelper::$foo}'); $tpl = new Dwoo_Template_String('{StaticHelper::$foo}/{StaticHelper::$foo * StaticHelper::$foo + 5}/{upper StaticHelper::$foo}/{StaticHelper::$foo++}/{StaticHelper::$foo}');
...@@ -686,6 +686,16 @@ replace="BAR" ...@@ -686,6 +686,16 @@ replace="BAR"
$tpl->forceCompilation(); $tpl->forceCompilation();
$this->assertEquals('a:b:c:d:e:f', $this->dwoo->get($tpl, array(), $this->compiler)); $this->assertEquals('a:b:c:d:e:f', $this->dwoo->get($tpl, array(), $this->compiler));
} }
public function testParsingOfMultilineIf()
{
$tpl = new Dwoo_Template_String('{if 0
|| $null == "aa"}
fail
{/if}');
$tpl->forceCompilation();
$this->assertEquals('', trim($this->dwoo->get($tpl, array(), $this->compiler)));
}
} }
function excessArgsHelper($a) { function excessArgsHelper($a) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment