]> Dogcows Code - chaz/p5-CGI-Ex/blob - t/0_ex_01_swap.t
add PSGI handler
[chaz/p5-CGI-Ex] / t / 0_ex_01_swap.t
1 # -*- Mode: Perl; -*-
2
3 use Test;
4
5 BEGIN {plan tests => 4};
6
7 use CGI::Ex;
8 ok(1);
9
10 my $cgix = CGI::Ex->new;
11 my $form = {foo => 'bar', this => {is => {nested => ['wow', 'wee']}}};
12
13 ok('bar' eq $cgix->swap_template("[% foo %]", $form));
14
15 ok('wee' eq $cgix->swap_template("[% this.is.nested.1 %]", $form));
16
17 my $str = "[% this.is.nested.0 %]";
18 $cgix->swap_template(\$str, $form);
19 ok('wow' eq $str);
20
21 $cgix = CGI::Ex->new;
22 $cgix->set_form({
23 foo => 'bar',
24 baz => 'wow',
25 this => 'wee',
26 });
27 $str = "<html>([% foo %]) <br>
28 ([% baz %]) <br>
29 ([% this %]) </html>";
30 $cgix->swap_template(\$str);
31 print $str;
32 ok($str eq "<html>(bar) <br>
33 (wow) <br>
34 (wee) </html>");
This page took 0.031289 seconds and 4 git commands to generate.