Commit | Line | Data |
bb4e9162 |
1 | #!/usr/bin/perl -w |
2 | |
3 | use strict; |
4 | use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib'; |
5 | use MBTest tests => 27; |
6 | |
7 | ######################### |
8 | |
9 | use Module::Build; |
10 | ok(1); |
11 | |
12 | package Foo; |
13 | sub foo; |
14 | |
15 | package MySub1; |
16 | use base 'Module::Build'; |
17 | |
18 | package MySub2; |
19 | use base 'MySub1'; |
20 | |
21 | package MySub3; |
22 | use base qw(MySub2 Foo); |
23 | |
24 | package MyTest; |
25 | use base 'Module::Build'; |
26 | |
27 | package MyBulk; |
28 | use base qw(MySub2 MyTest); |
29 | |
30 | package main; |
31 | |
32 | ok my @parents = MySub1->mb_parents; |
33 | # There will be at least one platform class in between. |
34 | ok @parents >= 2; |
35 | # They should all inherit from Module::Build::Base; |
36 | ok ! grep { !$_->isa('Module::Build::Base') } @parents; |
37 | is $parents[0], 'Module::Build'; |
38 | is $parents[-1], 'Module::Build::Base'; |
39 | |
40 | ok @parents = MySub2->mb_parents; |
41 | ok @parents >= 3; |
42 | ok ! grep { !$_->isa('Module::Build::Base') } @parents; |
43 | is $parents[0], 'MySub1'; |
44 | is $parents[1], 'Module::Build'; |
45 | is $parents[-1], 'Module::Build::Base'; |
46 | |
47 | ok @parents = MySub3->mb_parents; |
48 | ok @parents >= 4; |
49 | ok ! grep { !$_->isa('Module::Build::Base') } @parents; |
50 | is $parents[0], 'MySub2'; |
51 | is $parents[1], 'MySub1'; |
52 | is $parents[2], 'Module::Build'; |
53 | is $parents[-1], 'Module::Build::Base'; |
54 | |
55 | ok @parents = MyBulk->mb_parents; |
56 | ok @parents >= 5; |
57 | ok ! grep { !$_->isa('Module::Build::Base') } @parents; |
58 | is $parents[0], 'MySub2'; |
59 | is $parents[1], 'MySub1'; |
60 | is $parents[2], 'Module::Build'; |
61 | is $parents[-2], 'Module::Build::Base'; |
62 | is $parents[-1], 'MyTest'; |