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 => 10; 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 25chdir 't'; 26perl_lib; # sets $ENV{PERL5LIB} relative to t/ 27 28my $tmpdir = tempdir( DIR => '../t', CLEANUP => 1 ); 29use Cwd; my $cwd = getcwd; END { chdir $cwd } # so File::Temp can cleanup 30chdir $tmpdir; 31 32ok( setup_recurs(), 'setup' ); 33END { 34 ok chdir File::Spec->updir, 'chdir updir'; 35 ok teardown_recurs(), 'teardown'; 36} 37 38ok( chdir 'Big-Dummy', "chdir'd to Big-Dummy" ) || 39 diag("chdir failed: $!"); 40my $README = 'README.pod'; 41{ open my $fh, '>', $README or die "$README: $!"; } 42 43ok((my $stdout = tie *STDOUT, 'TieOut'), 'tie stdout'); 44 45{ 46 local $Config{installman3dir} = File::Spec->catdir(qw(t lib)); 47 my $mm = WriteMakefile( 48 NAME => 'Big::Dummy', 49 VERSION_FROM => 'lib/Big/Dummy.pm', 50 ); 51 my %got = %{ $mm->{MAN3PODS} }; 52 # because value too OS-specific 53 my $delete_key = $^O eq 'VMS' ? '[.lib.Big]Dummy.pm' : 'lib/Big/Dummy.pm'; 54 ok delete($got{$delete_key}), 'normal man3pod'; 55 is_deeply \%got, {}, 'no extra man3pod'; 56} 57 58{ 59 my $mm = WriteMakefile( 60 NAME => 'Big::Dummy', 61 VERSION_FROM => 'lib/Big/Dummy.pm', 62 INSTALLMAN3DIR => 'none' 63 ); 64 is_deeply $mm->{MAN3PODS}, {}, 'suppress man3pod with "none"'; 65} 66 67{ 68 my $mm = WriteMakefile( 69 NAME => 'Big::Dummy', 70 VERSION_FROM => 'lib/Big/Dummy.pm', 71 MAN3PODS => {} 72 ); 73 is_deeply $mm->{MAN3PODS}, {}, 'suppress man3pod with {}'; 74} 75 76{ 77 my $mm = WriteMakefile( 78 NAME => 'Big::Dummy', 79 VERSION_FROM => 'lib/Big/Dummy.pm', 80 MAN3PODS => { "Foo.pm" => "Foo.1" } 81 ); 82 is_deeply $mm->{MAN3PODS}, { "Foo.pm" => "Foo.1" }, 'override man3pod'; 83} 84