cvs commits, passes smoke tests
| From: | Monte Ohrt | Date: | Fri, 20 Dec 2002 00:13:28 +0000 |
| Subject: | cvs commits, passes smoke tests | ||
| Groups: | php.smarty.dev | ||
| Request: | Send a blank email to php-smarty-dev+get-464@lists.php.net to get a copy of this message | ||
Ok, I've had my fill of regex work for awhile, that is enough to drive
one mad :-)
the latest commit passes my smoke tests, which you can get here:
http://www.phpinsider.com/temp/smarty_smoketest.tar.gz
I tried to cover as much as I could, but I'm sure there is more that
could be added.
The regular expressions are cleaned up and cascade nicely, so a lot of
syntax that didn't previously work now does. It is _way_ more managable
now, I don't get such headaches looking at them :-) I tried strange
stuff like passing objects as parameters to modifiers and it works fine.
About the only thing you can't do is pass an object as a parameter to an
object. That is only be design, it's possible but I didn't see a reason
to support it. You can call objects in objects just fine though, such as
($foo->bar->foobar('blah'))
Here are some examples from the smoke test, and they work:
{$foo}
{$foo|upper}
{$foo|upper|spacify}
{$foo|spacify:"^^"}
{$foo|@count}
{$foo|default:"no"}
{$foo|truncate:6:"...":true}
{$afoo.one}
{$afoo.two}
{$afoo.one|upper}
{$afoo.one|upper|spacify}
{$afoo.one|spacify:"^^"}
{$afoo.one|@count}
{$afoo.one|default:"no"}
{$afoo.one|truncate:6:"...":true}
{$afoo.$bar}
{#foo#}
{#foo#|upper}
{#foo#|upper|spacify}
{#foo#|spacify:"^^"}
{#foo#|@count}
{#foo#|default:"no"}
{#foo#|truncate:6:"...":true}
{#foo#}
{#foo#|upper}
{#foo#|upper|spacify}
{#foo#|spacify:"^^"}
{#foo#|@count}
{#foo#|default:"no"}
{#foo#|truncate:6:"...":true}
{$ofoo->blah}
{$ofoo->foo('bar')}
{$ofoo->foo("bar")}
{$ofoo->foo("$foo bar")}
{$ofoo->foo("one","two")}
{$ofoo->foo("one","two","three")}
{$ofoo->foo("one $foo","two","three")}
{$ofoo->foo("one $foo","two $foo","three")}
{$ofoo->foo("one","two","three","four")}
{$ofoo->foo('one $foo','two $foo','three')}
{$ofoo->foo('one')|upper}
{ffoo var="foo"}
{ffoo var="foo" var2="blah"}
{ffoo var=$foo}
{ffoo var=truey}
{ffoo var=$foo|upper}
{ffoo var="foo"|upper}
{ffoo var=$ofoo->foo("$foo bar")}
{ffoo|upper var=$foo}
{section name=sec loop=$sfoo}
{$sfoo[sec]}
{$sfoo[sec.index]}
{$sfoo[sec.index_next]}
{$sfoo[sec.index_prev]}
{$sfoo[sec.iteration]}
{$sfoo[sec.first]}
{$sfoo[sec.last]}
{$sfoo[sec.rownum]}
{$sfoo[sec.loop]}
{$sfoo[sec.total]}
{$sfoo[sec.show]}
{$sfoo[sec]|upper}
{$sfoo[sec]|upper|spacify}
{$sfoo[sec]|spacify:"^^"}
{$sfoo[sec]|@count}
{$sfoo[sec]|default:"no"}
{$sfoo[sec]|truncate:6:"...":true}
{/section}
{$smarty.section.sec.index}
{if $foo}{/if}(end)
{if $foo eq "bar"}foo is bar{/if}(end)
{if is_array($foo)}foo is array{else}foo is not array{/if}(end)
{if $foo gt 4}$foo is gt 4{/if}(end)
{if ($foo gt 4)}$foo is gt 4{/if}(end)
{if ( $foo gt 4 )}$foo is gt 4{/if}(end)
{if $foo and not $bar}foo and not bar{/if}(end)
{if !$bfoo}not bfoo{else}bfoo{/if}(end)
{if 4 is div by 4}div by 4{else}not div by 4{/if}(end)
{if 3 is div by 4}div by 4{else}not div by 4{/if}(end)
{if 3 is div by 4 or ( 3 eq 3 )}blah{/if}(end)
{if (3 is div by 4) or ( 3<="bah"|upper )}woohoo{/if}(end)
{if in_array("my $bar", $afoo)}is in{else}is not in{/if}(end)
{if $ofoo->foo()}is in{else}is not in{/if}(end)
{if in_array($ofoo->foo("two"), $afoo)}is in{else}is not in{/if}(end)
{$smarty.now}
{$smarty.const._MY_CONST}
{$foo|spacify:"|"}
{$foo|spacify:"|"|upper}
{$foo|spacify:"$foo"|upper|default:"|"}
{section name=sec loop=$sfoo}
{$ofoo->foo($sfoo[sec],$sfoo[sec]|spacify:"^^",$sfoo[sec]|truncate:6:"...":true)}
{$nfoo->ofoo->foo($sfoo[sec],$sfoo[sec]|spacify:"^^",$sfoo[sec]|truncate:6:"...":true)}
{/section}
{ffoo|spacify:"|"|upper var="lalala"}
{ffoo|spacify:" my spaces "|upper var="lalala"}
{ffoo|spacify:"!@#$%^&*()_+=-\|]["|upper var="lalala"}
{if !$nfoo->ofoo->foo("blah blah")}not blah{else}blah{/if}(end)
Monte