5 use lib "$FindBin::Bin/lib";
7 use Test::More tests => 7;
10 BEGIN { use_ok 'Combined', qw/Foo2Alias MTFNPY NonEmptyStr/ }
12 # test that a type from TestLibrary was exported
15 # test that a type from TestLibrary2 was exported
18 is NonEmptyStr->name, 'TestLibrary2::NonEmptyStr',
19 'precedence for conflicting types is correct';
21 like exception { Combined->import('NonExistentType') },
22 qr/\Qmain asked for a type (NonExistentType) which is not found in any of the type libraries (TestLibrary TestLibrary2) combined by Combined/,
23 'asking for a non-existent type from a combined type library gives a useful error';
28 use base 'MooseX::Types::Combine';
30 ::like ::exception { __PACKAGE__->provide_types_from('Empty') },
31 qr/Cannot use Empty in a combined type library, it does not provide any types/,
32 'cannot combine types from a package which is not a type library';
34 ::like ::exception { __PACKAGE__->provide_types_from('DoesNotExist') },
35 qr/Can't locate DoesNotExist\.pm/,
36 'cannot combine types from a package which does not exist';