Commit | Line | Data |
0c5c3648 |
1 | #!/usr/bin/env perl |
2 | use Test::More; |
3 | |
4 | my $id = 0; |
5 | foreach my $mod (qw(Mouse Mouse::Role Mouse::Exporter)){ |
6 | $id++; |
7 | eval qq{ |
8 | no strict; |
9 | no warnings; |
10 | |
11 | package Class$id; |
12 | use $mod; |
13 | |
14 | my \$foo = 'foo'; |
15 | chop \$\$foo; |
16 | }; |
17 | like $@, qr/Can't use string \("foo"\) as a SCALAR ref while "strict refs" in use /, # ' |
18 | "using $mod turns on strictures"; |
19 | |
20 | my @warnings; |
21 | local $SIG{__WARN__} = sub { |
22 | push @warnings, @_; |
23 | }; |
24 | |
25 | $id++; |
26 | eval qq{ |
27 | no strict; |
28 | no warnings; |
29 | |
30 | package Class$id; |
31 | use $mod; |
32 | |
33 | my \$one = 1 + undef; |
34 | }; |
35 | is $@, ''; |
36 | |
37 | like("@warnings", qr/^Use of uninitialized value/, "using $mod turns on warnings"); |
38 | } |
39 | |
40 | done_testing; |