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 65 66 67 68 69
|
#!/usr/bin/perl
use strict;
use warnings;
use lib 't/lib', 'lib';
use Test::More;
use Test::Exception;
{
package Bar;
use Moose;
::lives_ok { extends 'Foo' } 'loaded Foo superclass correctly';
}
{
package Baz;
use Moose;
::lives_ok { extends 'Bar' } 'loaded (inline) Bar superclass correctly';
}
{
package Foo::Bar;
use Moose;
::lives_ok { extends 'Foo', 'Bar' }
'loaded Foo and (inline) Bar superclass correctly';
}
{
package Bling;
use Moose;
::throws_ok { extends 'No::Class' }
qr{Can't locate No/Class\.pm in \@INC},
'correct error when superclass could not be found';
}
{
package Affe;
our $VERSION = 23;
}
{
package Tiger;
use Moose;
::lives_ok { extends 'Foo', Affe => { -version => 13 } }
'extends with version requirement';
}
{
package Birne;
use Moose;
::throws_ok { extends 'Foo', Affe => { -version => 42 } }
qr/Affe version 42 required--this is only version 23/,
'extends with unsatisfied version requirement';
}
done_testing;
|