1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
use Test::More qw(no_plan);
use HTML::Template::Expr;
my $template = HTML::Template::Expr->new(path => ['t/templates'],
filename => 'extra_attributes.tmpl',
);
$template->param(who => 'me & you',
xss => '<SCRIPT SRC="MALICIOUS.JS" />',
back => 'http://google.com',
js_string => "This is\n'me'",);
my $output = $template->output();
like($output, qr/ME & YOU/);
like($output, qr/<script src="malicious\.js" \/>/);
like($output, qr/Http%3A%2F%2Fgoogle\.com/);
like($output, qr/this is\\n\\'me\\'/);
|