background image
<< Tests with warnings | Dealing With Death >>
<< Tests with warnings | Dealing With Death >>
Catching Warnings
Catching Warnings
Use $SIG{__WARN__}.
my $warnings = '';
local $SIG{__WARN__} = sub { $warnings . join '', @_ };
use Test::More tests => 2;
is( undef, undef, 'undef is undef' );
is( $warnings, '', ' no warnings' );
Use the same technique to check for expected warnings.