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 35 36
|
#!/usr/bin/perl
use v5.14;
use warnings;
use Test2::V0;
use lib "t";
use testcase "t::pieces";
BEGIN { $^H{"t::pieces/permit"} = 1; }
my @warnings;
BEGIN { $SIG{__WARN__} = sub { push @warnings, $_[0] }; }
{
BEGIN { undef @warnings; }
piecewarning;
BEGIN { is( \@warnings, [ "A warning here\n" ], 'piecewarning emits warning' ) };
}
{
BEGIN { undef @warnings; }
piecewarndep;
BEGIN { is( \@warnings, [ "A deprecated warning here\n" ], 'piecewarndep emits warning' ) };
BEGIN { undef @warnings; }
no warnings 'deprecated';
piecewarndep;
BEGIN { is( \@warnings, [], 'piecewarndep warning is conditional' ) };
}
done_testing;
|