X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fp5-CGI-Ex;a=blobdiff_plain;f=t%2F7_template_00_base.t;h=c1b17ba0917856449130348e78581fc744109afd;hp=9481952e0730f39e60e6939ae8707db3e8744b74;hb=8abbacc82b52f460bef67c1923ae98873a95e123;hpb=48c4840be1f154e262de2c161cb86dc5000dfe47 diff --git a/t/7_template_00_base.t b/t/7_template_00_base.t index 9481952..c1b17ba 100644 --- a/t/7_template_00_base.t +++ b/t/7_template_00_base.t @@ -14,7 +14,7 @@ BEGIN { }; use strict; -use Test::More tests => 514 - ($is_tt ? 103 : 0); +use Test::More tests => 521 - ($is_tt ? 109 : 0); use Data::Dumper qw(Dumper); use constant test_taint => 0 && eval { require Taint::Runtime }; @@ -361,6 +361,14 @@ process_ok('[% {a => "B", c => "D"}.fmt %]' => "a\tB\nc\tD") if ! $is_tt; process_ok('[% {a => "B", c => "D"}.fmt("%s:%s") %]' => "a:B\nc:D") if ! $is_tt; process_ok('[% {a => "B", c => "D"}.fmt("%s:%s", "; ") %]' => "a:B; c:D") if ! $is_tt; +process_ok('[% 1.format("%s") %]' => '1') if ! $is_tt; +process_ok('[% 1.format("%*s", 6) %]' => ' 1') if ! $is_tt; +process_ok('[% 1.format("%-*s", 6) %]' => '1 ') if ! $is_tt; + +process_ok('[% 1.fmt("%-*s", 6) %]' => '1 ') if ! $is_tt; +process_ok('[% [1,2].fmt("%-*s", "|", 6) %]' => '1 |2 ') if ! $is_tt; +process_ok('[% {1=>2,3=>4}.fmt("%*s:%*s", "|", 3, 3) %]' => ' 1: 2| 3: 4') if ! $is_tt; + ###----------------------------------------------------------------### ### virtual objects @@ -374,7 +382,7 @@ process_ok('[% a = Hash.new("one", "ONE") %][% a.one %]' => 'ONE') if ! $is_tt; process_ok('[% a = Hash.new(one = "ONE") %][% a.one %]' => 'ONE') if ! $is_tt; process_ok('[% a = Hash.new(one => "ONE") %][% a.one %]' => 'ONE') if ! $is_tt; -process_ok('[% {a => 1, b => 2} | Hash.keys | List.join(", ") %]' => 'a, b'); +process_ok('[% {a => 1, b => 2} | Hash.keys | List.join(", ") %]' => 'a, b') if ! $is_tt; ###----------------------------------------------------------------### ### chomping @@ -729,6 +737,9 @@ process_ok("[% USE d.d = Foo(bar = 'baz') %]one[% d.d.bar %]" => '', {tt_config process_ok("[% USE a(bar = 'baz') %]one[% a.seven %]" => '', {tt_config => [@config_p, PLUGINS => {a=>'Foo'}, ]}); process_ok("[% USE a(bar = 'baz') %]one[% a.seven %]" => 'one7', {tt_config => [@config_p, PLUGINS => {a=>'Foo2'},]}); +@config_p = (PLUGIN_BASE => ['NonExistant', 'MyTestPlugin'], LOAD_PERL => 1); +process_ok("[% USE Foo %]one" => 'one', {tt_config => \@config_p}); + ###----------------------------------------------------------------### ### macro