Commit | Line | Data |
5885c4f4 |
1 | #!/usr/bin/env perl |
2 | use strict; |
3 | use warnings; |
4 | |
a344ca96 |
5 | use Test::More; |
5885c4f4 |
6 | |
1616a2ca |
7 | use FindBin; |
8 | use lib "$FindBin::Bin/lib"; |
9 | |
5885c4f4 |
10 | do { |
11 | package IntrospectionTest; |
12 | use IntrospectTypeExports __PACKAGE__, qw( TwentyThree NonEmptyStr MyNonEmptyStr ); |
13 | use TestLibrary qw( TwentyThree ); |
14 | use IntrospectTypeExports __PACKAGE__, qw( TwentyThree NonEmptyStr MyNonEmptyStr ); |
15 | use TestLibrary NonEmptyStr => { -as => 'MyNonEmptyStr' }; |
16 | use IntrospectTypeExports __PACKAGE__, qw( TwentyThree NonEmptyStr MyNonEmptyStr ); |
9af232f8 |
17 | |
18 | sub NotAType () { 'just a string' } |
19 | |
20 | BEGIN { |
21 | eval { |
22 | IntrospectTypeExports->import(__PACKAGE__, qw( NotAType )); |
23 | }; |
24 | ::ok(!$@, "introspecting something that's not not a type doesn't blow up"); |
25 | } |
26 | |
e9dc30af |
27 | BEGIN { |
28 | no strict 'refs'; |
5885c4f4 |
29 | delete ${'IntrospectionTest::'}{TwentyThree}; |
30 | } |
31 | }; |
32 | |
33 | use IntrospectTypeExports IntrospectionTest => qw( TwentyThree NonEmptyStr MyNonEmptyStr ); |
34 | |
35 | my $P = 'IntrospectionTest'; |
36 | |
37 | is_deeply(IntrospectTypeExports->get_memory, [ |
38 | |
39 | [$P, TwentyThree => undef], |
40 | [$P, NonEmptyStr => undef], |
41 | [$P, MyNonEmptyStr => undef], |
42 | |
43 | [$P, TwentyThree => 'TestLibrary::TwentyThree'], |
44 | [$P, NonEmptyStr => undef], |
45 | [$P, MyNonEmptyStr => undef], |
46 | |
47 | [$P, TwentyThree => 'TestLibrary::TwentyThree'], |
48 | [$P, NonEmptyStr => undef], |
49 | [$P, MyNonEmptyStr => 'TestLibrary::NonEmptyStr'], |
50 | |
9af232f8 |
51 | [$P, NotAType => undef], |
52 | |
5885c4f4 |
53 | [$P, TwentyThree => undef], |
54 | [$P, NonEmptyStr => undef], |
55 | [$P, MyNonEmptyStr => 'TestLibrary::NonEmptyStr'], |
56 | |
57 | ], 'all calls to has_available_type_export returned correct results'); |
58 | |
a344ca96 |
59 | done_testing(); |