X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F18_combined_libs.t;h=976d92477cb9bf5314269a6d83b2b5b9c47c4666;hb=6db34a2fe061cc3d65fbeb9509e087ea1568986e;hp=cd2178dbdee0459e696540a62ab154d701178a51;hpb=10390913a3dce9f3c43d7797a41b2384634bc9a1;p=gitmo%2FMooseX-Types.git diff --git a/t/18_combined_libs.t b/t/18_combined_libs.t index cd2178d..976d924 100644 --- a/t/18_combined_libs.t +++ b/t/18_combined_libs.t @@ -2,9 +2,9 @@ use strict; use warnings; use FindBin; -use lib "$FindBin::Bin/lib"; +use lib "$FindBin::Bin/lib"; -use Test::More tests => 5; +use Test::More; use Test::Fatal; BEGIN { use_ok 'Combined', qw/Foo2Alias MTFNPY NonEmptyStr/ } @@ -21,3 +21,21 @@ is NonEmptyStr->name, 'TestLibrary2::NonEmptyStr', like exception { Combined->import('NonExistentType') }, qr/\Qmain asked for a type (NonExistentType) which is not found in any of the type libraries (TestLibrary TestLibrary2) combined by Combined/, 'asking for a non-existent type from a combined type library gives a useful error'; + +{ + package BadCombined; + + use base 'MooseX::Types::Combine'; + + ::like ::exception { __PACKAGE__->provide_types_from('Empty') }, + qr/Cannot use Empty in a combined type library, it does not provide any types/, + 'cannot combine types from a package which is not a type library'; + + ::like ::exception { __PACKAGE__->provide_types_from('DoesNotExist') }, + qr/Can't locate DoesNotExist\.pm/, + 'cannot combine types from a package which does not exist'; +} + +is exception { 'Combined'->import(':all') }, undef, ':all syntax works'; + +done_testing();