X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F030_roles%2F007_roles_and_req_method_edge_cases.t;h=79c3e330cdf68efc84a1ccb57820fd22bf8792a2;hb=bbf62397d81d046a716776f756249e22c4ddf372;hp=b99348bb745be26cf3aa46b69174126ccb8a0891;hpb=d03bd989b97597428b460d7f9a021e2931893fa0;p=gitmo%2FMoose.git diff --git a/t/030_roles/007_roles_and_req_method_edge_cases.t b/t/030_roles/007_roles_and_req_method_edge_cases.t index b99348b..79c3e33 100644 --- a/t/030_roles/007_roles_and_req_method_edge_cases.t +++ b/t/030_roles/007_roles_and_req_method_edge_cases.t @@ -3,8 +3,8 @@ use strict; use warnings; -use Test::More tests => 15; -use Test::Exception; +use Test::More; +use Test::Fatal; =pod @@ -35,9 +35,9 @@ not remove the requirement) use warnings; use Moose::Role; - ::lives_ok { + ::is( ::exception { with 'Role::RequireFoo'; - } '... the required "foo" method will not exist yet (but we will live)'; + }, undef, '... the required "foo" method will not exist yet (but we will live)' ); override 'foo' => sub { 'Role::ProvideFoo::foo' }; } @@ -67,9 +67,9 @@ second class citizens. extends 'Class::ProvideFoo::Base'; - ::lives_ok { + ::is( ::exception { with 'Role::RequireFoo'; - } '... the required "foo" method will be found in the superclass'; + }, undef, '... the required "foo" method will be found in the superclass' ); override 'foo' => sub { 'Class::ProvideFoo::foo' }; @@ -80,9 +80,9 @@ second class citizens. override 'foo' => sub { 'Class::ProvideFoo::foo' }; - ::lives_ok { + ::is( ::exception { with 'Role::RequireFoo'; - } '... the required "foo" method exists, although it is overriden locally'; + }, undef, '... the required "foo" method exists, although it is overriden locally' ); } @@ -99,9 +99,9 @@ method modifier. extends 'Class::ProvideFoo::Base'; - ::lives_ok { + ::is( ::exception { with 'Role::RequireFoo'; - } '... the required "foo" method will be found in the superclass'; + }, undef, '... the required "foo" method will be found in the superclass' ); before 'foo' => sub { 'Class::ProvideFoo::foo:before' }; @@ -112,9 +112,9 @@ method modifier. before 'foo' => sub { 'Class::ProvideFoo::foo:before' }; - ::lives_ok { + ::is( ::exception { with 'Role::RequireFoo'; - } '... the required "foo" method exists, although it is a before modifier locally'; + }, undef, '... the required "foo" method exists, although it is a before modifier locally' ); package Class::ProvideFoo::Before3; use Moose; @@ -124,9 +124,9 @@ method modifier. sub foo { 'Class::ProvideFoo::foo' } before 'foo' => sub { 'Class::ProvideFoo::foo:before' }; - ::lives_ok { + ::is( ::exception { with 'Role::RequireFoo'; - } '... the required "foo" method exists locally, and it is modified locally'; + }, undef, '... the required "foo" method exists locally, and it is modified locally' ); package Class::ProvideFoo::Before4; use Moose; @@ -140,9 +140,9 @@ method modifier. ::is(__PACKAGE__->meta->get_method('foo')->get_original_method->package_name, __PACKAGE__, '... but the original method is from our package'); - ::lives_ok { + ::is( ::exception { with 'Role::RequireFoo'; - } '... the required "foo" method exists in the symbol table (and we will live)'; + }, undef, '... the required "foo" method exists in the symbol table (and we will live)' ); } @@ -160,9 +160,9 @@ method modifier. extends 'Class::ProvideFoo::Base'; - ::lives_ok { + ::is( ::exception { with 'Role::RequireFoo'; - } '... the required "foo" method will be found in the superclass (but then overriden)'; + }, undef, '... the required "foo" method will be found in the superclass (but then overriden)' ); has 'foo' => (is => 'ro'); @@ -173,9 +173,9 @@ method modifier. has 'foo' => (is => 'ro'); - ::lives_ok { + ::is( ::exception { with 'Role::RequireFoo'; - } '... the required "foo" method exists, and is an accessor'; + }, undef, '... the required "foo" method exists, and is an accessor' ); } # ... @@ -211,9 +211,9 @@ method modifier. use Moose; extends 'Foo::Class::Base'; - ::lives_ok { + ::is( ::exception { with 'Foo::Role'; - } '... our role combined successfully'; + }, undef, '... our role combined successfully' ); } # a method required in a role and implemented in a superclass, with a method @@ -243,9 +243,9 @@ method modifier. package Bar::Class::Grandchild; use Moose; extends 'Bar::Class::Child'; - ::lives_ok { + ::is( ::exception { with 'Bar::Role'; - } 'required method exists in superclass as non-modifier, so we live'; + }, undef, 'required method exists in superclass as non-modifier, so we live' ); } { @@ -271,7 +271,9 @@ method modifier. package Bar2::Class::Grandchild; use Moose; extends 'Bar2::Class::Child'; - ::lives_ok { + ::is( ::exception { with 'Bar2::Role'; - } 'required method exists in superclass as non-modifier, so we live'; + }, undef, 'required method exists in superclass as non-modifier, so we live' ); } + +done_testing;