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 / actuns.t
CommitLineData
cd6c9654 1use Test::More tests => 6;
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 { ::ok(++$order==1,"test A"); $_[0]->NEXT::UNSEEN::ACTUAL::test;}
13021a80
JH
17
18package B;
bf5734d4
JH
19@ISA = qw/D C/;
20sub test { ::ok(++$order==2,"test B"); $_[0]->NEXT::ACTUAL::UNSEEN::test;}
13021a80
JH
21
22package C;
23@ISA = qw/D/;
bf5734d4 24sub test { ::ok(++$order==4,"test C"); $_[0]->NEXT::UNSEEN::ACTUAL::test;}
13021a80
JH
25
26package D;
27
bf5734d4 28sub test { ::ok(++$order==3,"test D"); $_[0]->NEXT::ACTUAL::UNSEEN::test;}
13021a80
JH
29
30package main;
31
32my $foo = {};
33
34bless($foo,"A");
35
bf5734d4
JH
36eval{ $foo->test }
37 ? fail("Didn't die on missing ancestor")
38 : pass("Correctly dies after C");