X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F16_introspection.t;h=f2f04e4525cc36a66b4cd239ab5f76979ea71c6c;hb=6d0d8ba45ef01c9a2537e59dce8787d9fe31e7d2;hp=688baec8707fdcf9d3af7ae8f77b0bdf9e23de54;hpb=5885c4f4e1f234e7521f952bd1c1956395494c1e;p=gitmo%2FMooseX-Types.git diff --git a/t/16_introspection.t b/t/16_introspection.t index 688baec..f2f04e4 100644 --- a/t/16_introspection.t +++ b/t/16_introspection.t @@ -2,8 +2,10 @@ use strict; use warnings; -use Data::Dump qw( pp ); -use Test::More tests => 1; +use Test::More; + +use FindBin; +use lib "$FindBin::Bin/lib"; do { package IntrospectionTest; @@ -12,6 +14,16 @@ do { use IntrospectTypeExports __PACKAGE__, qw( TwentyThree NonEmptyStr MyNonEmptyStr ); use TestLibrary NonEmptyStr => { -as => 'MyNonEmptyStr' }; use IntrospectTypeExports __PACKAGE__, qw( TwentyThree NonEmptyStr MyNonEmptyStr ); + + sub NotAType () { 'just a string' } + + BEGIN { + eval { + IntrospectTypeExports->import(__PACKAGE__, qw( NotAType )); + }; + ::ok(!$@, "introspecting something that's not not a type doesn't blow up"); + } + BEGIN { no strict 'refs'; delete ${'IntrospectionTest::'}{TwentyThree}; @@ -36,9 +48,12 @@ is_deeply(IntrospectTypeExports->get_memory, [ [$P, NonEmptyStr => undef], [$P, MyNonEmptyStr => 'TestLibrary::NonEmptyStr'], + [$P, NotAType => undef], + [$P, TwentyThree => undef], [$P, NonEmptyStr => undef], [$P, MyNonEmptyStr => 'TestLibrary::NonEmptyStr'], ], 'all calls to has_available_type_export returned correct results'); +done_testing();