xref: /openbsd-src/gnu/usr.bin/perl/cpan/ExtUtils-MakeMaker/t/build_man.t (revision ac9b4aacc1da35008afea06a5d23c2f2dea9b93e)
1#!/usr/bin/perl -w
2
3# Test if MakeMaker declines to build man pages under the right conditions.
4
5BEGIN {
6    unshift @INC, 't/lib';
7}
8
9use strict;
10use Test::More tests => 9;
11
12use File::Spec;
13use TieOut;
14use MakeMaker::Test::Utils;
15use MakeMaker::Test::Setup::BFD;
16
17use ExtUtils::MakeMaker;
18use ExtUtils::MakeMaker::Config;
19
20# Simulate an installation which has man page generation turned off to
21# ensure these tests will still work.
22$Config{installman3dir} = 'none';
23
24chdir 't';
25
26perl_lib();
27
28ok( setup_recurs(), 'setup' );
29END {
30    ok( chdir File::Spec->updir );
31    ok( teardown_recurs(), 'teardown' );
32}
33
34ok( chdir 'Big-Dummy', "chdir'd to Big-Dummy" ) ||
35  diag("chdir failed: $!");
36
37ok( my $stdout = tie *STDOUT, 'TieOut' );
38
39{
40    local $Config{installman3dir} = File::Spec->catdir(qw(t lib));
41
42    my $mm = WriteMakefile(
43        NAME            => 'Big::Dummy',
44        VERSION_FROM    => 'lib/Big/Dummy.pm',
45    );
46
47    ok( keys %{ $mm->{MAN3PODS} } );
48}
49
50{
51    my $mm = WriteMakefile(
52        NAME            => 'Big::Dummy',
53        VERSION_FROM    => 'lib/Big/Dummy.pm',
54        INSTALLMAN3DIR  => 'none'
55    );
56
57    is_deeply( $mm->{MAN3PODS}, {} );
58}
59
60
61{
62    my $mm = WriteMakefile(
63        NAME            => 'Big::Dummy',
64        VERSION_FROM    => 'lib/Big/Dummy.pm',
65        MAN3PODS        => {}
66    );
67
68    is_deeply( $mm->{MAN3PODS}, { } );
69}
70
71
72{
73    my $mm = WriteMakefile(
74        NAME            => 'Big::Dummy',
75        VERSION_FROM    => 'lib/Big/Dummy.pm',
76        MAN3PODS        => { "Foo.pm" => "Foo.1" }
77    );
78
79    is_deeply( $mm->{MAN3PODS}, { "Foo.pm" => "Foo.1" } );
80}
81