File: 37_with.t

package info (click to toggle)
libhtml-template-compiled-perl 1.003-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 772 kB
  • sloc: perl: 4,759; makefile: 5
file content (29 lines) | stat: -rw-r--r-- 695 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl HTML-Template-Compiled.t'

use Test::More tests => 2;
BEGIN { use_ok('HTML::Template::Compiled') };

{
    my $htc = HTML::Template::Compiled->new(
        scalarref => \<<'EOM',
<%with foo.bar %>
    bar:<%= _[0] %>
<%/with foo.bar %>
<%with foo.baz %>
    baz:<%= _[0] %>
<%/with foo.baz %>
EOM
        debug => 0,
    );

    $htc->param(
        foo => {
            bar => [qw/ this and that /],
        },
    );
    my $out = $htc->output;
    $out =~ s/\s+//g;
    #print $out, $/;
    cmp_ok($out, "eq", "bar:this", "global_vars and unset variable");
}