use strictures 1;
use Test::More;
use HTML::String::TT;
-
+plan tests => 10;
my $tt = HTML::String::TT->new;
sub do_tt {
'[% FOREACH item IN items %][% item %][% END %]',
{ items => [ '<script>alert("lalala")</script>', '-> & so "on" <-' ] }
),
- '<script>alert("lalala")</script>'
+ '<script>alert("lalala")</script>'
.'-> & so "on" <-'
);
];
my $with_html_string_tt = do_tt($tmpl, {});
-
$tt = Template->new(STASH => Template::Stash->new);
my $with_template = do_tt($tmpl, {});
is $with_html_string_tt, $with_template;
}
+sub _is_escaped {
+ my $test_name = shift;
+ $tt = HTML::String::TT->new( @_ );
+ is(
+ do_tt(
+ '[%- if 1; unsafe_js; %][% end %]',
+ { unsafe_js => '<script>alert("anycase alert");</script>' }
+ ),
+ '<script>alert("anycase alert");</script>',
+ $test_name
+ );
+}
+_is_escaped('ANYCASE => 1 in a hash',ANYCASE => 1 );
+_is_escaped('ANYCASE => 1 in a hashref',{ ANYCASE => 1 });
done_testing;