Commit 691afcaa by Seldaek

Added a few tests for regressions and fixed a parameter parsing bug for sub-templates

git-svn-id: svn://dwoo.org/dwoo/trunk@240 0598d79b-80c4-4d41-97ba-ac86fbbd088b
parent a6a50002
......@@ -1663,11 +1663,11 @@ class Dwoo_Compiler implements Dwoo_ICompiler
$param = '*';
}
$hasDefault = $defValue !== null;
if ($defValue == 'null') {
if ($defValue === 'null') {
$defValue = null;
} elseif ($defValue == 'false') {
} elseif ($defValue === 'false') {
$defValue = false;
} elseif ($defValue == 'true') {
} elseif ($defValue === 'true') {
$defValue = true;
} elseif (preg_match('#^([\'"]).*?\1$#', $defValue)) {
$defValue = substr($defValue, 1, -1);
......
......@@ -77,4 +77,36 @@ class BugTests extends PHPUnit_Framework_TestCase
$this->assertEquals("-3", $this->dwoo->get($tpl, array()));
}
public function testUppercasePlugin()
{
$tpl = new Dwoo_Template_String('{X foo}');
$tpl->forceCompilation();
$this->assertEquals("foo", $this->dwoo->get($tpl, array()));
}
public function testMultilineAssignments()
{
$tpl = new Dwoo_Template_String('{$foo = array(
moo=bar
foo=baz
)}{foreach $foo k v}{$k; $v}.{/foreach}');
$tpl->forceCompilation();
$this->assertEquals("moobar.foobaz.", $this->dwoo->get($tpl, array()));
}
public function testAndOrOperatorsFollowedWithRoundBrackets()
{
$tpl = new Dwoo_Template_String('{if 1 AND (0 OR 1)}true{/if}');
$tpl->forceCompilation();
$this->assertEquals("true", $this->dwoo->get($tpl, array()));
}
}
function Dwoo_Plugin_X_compile(Dwoo_Compiler $cmp, $text)
{
return $text;
}
\ No newline at end of file
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