1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
use strict;
use warnings;
use Test::More 0.88;
use if $ENV{AUTHOR_TESTING}, 'Test::Warnings';
my @calls;
do {
package Parent;
sub foo { push @calls, 'Parent::foo' }
package Child;
use Class::Method::Modifiers;
our @ISA = 'Parent';
around foo => sub {
push @calls, 'before Child::foo';
shift->(@_);
push @calls, 'after Child::foo';
};
};
Child->foo;
is_deeply([splice @calls], [
'before Child::foo',
'Parent::foo',
'after Child::foo',
]);
do {
package Parent;
use Class::Method::Modifiers;
around foo => sub {
push @calls, 'before Parent::foo';
shift->(@_);
push @calls, 'after Parent::foo';
};
};
Child->foo;
TODO: {
local $TODO = "pending discussion with stevan";
is_deeply([splice @calls], [
'before Child::foo',
'before Parent::foo',
'Parent::foo',
'after Parent::foo',
'after Child::foo',
]);
}
done_testing;
|