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