summaryrefslogtreecommitdiffstats
path: root/gnu/usr.bin/perl/cpan/parent/t/compile-time-file.t
blob: bff886155297fc83d15f341acbbcbd653aca591a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/perl -w
BEGIN {
    if( $ENV{PERL_CORE} ) {
        chdir 't' if -d 't';
        chdir '../lib/parent';
        @INC = '..';
    }
}

use strict;
use Test::More tests => 9;
use lib 't/lib';

{
    package Child;
    use parent 'Dummy';
}

{
    package Child2;
    require Dummy;
    use parent -norequire, 'Dummy::InlineChild';
}

{
    package Child3;
    use parent "Dummy'Outside";
}

my $obj = {};
bless $obj, 'Child';
isa_ok $obj, 'Dummy';
can_ok $obj, 'exclaim';
is $obj->exclaim, "I CAN FROM Dummy", 'Inheritance is set up correctly';

$obj = {};
bless $obj, 'Child2';
isa_ok $obj, 'Dummy::InlineChild';
can_ok $obj, 'exclaim';
is $obj->exclaim, "I CAN FROM Dummy::InlineChild", 'Inheritance is set up correctly for inlined classes';

$obj = {};
bless $obj, 'Child3';
isa_ok $obj, 'Dummy::Outside';
can_ok $obj, 'exclaim';
is $obj->exclaim, "I CAN FROM Dummy::Outside", "Inheritance is set up correctly for classes inherited from via '";