File: implicit_set.t

package info (click to toggle)
libtemplate-autofilter-perl 0.143050-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 144 kB
  • ctags: 8
  • sloc: perl: 226; makefile: 2
file content (27 lines) | stat: -rw-r--r-- 630 bytes parent folder | download | duplicates (3)
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
#!/usr/bin/perl
use strict;
use warnings;

use Test::InDistDir;

use Test::More tests => 3;

use Template;
use Template::AutoFilter;

my $templ_1 = "[% x = [ 1, 2 ] %]  [% x.join(', ') %]";
my $templ_2 = "[% x = [ 1, 2 ] | html %]  [% x.join(', ') | html %]";
my $templ_3 = "[% SET x = [ 1, 2 ] %]  [% x.join(', ') %]";

for ( $templ_1, $templ_2, $templ_3 ) {
    my $wanted = process( 'Template', $_ );
    my $out = process( 'Template::AutoFilter', $_ );
    is( $out, $wanted );
}

sub process {
    my ( $class, $tmpl ) = @_;
    $class->new->process( \$tmpl, {}, \my $out );
    $out =~ s/0x[\da-f]+/hex/;
    return $out;
}