X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fbasic.t;h=fdf414074d00d10303c4fd31d838d12e99803211;hb=e546f61d6bd97fad9857cdd34a00cd5906190074;hp=6eb35d59a8f4696ac29e418fab3a0376d797d7a4;hpb=37bcd4f7d7934552b00bb758dfdb19e93ced3640;p=gitmo%2FPackage-DeprecationManager.git diff --git a/t/basic.t b/t/basic.t index 6eb35d5..fdf4140 100644 --- a/t/basic.t +++ b/t/basic.t @@ -3,7 +3,10 @@ use warnings; use Test::Exception; use Test::More; -use Test::Warn; + +use Test::Requires { + 'Test::Warn' => '0.21', +}; { throws_ok { @@ -165,10 +168,24 @@ use Test::Warn; } { + package Dep3; + + use Package::DeprecationManager -deprecations => { + 'baz' => '1.00', + }, + -ignore => [ qr/My::Package[12]/ ]; + + sub baz { + deprecated('baz is deprecated'); + } +} + +{ package My::Package1; sub foo { Dep::foo() } sub bar { Dep2::bar() } + sub baz { Dep3::baz() } } { @@ -176,18 +193,23 @@ use Test::Warn; sub foo { My::Package1::foo() } sub bar { My::Package1::bar() } + sub baz { My::Package1::baz() } } { package My::Baz; + ::warning_like{ My::Package1::bar() } + qr/^bar is deprecated at t.basic\.t line \d+/, + 'deprecation warning for call to My::Package1::bar()'; + ::warning_like{ My::Package2::foo() } qr/^foo is deprecated at t.basic\.t line \d+/, 'deprecation warning for call to My::Package2::foo()'; - ::warning_like{ My::Package1::bar() } - qr/^bar is deprecated at t.basic\.t line \d+/, - 'deprecation warning for call to My::Package1::bar()'; + ::warning_like{ My::Package1::baz() } + qr/^baz is deprecated at t.basic\.t line \d+/, + 'deprecation warning for call to My::Package2::foo()'; } {