X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F500_deprecated.t;h=471fb4ab015db55faaac6dbc02c3434eb698756c;hb=1322c26b43bfd579ca9f2921b7f26674a6d245f2;hp=b97ddc9963687b6c7e38db373937b0c16798433c;hpb=e8f79d90c50ec879352c2d85be3164c941f036c0;p=gitmo%2FClass-MOP.git diff --git a/t/500_deprecated.t b/t/500_deprecated.t index b97ddc9..471fb4a 100755 --- a/t/500_deprecated.t +++ b/t/500_deprecated.t @@ -1,8 +1,8 @@ use strict; use warnings; -use Test::More tests => 6; -use Test::Exception; +use Test::More; +use Test::Fatal; use Carp; @@ -11,46 +11,43 @@ $SIG{__WARN__} = \&croak; { package Foo; - ::throws_ok{ + ::like( ::exception { Class::MOP::in_global_destruction(); - } qr/\b deprecated \b/xmsi, - 'Class::MOP::in_global_destruction is deprecated'; + }, qr/\b deprecated \b/xmsi, 'Class::MOP::in_global_destruction is deprecated' ); } { package Bar; - use Class::MOP::Deprecated -compatible => 0.93; + use Class::MOP::Deprecated -api_version => 0.93; - ::throws_ok{ + ::like( ::exception { Class::MOP::in_global_destruction(); - } qr/\b deprecated \b/xmsi, - 'Class::MOP::in_global_destruction is deprecated with 0.93 compatibility'; + }, qr/\b deprecated \b/xmsi, 'Class::MOP::in_global_destruction is deprecated with 0.93 compatibility' ); } { package Baz; - use Class::MOP::Deprecated -compatible => 0.92; + use Class::MOP::Deprecated -api_version => 0.92; - ::lives_ok{ + ::is( ::exception { Class::MOP::in_global_destruction(); - } - 'Class::MOP::in_global_destruction is not deprecated with 0.92 compatibility'; + }, undef, 'Class::MOP::in_global_destruction is not deprecated with 0.92 compatibility' ); } { - package Baz::Inner; + package Foo2; - ::lives_ok{ - Class::MOP::in_global_destruction(); - } 'safe in an inner class'; + use metaclass; + + ::like( ::exception { Foo2->meta->get_attribute_map }, qr/\Qget_attribute_map method has been deprecated/, 'get_attribute_map is deprecated' ); } { package Quux; - use Class::MOP::Deprecated -compatible => 0.92; + use Class::MOP::Deprecated -api_version => 0.92; use Scalar::Util qw( blessed ); use metaclass; @@ -72,3 +69,5 @@ $SIG{__WARN__} = \&croak; 'get_method_map returns expected methods' ); } + +done_testing;