This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
new perldelta
[perl5.git] / cpan / parent / t / compile-time-file.t
1 #!/usr/bin/perl -w
2 BEGIN {
3     if( $ENV{PERL_CORE} ) {
4         chdir 't' if -d 't';
5         chdir '../lib/parent';
6         @INC = '..';
7     }
8 }
9
10 use strict;
11 use Test::More tests => 9;
12 use lib 't/lib';
13
14 {
15     package Child;
16     use parent 'Dummy';
17 }
18
19 {
20     package Child2;
21     require Dummy;
22     use parent -norequire, 'Dummy::InlineChild';
23 }
24
25 {
26     package Child3;
27     use parent "Dummy'Outside";
28 }
29
30 my $obj = {};
31 bless $obj, 'Child';
32 isa_ok $obj, 'Dummy';
33 can_ok $obj, 'exclaim';
34 is $obj->exclaim, "I CAN FROM Dummy", 'Inheritance is set up correctly';
35
36 $obj = {};
37 bless $obj, 'Child2';
38 isa_ok $obj, 'Dummy::InlineChild';
39 can_ok $obj, 'exclaim';
40 is $obj->exclaim, "I CAN FROM Dummy::InlineChild", 'Inheritance is set up correctly for inlined classes';
41
42 $obj = {};
43 bless $obj, 'Child3';
44 isa_ok $obj, 'Dummy::Outside';
45 can_ok $obj, 'exclaim';
46 is $obj->exclaim, "I CAN FROM Dummy::Outside", "Inheritance is set up correctly for classes inherited from via '";
47