Add the original source packages to maemo, source lenny
[dh-make-perl] / dev / i386 / libmodule-build-perl / libmodule-build-perl-0.2808.01 / t / parents.t
diff --git a/dev/i386/libmodule-build-perl/libmodule-build-perl-0.2808.01/t/parents.t b/dev/i386/libmodule-build-perl/libmodule-build-perl-0.2808.01/t/parents.t
new file mode 100644 (file)
index 0000000..3229def
--- /dev/null
@@ -0,0 +1,62 @@
+#!/usr/bin/perl -w
+
+use strict;
+use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
+use MBTest tests => 27;
+
+#########################
+
+use Module::Build;
+ok(1);
+
+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';