File: 40_data_dumper.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 (34 lines) | stat: -rw-r--r-- 761 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
30
31
32
33
34
use strict;
use warnings;
use Test::More tests => 2;
use HTML::Template::Compiled;
use lib 't';

{
    local $Data::Dumper::Terse = 1;
    local $Data::Dumper::Pad = "FOO";
    my %args = (
        scalarref => \<<"EOM",
foo: <%= foo %>

<%loop list join=", " %><%= _ %><%/loop list %>
EOM
        cache => 0,
        pre_chomp => 0,
        post_chomp => 1,
        # debug => 1,
    );
    my $htc = HTML::Template::Compiled->new(
        %args,
    );
    $htc->param(
        foo => 23,
        list => [2 .. 5],
    );
    my $out = $htc->output;
    #warn __PACKAGE__.':'.__LINE__.": $out\n";
    cmp_ok($out, '=~', "foo: 23", "[Data::Dumper] literal template strings");
    cmp_ok($out, '=~', "2, 3, 4, 5", "[Data::Dumper] 'join' strings in loops");
}