Commit | Line | Data |
---|---|---|
5bdf71cc RGS |
1 | #!/usr/bin/perl -w |
2 | ||
75e3c8a3 DM |
3 | # Test our simulation of pod2man |
4 | ||
5bdf71cc | 5 | use strict; |
6d12145e | 6 | use warnings; |
5bdf71cc RGS |
7 | use lib 't/lib'; |
8 | ||
9 | use ExtUtils::Command::MM; | |
10 | ||
11 | use Test::More tests => 3; | |
12 | ||
13 | # The argument to perm_rw was optional. | |
14 | # [rt.cpan.org 35190] | |
15 | { | |
16 | my $warnings; | |
17 | local $SIG{__WARN__} = sub { | |
18 | $warnings .= join '', @_; | |
19 | }; | |
20 | ||
21 | pod2man("--perm_rw"); | |
22 | ||
9bbd51b7 | 23 | like $warnings, qr/Option perm_rw requires an argument/; |
5bdf71cc RGS |
24 | }; |
25 | ||
26 | ||
27 | # Simulate the failure of Pod::Man loading. | |
28 | # pod2man() should react gracefully. | |
29 | { | |
30 | local @INC = @INC; | |
31 | unshift @INC, sub { | |
32 | die "Simulated Pod::Man failure\n" if $_[1] eq 'Pod/Man.pm'; | |
33 | }; | |
34 | local %INC = %INC; | |
35 | delete $INC{"Pod/Man.pm"}; | |
36 | ||
37 | my $warnings; | |
38 | local $SIG{__WARN__} = sub { | |
39 | $warnings .= join '', @_; | |
40 | }; | |
41 | ||
2d4cc5ff | 42 | ok !pod2man(); |
5bdf71cc RGS |
43 | is $warnings, <<'END' |
44 | Pod::Man is not available: Simulated Pod::Man failure | |
45 | Man pages will not be generated during this install. | |
46 | END | |
47 | ||
48 | } |