plan
tests
=> 7;
{
no
warnings
'redefine'
;
*NEXT::AUTOLOAD
= \
&Catalyst::Plugin::C3::__hacked_next_autoload
;
}
sub
new {
my
$class
=
shift
;
my
%args
= (
@_
);
bless
\
%args
=>
$class
}
sub
basic {
return
42 }
sub
c3_then_next {
return
21 }
sub
next_then_c3 {
return
22 }
sub
basic {
shift
->NEXT::basic; }
sub
actual_fail_halfway {
shift
->NEXT::ACTUAL::actual_fail_halfway }
sub
next_then_c3 {
shift
->
next
::method }
sub
basic {
shift
->NEXT::basic; }
sub
c3_then_next {
shift
->NEXT::c3_then_next }
sub
basic {
shift
->NEXT::basic; }
sub
non_exist {
shift
->NEXT::non_exist }
sub
non_exist_actual {
shift
->NEXT::ACTUAL::non_exist_actual }
sub
actual_fail_halfway {
shift
->NEXT::ACTUAL::actual_fail_halfway }
sub
c3_then_next {
shift
->
next
::method }
sub
next_then_c3 {
shift
->NEXT::next_then_c3 }
my
$quux_obj
= C3NT::Quux->new;
is(
$quux_obj
->basic, 42,
'Basic inherited method returns correct value'
);
my
$non_exist_rval
;
eval
{
$non_exist_rval
=
$quux_obj
->non_exist };
ok( !$@,
'Non-existant non-ACTUAL throws no errors'
) or diag $@;
is(
$non_exist_rval
,
undef
,
'Non-existant non-ACTUAL returns undef'
);
eval
{
$quux_obj
->non_exist_actual };
like( $@,
qr|^No next::method 'non_exist_actual' found for C3NT::Quux|
,
'Non-existant ACTUAL throws correct error'
);
eval
{
$quux_obj
->actual_fail_halfway };
like( $@,
qr|^No next::method 'actual_fail_halfway' found for C3NT::Quux|
,
'Non-existant ACTUAL in superclass throws correct error'
);
is(
$quux_obj
->c3_then_next, 21,
'C3 then NEXT'
);
is(
$quux_obj
->next_then_c3, 22,
'NEXT then C3'
);