File: 05-warn.t

package info (click to toggle)
libtext-microtemplate-perl 0.24-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 296 kB
  • sloc: perl: 1,725; makefile: 2
file content (27 lines) | stat: -rw-r--r-- 484 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
use strict;
use warnings;
use Test::More;

BEGIN {
    eval { require IO::Scalar };
    if ($@) {
        plan( skip_all => "IO::Scalar is not installed" );
    } else {
        plan( tests => 2);
    }
}

use Text::MicroTemplate qw(:all);

my $w;
tie *STDERR, 'IO::Scalar', \$w;
my $out;
eval {
    $out = render_mt(<< '...', 1)->as_string;
hello
? my %h = @_;
world
...
};
is $out, "hello\nworld\n", 'output on warn';
like $w, qr/ at line 2 .* \Q$0\E at line \d+/, 'warn location';