avoid needing . in @INC in dev mode
[gitmo/Class-C3-XS.git] / t / 36_next_goto.t
1 use strict;
2 use warnings;
3
4 use Test::More tests => 4;
5
6 use Class::C3::XS;
7
8 {
9     package Proxy;
10     our @ISA = qw//;
11     sub next_proxy { goto &next::method }
12     sub maybe_proxy { goto &maybe::next::method }
13     sub can_proxy { goto &next::can }
14
15     package TBase;
16     our @ISA = qw//;
17     sub foo { 42 }
18     sub bar { 24 }
19     # baz doesn't exist intentionally
20     sub quux { 242 }
21
22     package TTop;
23     our @ISA = qw/TBase/;
24     sub foo { shift->Proxy::next_proxy() }
25     sub bar { shift->Proxy::maybe_proxy() }
26     sub baz { shift->Proxy::maybe_proxy() }
27     sub quux { shift->Proxy::can_proxy()->() }
28 }
29
30 is(TTop->foo, 42, 'proxy next::method via goto');
31 is(TTop->bar, 24, 'proxy maybe::next::method via goto');
32 is(TTop->baz, undef, 'proxy maybe::next::method via goto with no method');
33 is(TTop->quux, 242, 'proxy next::can via goto');