6 use Test::More tests => 12;
19 sub new { bless {}, $_[0] }
20 sub bar { 'Foo::bar' }
23 # call the submethod in the direct instance
29 is($foo->bar(), 'Foo::bar', '... got the right return value');
31 # fail calling it from a subclass
45 # test it working with with Sub::Name
48 skip "Sub::Name is required for this test", 3 if $@;
50 my $m = sub { (shift)->next::method() };
51 Sub::Name::subname('Bar::bar', $m);
57 Class::C3::initialize();
60 my $value = eval { $bar->bar() };
61 ok(!$@, '... calling bar() succedded') || diag $@;
62 is($value, 'Foo::bar', '... got the right return value too');
65 # test it failing without Sub::Name
79 my $m = sub { (shift)->next::method() };
85 Class::C3::initialize();
88 ok($@, '... calling bar() with next::method failed') || diag $@;