no_escape filter for TT
[scpubgit/HTML-String.git] / xt / tt.t
CommitLineData
f49292d9 1use strictures 1;
2use Test::More;
3use HTML::String::TT;
4
5my $tt = HTML::String::TT->new;
6
7sub do_tt {
8 my $output;
9 $tt->process(\$_[0], $_[1], \$output) or die $tt->error;
10 return "$output";
11}
12
13is(
14 do_tt('<tag>[% foo %]</tag>', { foo => 'Hi <bob>' }),
15 '<tag>Hi &lt;bob&gt;</tag>',
16);
17
18is(
19 do_tt(q{[%
20 VIEW myview; BLOCK render; '<tag>'; foo; '</tag>'; END; END;
21 myview.include('render');
22 %]}, { foo => 'Hi <bob>' }),
23 '<tag>Hi &lt;bob&gt;</tag>',
24);
25
51eaef0b 26is(
27 do_tt('<tag>[% foo | no_escape %]</tag>', { foo => 'Hi <bob>' }),
28 '<tag>Hi <bob></tag>',
29);
30
f49292d9 31done_testing;