File: 14missing.t

package info (click to toggle)
libstring-print-perl 0.96-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 184 kB
  • sloc: perl: 781; makefile: 2
file content (24 lines) | stat: -rw-r--r-- 522 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env perl
# Test reporting of missing parameters

use warnings;
use strict;

use Test::More;

use String::Print;

my $f = String::Print->new;
isa_ok($f, 'String::Print');

is $f->sprinti('testA {a}', a => undef), 'testA undef', 'undef is not missing';

my $warning;
$SIG{__WARN__} = sub { $warning = join '/', @_ };
my $file = __FILE__;
my $line = __LINE__ + 1;
is $f->sprinti('testB {b}'), 'testB undef', 'missing';
is $warning, "Missing key 'b' in format 'testB {b}', file $file line $line\n";


done_testing;