use Test::More tests => 98; #use Test::More qw/no_plan/; use HTML::Template; use strict; while( ) { chomp; next if /^$/; next if /^#/; my($text,$given,$wanted) = split /\|/; my $template = HTML::Template->new( scalarref => \$text, default_escape => "HTML" ); $template->param(foo => $given); my $output = $template->output; is($output , $wanted , $text); } # use pipe as the seperator between fields. # the TMPL_VAR name should always be 'foo' # fields: TMPL_VAR|given string|escaped string __DATA__ # use default escaping |this is bold\n|<b>this is bold\n |this is bold\n|<b>this is bold\n |this is bold\n|<b>this is bold\n |this is bold\n|<b>this is bold\n |this is bold\n|<b>this is bold\n |this is bold\n|<b>this is bold\n |this is bold\n|<b>this is bold\n |this is bold\n|<b>this is bold\n |this is bold\n|<b>this is bold\n # use js escaping |this is bold\n|this is bold\\n |this is bold\n|this is bold\\n |this is bold\n|this is bold\\n |this is bold\n|this is bold\\n |this is bold\n|this is bold\\n |this is bold\n|this is bold\\n |this is bold\n|this is bold\\n |this is bold\n|this is bold\\n |this is bold\n|this is bold\\n |this is bold\n|this is bold\\n |this is bold\n|this is bold\\n |this is bold\n|this is bold\\n |this is bold\n|this is bold\\n |this is bold\n|this is bold\\n |this is bold\n|this is bold\\n |this is bold\n|this is bold\\n |this is bold\n|this is bold\\n |this is bold\n|this is bold\\n |this is bold\n|this is bold\\n |this is bold\n|this is bold\\n |this is bold\n|this is bold\\n #use url escaping |this is bold\n|%3Cb%3Ethis%20is%20bold%5Cn |this is bold\n|%3Cb%3Ethis%20is%20bold%5Cn |this is bold\n|%3Cb%3Ethis%20is%20bold%5Cn |this is bold\n|%3Cb%3Ethis%20is%20bold%5Cn |this is bold\n|%3Cb%3Ethis%20is%20bold%5Cn |this is bold\n|%3Cb%3Ethis%20is%20bold%5Cn |this is bold\n|%3Cb%3Ethis%20is%20bold%5Cn |this is bold\n|%3Cb%3Ethis%20is%20bold%5Cn |this is bold\n|%3Cb%3Ethis%20is%20bold%5Cn |this is bold\n|%3Cb%3Ethis%20is%20bold%5Cn |this is bold\n|%3Cb%3Ethis%20is%20bold%5Cn |this is bold\n|%3Cb%3Ethis%20is%20bold%5Cn |this is bold\n|%3Cb%3Ethis%20is%20bold%5Cn |this is bold\n|%3Cb%3Ethis%20is%20bold%5Cn |this is bold\n|%3Cb%3Ethis%20is%20bold%5Cn |this is bold\n|%3Cb%3Ethis%20is%20bold%5Cn |this is bold\n|%3Cb%3Ethis%20is%20bold%5Cn |this is bold\n|%3Cb%3Ethis%20is%20bold%5Cn |this is bold\n|%3Cb%3Ethis%20is%20bold%5Cn |this is bold\n|%3Cb%3Ethis%20is%20bold%5Cn |this is bold\n|%3Cb%3Ethis%20is%20bold%5Cn |this is bold\n|%3Cb%3Ethis%20is%20bold%5Cn # no escaping |this is bold\n|this is bold\n |this is bold\n|this is bold\n |this is bold\n|this is bold\n |this is bold\n|this is bold\n |this is bold\n|this is bold\n |this is bold\n|this is bold\n |this is bold\n|this is bold\n |this is bold\n|this is bold\n |this is bold\n|this is bold\n |this is bold\n|this is bold\n |this is bold\n|this is bold\n |this is bold\n|this is bold\n |this is bold\n|this is bold\n |this is bold\n|this is bold\n |this is bold\n|this is bold\n |this is bold\n|this is bold\n |this is bold\n|this is bold\n |this is bold\n|this is bold\n |this is bold\n|this is bold\n |this is bold\n|this is bold\n |this is bold\n|this is bold\n |this is bold\n|this is bold\n # no escaping |this is bold\n|this is bold\n |this is bold\n|this is bold\n |this is bold\n|this is bold\n |this is bold\n|this is bold\n |this is bold\n|this is bold\n |this is bold\n|this is bold\n |this is bold\n|this is bold\n |this is bold\n|this is bold\n |this is bold\n|this is bold\n |this is bold\n|this is bold\n |this is bold\n|this is bold\n |this is bold\n|this is bold\n |this is bold\n|this is bold\n |this is bold\n|this is bold\n |this is bold\n|this is bold\n |this is bold\n|this is bold\n |this is bold\n|this is bold\n |this is bold\n|this is bold\n |this is bold\n|this is bold\n |this is bold\n|this is bold\n |this is bold\n|this is bold\n |this is bold\n|this is bold\n #no escaping and default escaping |this is bold\n|this is bold\n <b>this is bold\n |this is bold\n|this is bold\n <b>this is bold\n