Subject: | Test::NoWarnings should override CORE::Global::warn rather than catch signals |
Test::NoWarnings should override CORE::Global::warn rather than catch signals.
Right now if one of the tests or it's dependents localizes or alters $SIG{__WARN__}, then the
warning is not captured. This is evidenced by this test of Exporter's creative alteration of
$SIG{__WARN__}
In the below test, the warning message is never trapped.
--
package foo;
require Exporter;
@ISA = qw(Exporter);
@EXPORT = qw(bar);
sub bar {1};
package main;
BEGIN {
use warnings;
use Test::More tests => 2;
use Test::NoWarnings;
}
import foo;
sub bar {2};
is(bar(), 1);