HTML-Template-Compiled-Plugin-VBEscape

 view release on metacpan or  search on metacpan

t/01_escape.t  view on Meta::CPAN

#!perl -T

use strict;
use warnings;

use Test::More tests => 3;

BEGIN {
    use_ok('HTML::Template::Compiled');
    use_ok('HTML::Template::Compiled::Plugin::VBEscape');
}

my $htc = HTML::Template::Compiled->new(
    tagstyle  => [qw(-classic -comment +asp)],
    plugin    => [qw(HTML::Template::Compiled::Plugin::VBEscape)],
    scalarref => \<<'EOT');
<script language="VBScript"><!--
    string1 = "<%= attribute%>"
    string2 = "<%= cdata ESCAPE=VB%>"
    string3 = "<%= undef ESCAPE=VB%>"
'--></script>
EOT
$htc->param(
    attribute => 'foo "bar"',
    cdata     => 'text "with" double quotes',
    undef     => undef,
);
is $htc->output(), <<'EOT', 'escape VB script';
<script language="VBScript"><!--
    string1 = "foo "bar""
    string2 = "text ""with"" double quotes"
    string3 = ""
'--></script>
EOT
;



( run in 1.245 second using v1.01-cache-2.11-cpan-9581c071862 )