Add tests for has_available_type_export on something that's not a type.
Florian Ragwitz [Tue, 18 Aug 2009 05:37:16 +0000 (07:37 +0200)]
t/16_introspection.t

index da39992..b4821e3 100644 (file)
@@ -2,7 +2,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 1;
+use Test::More tests => 2;
 
 use FindBin;
 use lib "$FindBin::Bin/lib";
@@ -14,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};
@@ -38,6 +48,8 @@ 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'],