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