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=59d77b5b2a84d61abe62c488607751c4168f6cb5;hpb=249888e76248caa1bc4491d13a3c567910e2b577;p=gitmo%2FMooseX-Types.git diff --git a/t/11_library-definition.t b/t/11_library-definition.t index 59d77b5..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) + 3; - # new array ref so we can safely shift from it for my $data (map { [@$_] } @tests) { my $type = shift @$data; @@ -41,9 +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;