X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F031_method_modifiers.t;fp=t%2F031_method_modifiers.t;h=cb7078dc9be980ba161f86759aafd3fd4f116cc4;hb=871e9eb5d05b8b9986b2de3f4095f65a31159c56;hp=ee5abf687bba2ba136672875a1b4d4f1f2f4aa9e;hpb=8371f3de4e9525ab751008dca4a89e6df65345a6;p=gitmo%2FClass-MOP.git diff --git a/t/031_method_modifiers.t b/t/031_method_modifiers.t index ee5abf6..cb7078d 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,10 +31,9 @@ use Class::MOP::Method; '... got the right return value from the wrapped method' ); $trace = ''; - lives_ok { + is( exception { $wrapped->add_before_modifier( sub { $trace .= 'before -> ' } ); - } - '... added the before modifier okay'; + }, undef, '... added the before modifier okay' ); $wrapped->(); is( $trace, 'before -> primary', @@ -42,10 +41,9 @@ use Class::MOP::Method; ); $trace = ''; - lives_ok { + is( exception { $wrapped->add_after_modifier( sub { $trace .= ' -> after' } ); - } - '... added the after modifier okay'; + }, undef, '... added the after modifier okay' ); $wrapped->(); is( $trace, 'before -> primary -> after', @@ -71,13 +69,12 @@ use Class::MOP::Method; is( $wrapped->(), 4, '... got the right value from the wrapped method' ); - lives_ok { + is( 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'; + }, undef, '... added the around modifier okay' ); is_deeply( [ $wrapped->() ], @@ -104,29 +101,26 @@ use Class::MOP::Method; isa_ok( $wrapped, 'Class::MOP::Method::Wrapped' ); isa_ok( $wrapped, 'Class::MOP::Method' ); - lives_ok { + is( 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'; + }, undef, '... added the before modifier okay' ); - lives_ok { + is( 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'; + }, undef, '... added the around modifier okay' ); - lives_ok { + is( 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'; + }, undef, '... added the after modifier okay' ); $wrapped->(); is_deeply(