added has_available_type_export introspection utility function
[gitmo/MooseX-Types.git] / t / 16_introspection.t
1 #!/usr/bin/env perl
2 use strict;
3 use warnings;
4
5 use Data::Dump qw( pp );
6 use Test::More tests => 1;
7
8 do {
9     package IntrospectionTest;
10     use IntrospectTypeExports   __PACKAGE__, qw( TwentyThree NonEmptyStr MyNonEmptyStr );
11     use TestLibrary             qw( TwentyThree );
12     use IntrospectTypeExports   __PACKAGE__, qw( TwentyThree NonEmptyStr MyNonEmptyStr );
13     use TestLibrary             NonEmptyStr => { -as => 'MyNonEmptyStr' };
14     use IntrospectTypeExports   __PACKAGE__, qw( TwentyThree NonEmptyStr MyNonEmptyStr );
15     BEGIN { 
16         no strict 'refs'; 
17         delete ${'IntrospectionTest::'}{TwentyThree};
18     }
19 };
20
21 use IntrospectTypeExports IntrospectionTest => qw( TwentyThree NonEmptyStr MyNonEmptyStr );
22
23 my $P = 'IntrospectionTest';
24
25 is_deeply(IntrospectTypeExports->get_memory, [
26
27     [$P, TwentyThree    => undef],
28     [$P, NonEmptyStr    => undef],
29     [$P, MyNonEmptyStr  => undef],
30
31     [$P, TwentyThree    => 'TestLibrary::TwentyThree'],
32     [$P, NonEmptyStr    => undef],
33     [$P, MyNonEmptyStr  => undef],
34
35     [$P, TwentyThree    => 'TestLibrary::TwentyThree'],
36     [$P, NonEmptyStr    => undef],
37     [$P, MyNonEmptyStr  => 'TestLibrary::NonEmptyStr'],
38
39     [$P, TwentyThree    => undef],
40     [$P, NonEmptyStr    => undef],
41     [$P, MyNonEmptyStr  => 'TestLibrary::NonEmptyStr'],
42
43 ], 'all calls to has_available_type_export returned correct results');
44