Commit | Line | Data |
f0ac4cdb |
1 | use Test::More 'no_plan'; |
2 | use strict; |
3 | |
4 | my $Class = 'Log::Message::Simple'; |
5 | my @Carp = qw[carp croak cluck confess]; |
6 | my @Msg = qw[msg debug error]; |
7 | |
8 | |
9 | |
10 | ### test empty import |
11 | { package Test::A; |
12 | |
13 | |
14 | eval "use $Class ()"; |
15 | Test::More::ok( !$@, "using $Class with no import" ); |
16 | |
17 | for my $func ( @Carp, @Msg ) { |
18 | Test::More::ok( !__PACKAGE__->can( $func ), |
19 | " $func not imported" ); |
20 | } |
21 | } |
22 | |
23 | ### test :STD import |
24 | { package Test::B; |
25 | |
26 | eval "use $Class ':STD'"; |
27 | Test::More::ok( !$@, "using $Class with :STD import" ); |
28 | |
29 | for my $func ( @Carp ) { |
30 | Test::More::ok( !__PACKAGE__->can( $func ), |
31 | " $func not imported" ); |
32 | } |
33 | |
34 | for my $func ( @Msg ) { |
35 | Test::More::ok( __PACKAGE__->can( $func ), |
36 | " $func imported" ); |
37 | } |
38 | } |
39 | |
40 | ### test :CARP import |
41 | { package Test::C; |
42 | |
43 | eval "use $Class ':CARP'"; |
44 | Test::More::ok( !$@, "using $Class with :CARP import" ); |
45 | |
46 | for my $func ( @Msg ) { |
47 | Test::More::ok( !__PACKAGE__->can( $func ), |
48 | " $func not imported" ); |
49 | } |
50 | |
51 | for my $func ( @Carp ) { |
52 | Test::More::ok( __PACKAGE__->can( $func ), |
53 | " $func imported" ); |
54 | } |
55 | } |
56 | |
57 | ### test all import |
58 | |
59 | { package Test::D; |
60 | |
61 | eval "use $Class ':ALL'"; |
62 | Test::More::ok( !$@, "using $Class with :ALL import" ); |
63 | |
64 | for my $func ( @Carp, @Msg ) { |
65 | Test::More::ok( __PACKAGE__->can( $func ), |
66 | " $func imported" ); |
67 | } |
68 | } |