xref: /openbsd-src/gnu/usr.bin/perl/cpan/ExtUtils-MakeMaker/t/build_man.t (revision f2da64fbbbf1b03f09f390ab01267c93dfd77c4c)
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 File::Temp qw[tempdir];
14use TieOut;
15use MakeMaker::Test::Utils;
16use MakeMaker::Test::Setup::BFD;
17
18use ExtUtils::MakeMaker;
19use ExtUtils::MakeMaker::Config;
20
21# Simulate an installation which has man page generation turned off to
22# ensure these tests will still work.
23$Config{installman3dir} = 'none';
24
25my $tmpdir = tempdir( DIR => 't', CLEANUP => 1 );
26chdir $tmpdir;
27
28perl_lib();
29
30ok( setup_recurs(), 'setup' );
31END {
32    ok( chdir File::Spec->updir );
33    ok( teardown_recurs(), 'teardown' );
34}
35
36ok( chdir 'Big-Dummy', "chdir'd to Big-Dummy" ) ||
37  diag("chdir failed: $!");
38
39ok( my $stdout = tie *STDOUT, 'TieOut' );
40
41{
42    local $Config{installman3dir} = File::Spec->catdir(qw(t lib));
43
44    my $mm = WriteMakefile(
45        NAME            => 'Big::Dummy',
46        VERSION_FROM    => 'lib/Big/Dummy.pm',
47    );
48
49    ok( keys %{ $mm->{MAN3PODS} } );
50}
51
52{
53    my $mm = WriteMakefile(
54        NAME            => 'Big::Dummy',
55        VERSION_FROM    => 'lib/Big/Dummy.pm',
56        INSTALLMAN3DIR  => 'none'
57    );
58
59    is_deeply( $mm->{MAN3PODS}, {} );
60}
61
62
63{
64    my $mm = WriteMakefile(
65        NAME            => 'Big::Dummy',
66        VERSION_FROM    => 'lib/Big/Dummy.pm',
67        MAN3PODS        => {}
68    );
69
70    is_deeply( $mm->{MAN3PODS}, { } );
71}
72
73
74{
75    my $mm = WriteMakefile(
76        NAME            => 'Big::Dummy',
77        VERSION_FROM    => 'lib/Big/Dummy.pm',
78        MAN3PODS        => { "Foo.pm" => "Foo.1" }
79    );
80
81    is_deeply( $mm->{MAN3PODS}, { "Foo.pm" => "Foo.1" } );
82}
83