This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Get the "cv" from the "gv" once, and be more careful so that we can
[perl5.git] / lib / NEXT / t / actual.t
CommitLineData
cd6c9654 1use Test::More tests => 10;
bf5734d4 2
13021a80
JH
3BEGIN {
4 if ($ENV{PERL_CORE}) {
5 chdir('t') if -d 't';
6 @INC = qw(../lib);
7 }
8}
9
bf5734d4
JH
10BEGIN { use_ok('NEXT') };
11my $order = 0;
13021a80
JH
12
13package A;
14@ISA = qw/B C D/;
15
bf5734d4 16sub test { ++$order; ::ok($order==1,"test A"); $_[0]->NEXT::ACTUAL::test;}
13021a80
JH
17
18package B;
bf5734d4
JH
19@ISA = qw/D C/;
20sub test { ++$order; ::ok($order==2,"test B"); $_[0]->NEXT::ACTUAL::test;}
13021a80
JH
21
22package C;
23@ISA = qw/D/;
bf5734d4
JH
24sub test {
25 ++$order; ::ok($order==4||$order==6,"test C");
26 $_[0]->NEXT::ACTUAL::test;
27}
13021a80
JH
28
29package D;
30
bf5734d4
JH
31sub test {
32 ++$order; ::ok($order==3||$order==5||$order==7||$order==8,"test D");
33 $_[0]->NEXT::ACTUAL::test;
34}
13021a80
JH
35
36package main;
37
38my $foo = {};
39
40bless($foo,"A");
41
bf5734d4
JH
42eval{ $foo->test }
43 ? fail("Didn't die on missing ancestor")
44 : pass("Correctly dies after full traversal");