X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F031_method_modifiers.t;h=b509ee564ee874c05c702b2caa8d125c0ed9b3bb;hb=13b8971fa6cc4edf7d55a2e5482820d62ba38f16;hp=ee5abf687bba2ba136672875a1b4d4f1f2f4aa9e;hpb=7ac8038438a75837e0d4976dd45cb53f77124fb4;p=gitmo%2FClass-MOP.git diff --git a/t/031_method_modifiers.t b/t/031_method_modifiers.t index ee5abf6..b509ee5 100644 --- a/t/031_method_modifiers.t +++ b/t/031_method_modifiers.t @@ -2,7 +2,7 @@ use strict; use warnings; use Test::More; -use Test::Exception; +use Test::Fatal; use Class::MOP; use Class::MOP::Method; @@ -31,9 +31,9 @@ use Class::MOP::Method; '... got the right return value from the wrapped method' ); $trace = ''; - lives_ok { + ok ! exception { $wrapped->add_before_modifier( sub { $trace .= 'before -> ' } ); - } + }, '... added the before modifier okay'; $wrapped->(); @@ -42,9 +42,9 @@ use Class::MOP::Method; ); $trace = ''; - lives_ok { + ok ! exception { $wrapped->add_after_modifier( sub { $trace .= ' -> after' } ); - } + }, '... added the after modifier okay'; $wrapped->(); @@ -71,12 +71,12 @@ use Class::MOP::Method; is( $wrapped->(), 4, '... got the right value from the wrapped method' ); - lives_ok { + ok ! exception { $wrapped->add_around_modifier( sub { ( 3, $_[0]->() ) } ); $wrapped->add_around_modifier( sub { ( 2, $_[0]->() ) } ); $wrapped->add_around_modifier( sub { ( 1, $_[0]->() ) } ); $wrapped->add_around_modifier( sub { ( 0, $_[0]->() ) } ); - } + }, '... added the around modifier okay'; is_deeply( @@ -104,28 +104,28 @@ use Class::MOP::Method; isa_ok( $wrapped, 'Class::MOP::Method::Wrapped' ); isa_ok( $wrapped, 'Class::MOP::Method' ); - lives_ok { + ok ! exception { $wrapped->add_before_modifier( sub { push @tracelog => 'before 1' } ); $wrapped->add_before_modifier( sub { push @tracelog => 'before 2' } ); $wrapped->add_before_modifier( sub { push @tracelog => 'before 3' } ); - } + }, '... added the before modifier okay'; - lives_ok { + ok ! exception { $wrapped->add_around_modifier( sub { push @tracelog => 'around 1'; $_[0]->(); } ); $wrapped->add_around_modifier( sub { push @tracelog => 'around 2'; $_[0]->(); } ); $wrapped->add_around_modifier( sub { push @tracelog => 'around 3'; $_[0]->(); } ); - } + }, '... added the around modifier okay'; - lives_ok { + ok ! exception { $wrapped->add_after_modifier( sub { push @tracelog => 'after 1' } ); $wrapped->add_after_modifier( sub { push @tracelog => 'after 2' } ); $wrapped->add_after_modifier( sub { push @tracelog => 'after 3' } ); - } + }, '... added the after modifier okay'; $wrapped->();