X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F11_library-definition.t;h=484d5975619c0772c2e3ca1846eed3bc0a00000e;hb=6d0d8ba45ef01c9a2537e59dce8787d9fe31e7d2;hp=c71fede312e260f67b07586d247f87752488fa3c;hpb=8af0a70d3dcbde43af13cd45c8e14598350bc5a3;p=gitmo%2FMooseX-Types.git diff --git a/t/11_library-definition.t b/t/11_library-definition.t index c71fede..484d597 100644 --- a/t/11_library-definition.t +++ b/t/11_library-definition.t @@ -5,15 +5,14 @@ use strict; use Test::More; use FindBin; use lib "$FindBin::Bin/lib"; -use TestLibrary ':all'; +use TestLibrary qw( NonEmptyStr IntArrayRef ), + Foo2Alias => { -as => 'Foo' }; my @tests = ( [ 'NonEmptyStr', 12, "12", [], "foobar", "" ], [ 'IntArrayRef', 12, [12], {}, [17, 23], {} ], ); -plan tests => (@tests * 8) + 1; - # new array ref so we can safely shift from it for my $data (map { [@$_] } @tests) { my $type = shift @$data; @@ -41,5 +40,15 @@ for my $data (map { [@$_] } @tests) { } } +# aliasing test +ok my $code = __PACKAGE__->can('Foo'), 'aliased type exported under correct symbol'; +is $code->(), 'TestLibrary::Foo2Alias', 'aliased type returns unaliased type name'; + # coercion not available ok ! __PACKAGE__->can('to_TwentyThree'), "type without coercion doesn't have to_* helper"; + +eval { require TestNamespaceSep }; +ok $@, q(trying to declare a type with '::' in it croaks); +like $@, qr/Foo::Bar/, q(error message contains type name); + +done_testing;