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