From: Brandon L Black Date: Mon, 4 Jun 2007 03:57:13 +0000 (+0000) Subject: added new test file for goto on next::method, etc X-Git-Tag: 0.19~1 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FClass-C3.git;a=commitdiff_plain;h=14178c4e28dd13f96895d96dcdaa67feb7020b83 added new test file for goto on next::method, etc --- diff --git a/t/36_next_goto.t b/t/36_next_goto.t new file mode 100644 index 0000000..e4ea21b --- /dev/null +++ b/t/36_next_goto.t @@ -0,0 +1,35 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +use Test::More tests => 5; + +BEGIN { use_ok('Class::C3') } + +{ + package Proxy; + our @ISA = qw//; + sub next_proxy { goto &next::method } + sub maybe_proxy { goto &maybe::next::method } + sub can_proxy { goto &next::can } + + package TBase; + our @ISA = qw//; + sub foo { 42 } + sub bar { 24 } + # baz doesn't exist intentionally + sub quux { 242 } + + package TTop; + our @ISA = qw/TBase/; + sub foo { shift->Proxy::next_proxy() } + sub bar { shift->Proxy::maybe_proxy() } + sub baz { shift->Proxy::maybe_proxy() } + sub quux { shift->Proxy::can_proxy()->() } +} + +is(TTop->foo, 42, 'proxy next::method via goto'); +is(TTop->bar, 24, 'proxy maybe::next::method via goto'); +is(TTop->baz, undef, 'proxy maybe::next::method via goto with no method'); +is(TTop->quux, 242, 'proxy next::can via goto');