6 use Test::More tests => 11;
15 sub new { bless {}, $_[0] }
16 sub bar { 'Foo::bar' }
19 # call the submethod in the direct instance
25 is($foo->bar(), 'Foo::bar', '... got the right return value');
27 # fail calling it from a subclass
41 # test it working with with Sub::Name
44 skip "Sub::Name is required for this test", 3 if $@;
46 my $m = sub { (shift)->next::method() };
47 Sub::Name::subname('Bar::bar', $m);
54 my $value = eval { $bar->bar() };
55 ok(!$@, '... calling bar() succedded') || diag $@;
56 is($value, 'Foo::bar', '... got the right return value too');
59 # test it failing without Sub::Name
73 my $m = sub { (shift)->next::method() };
80 ok($@, '... calling bar() with next::method failed') || diag $@;