a814d342e7326142aae82494d78e0924a327cfc3
[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 use FindBin;
9 use lib "$FindBin::Bin/lib";
10
11 do {
12     package IntrospectionTest;
13     use IntrospectTypeExports   __PACKAGE__, qw( TwentyThree NonEmptyStr MyNonEmptyStr );
14     use TestLibrary             qw( TwentyThree );
15     use IntrospectTypeExports   __PACKAGE__, qw( TwentyThree NonEmptyStr MyNonEmptyStr );
16     use TestLibrary             NonEmptyStr => { -as => 'MyNonEmptyStr' };
17     use IntrospectTypeExports   __PACKAGE__, qw( TwentyThree NonEmptyStr MyNonEmptyStr );
18     BEGIN { 
19         no strict 'refs'; 
20         delete ${'IntrospectionTest::'}{TwentyThree};
21     }
22 };
23
24 use IntrospectTypeExports IntrospectionTest => qw( TwentyThree NonEmptyStr MyNonEmptyStr );
25
26 my $P = 'IntrospectionTest';
27
28 is_deeply(IntrospectTypeExports->get_memory, [
29
30     [$P, TwentyThree    => undef],
31     [$P, NonEmptyStr    => undef],
32     [$P, MyNonEmptyStr  => undef],
33
34     [$P, TwentyThree    => 'TestLibrary::TwentyThree'],
35     [$P, NonEmptyStr    => undef],
36     [$P, MyNonEmptyStr  => undef],
37
38     [$P, TwentyThree    => 'TestLibrary::TwentyThree'],
39     [$P, NonEmptyStr    => undef],
40     [$P, MyNonEmptyStr  => 'TestLibrary::NonEmptyStr'],
41
42     [$P, TwentyThree    => undef],
43     [$P, NonEmptyStr    => undef],
44     [$P, MyNonEmptyStr  => 'TestLibrary::NonEmptyStr'],
45
46 ], 'all calls to has_available_type_export returned correct results');
47