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 63 64
|
use lib 't', 'lib';
use strict;
use warnings;
package XXX;
BEGIN {require Thing}
use base 'Thing';
package Foo;
use base 'Spiffy';
BEGIN { @Foo::EXPORT=qw(xxx) }
sub xxx {}
package Bar;
use base 'Foo', 'Thing';
package Boo;
BEGIN { @Boo::EXPORT=qw(xxx) }
sub xxx {}
package Goo;
use base 'Boo';
package Something;
use base 'Spiffy';
BEGIN { @Something::EXPORT = qw(qwerty) }
sub qwerty {}
package SomethingGood;
use base 'Something';
package main;
use Test::More tests => 24;
ok(Thing->isa('Spiffy'));
ok(defined &XXX::thing);
ok(defined &XXX::field);
ok(defined &XXX::const);
ok(defined &Foo::field);
ok(defined &Foo::const);
ok(defined &Foo::xxx);
ok(Bar->isa('Spiffy'));
ok(Bar->isa('Foo'));
ok(Bar->isa('Thing'));
ok(defined &Bar::field);
ok(defined &Bar::const);
ok(defined &Bar::xxx);
ok(defined &Bar::thing);
ok(not Boo->isa('Spiffy'));
ok(defined &Boo::xxx);
ok(not Goo->isa('Spiffy'));
ok(Goo->isa('Boo'));
ok(not defined &Goo::xxx);
ok(SomethingGood->isa('Something'));
ok(SomethingGood->isa('Spiffy'));
ok(not SomethingGood->isa('Thing'));
ok(not defined &SomethingGood::thing);
ok(not @Spiffy::ISA);
|