Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
Dwoo
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Common
Dwoo
Commits
691afcaa
Commit
691afcaa
authored
Jan 21, 2009
by
Seldaek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
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
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
3 deletions
+36
-3
Compiler.php
lib/Dwoo/Compiler.php
+3
-3
BugTests.php
tests/BugTests.php
+33
-0
No files found.
lib/Dwoo/Compiler.php
View file @
691afcaa
...
...
@@ -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
);
...
...
tests/BugTests.php
View file @
691afcaa
...
...
@@ -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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment