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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
#!/usr/bin/perl -w
use strict;
use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
use MBTest tests => 28;
use_ok 'Module::Build';
ensure_blib('Module::Build');
#########################
package Foo;
sub foo;
package MySub1;
use base 'Module::Build';
package MySub2;
use base 'MySub1';
package MySub3;
use base qw(MySub2 Foo);
package MyTest;
use base 'Module::Build';
package MyBulk;
use base qw(MySub2 MyTest);
package main;
ok my @parents = MySub1->mb_parents;
# There will be at least one platform class in between.
ok @parents >= 2;
# They should all inherit from Module::Build::Base;
ok ! grep { !$_->isa('Module::Build::Base') } @parents;
is $parents[0], 'Module::Build';
is $parents[-1], 'Module::Build::Base';
ok @parents = MySub2->mb_parents;
ok @parents >= 3;
ok ! grep { !$_->isa('Module::Build::Base') } @parents;
is $parents[0], 'MySub1';
is $parents[1], 'Module::Build';
is $parents[-1], 'Module::Build::Base';
ok @parents = MySub3->mb_parents;
ok @parents >= 4;
ok ! grep { !$_->isa('Module::Build::Base') } @parents;
is $parents[0], 'MySub2';
is $parents[1], 'MySub1';
is $parents[2], 'Module::Build';
is $parents[-1], 'Module::Build::Base';
ok @parents = MyBulk->mb_parents;
ok @parents >= 5;
ok ! grep { !$_->isa('Module::Build::Base') } @parents;
is $parents[0], 'MySub2';
is $parents[1], 'MySub1';
is $parents[2], 'Module::Build';
is $parents[-2], 'Module::Build::Base';
is $parents[-1], 'MyTest';
|