From: Zefram Date: Tue, 21 Feb 2012 22:40:17 +0000 (+0000) Subject: avoid using Test::Warn X-Git-Tag: 0.006011~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4d09d73b6db006a1bc3f7f333e0877bc86d9ea74;p=p5sagit%2FDevel-Declare.git avoid using Test::Warn --- diff --git a/Changes b/Changes index 1e498fd..d798b67 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,8 @@ Changes for Devel-Declare + - Avoid using Test::Warn, which has previously been a troublesome + dependency. + 0.006010 - 07 Feb 2012 - Fix workaround for unexported core symbols to avoid breaking compilation on non-threading builds of Perl 5.8. diff --git a/Makefile.PL b/Makefile.PL index 8a51d81..41b8864 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -21,7 +21,6 @@ configure_requires 'ExtUtils::Depends' => 0.302; configure_requires 'B::Hooks::OP::Check' => '0.19'; test_requires 'Test::More' => '0.88'; -test_requires 'Test::Warn'; repository 'git://github.com/rafl/devel-declare.git'; diff --git a/t/method-installer-redefine.t b/t/method-installer-redefine.t index 742728f..fe82793 100644 --- a/t/method-installer-redefine.t +++ b/t/method-installer-redefine.t @@ -1,7 +1,6 @@ use strict; use warnings; -use Test::More tests => 4; -use Test::Warn; +use Test::More tests => 5; use Devel::Declare::MethodInstaller::Simple; BEGIN { @@ -25,18 +24,20 @@ method foo { $_[0]->method } -use Test::Warn; - ok(main->can('foo'), 'foo() installed at runtime'); -warnings_like { - method foo { - $_[0]->method; - } -} qr/redefined/; - -warnings_are { - method_quiet foo { - $_[0]->method; - } -} [], 'no warnings'; +my @warnings; +$SIG{__WARN__} = sub { push @warnings, $_[0] }; + +@warnings = (); +method foo { +$_[0]->method; +} +is scalar(@warnings), 1; +like $warnings[0], qr/redefined/; + +@warnings = (); +method_quiet foo { +$_[0]->method; +} +is_deeply \@warnings, [];