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