use strictures 1; use Test::More; use HTML::String::TT; my $tt = HTML::String::TT->new; sub do_tt { my $output; $tt->process(\$_[0], $_[1], \$output) or die $tt->error; return "$output"; } is( do_tt('[% foo %]', { foo => 'Hi ' }), 'Hi <bob>', ); is( do_tt(q{[% VIEW myview; BLOCK render; ''; foo; ''; END; END; myview.include('render'); %]}, { foo => 'Hi ' }), 'Hi <bob>', ); is( do_tt('[% foo | no_escape %]', { foo => 'Hi ' }), 'Hi ', ); # Check we aren't nailed by https://rt.perl.org/rt3/Ticket/Display.html?id=49594 is( do_tt('"$bar"'."\n"), '"$bar"'."\n" ); is( do_tt( '[% FOREACH item IN items %][% item %][% END %]', { items => [ '', '-> & so "on" <-' ] } ), '<script>alert("lalala")</script>' .'-> & so "on" <-' ); done_testing;