From: Dave Rolsky Date: Wed, 14 Jul 2010 18:39:47 +0000 (-0500) Subject: Tests for warning once per error message X-Git-Tag: v0.04^0 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c9ed2327b850d1116f01402ab1667334d3bdb450;p=gitmo%2FPackage-DeprecationManager.git Tests for warning once per error message --- diff --git a/t/basic.t b/t/basic.t index 5c48e63..6d6ec91 100644 --- a/t/basic.t +++ b/t/basic.t @@ -44,6 +44,11 @@ use Test::Warn; ); } } + + sub varies { + deprecated("The varies sub varies: $_[0]"); + } + } { @@ -68,6 +73,18 @@ use Test::Warn; ::warning_is{ Foo::bar() } q{}, 'no warning on second call to bar'; ::warning_is{ Foo::baz() } q{}, 'no warning on second call to baz'; + + ::warning_is{ Foo::varies(1) } + { carped => "The varies sub varies: 1" }, + 'warning for varies sub'; + + ::warning_is{ Foo::varies(2) } + { carped => "The varies sub varies: 2" }, + 'warning for varies sub with different error'; + + ::warning_is{ Foo::varies(1) } + q{}, + 'no warning for varies sub with same message as first call'; } {