| 1 |
#!/usr/bin/perl |
| 2 |
|
| 3 |
use v5.14; |
| 4 |
use warnings; |
| 5 |
|
| 6 |
use Test2::V0; |
| 7 |
|
| 8 |
use lib "t"; |
| 9 |
use testcase "t::pieces"; |
| 10 |
|
| 11 |
BEGIN { $^H{"t::pieces/permit"} = 1; } |
| 12 |
|
| 13 |
my @warnings; |
| 14 |
BEGIN { $SIG{__WARN__} = sub { push @warnings, $_[0] }; } |
| 15 |
|
| 16 |
{ |
| 17 |
BEGIN { undef @warnings; } |
| 18 |
piecewarning; |
| 19 |
|
| 20 |
BEGIN { is( \@warnings, [ "A warning here\n" ], 'piecewarning emits warning' ) }; |
| 21 |
} |
| 22 |
|
| 23 |
{ |
| 24 |
BEGIN { undef @warnings; } |
| 25 |
piecewarndep; |
| 26 |
|
| 27 |
BEGIN { is( \@warnings, [ "A deprecated warning here\n" ], 'piecewarndep emits warning' ) }; |
| 28 |
|
| 29 |
BEGIN { undef @warnings; } |
| 30 |
no warnings 'deprecated'; |
| 31 |
piecewarndep; |
| 32 |
|
| 33 |
BEGIN { is( \@warnings, [], 'piecewarndep warning is conditional' ) }; |
| 34 |
} |
| 35 |
|
| 36 |
done_testing; |