File: block_duplicate.t

package info (click to toggle)
libtemplate-perl 3.102-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,680 kB
  • sloc: perl: 14,945; makefile: 11; sh: 5
file content (24 lines) | stat: -rw-r--r-- 476 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use strict;
use warnings;

use Test::More tests => 1;

use Template;

my $warning_seen;
local $SIG{__WARN__} = sub {
    my @warnings = @_;
    if ($warnings[0] =~ /Block redefined: b1/) {
        ++$warning_seen;
    } else {
        die "Unexpected warning: ", @warnings;
    }
};

my $t = Template->new;
$t->process(\ << '__TEMPLATE__', {}, \ my $ignore_output);
[% BLOCK b1 %]first[% END %]
[% BLOCK b1 %]second[% END %]
__TEMPLATE__

is $warning_seen, 1, 'warning seen';