xref: /openbsd-src/gnu/usr.bin/perl/cpan/ExtUtils-MakeMaker/t/pod2man.t (revision 256a93a44f36679bee503f12e49566c2183f6181)
1#!/usr/bin/perl -w
2
3# Test our simulation of pod2man
4
5use strict;
6use warnings;
7use lib 't/lib';
8
9use ExtUtils::Command::MM;
10
11use 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
23    like $warnings, qr/Option perm_rw requires an argument/;
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
42    ok !pod2man();
43    is $warnings, <<'END'
44Pod::Man is not available: Simulated Pod::Man failure
45Man pages will not be generated during this install.
46END
47
48}
49