Reinstate tests removed by change #30381, but don't
[p5sagit/p5-mst-13.2.git] / lib / ExtUtils / t / build_man.t
1 #!/usr/bin/perl -w
2
3 # Test if MakeMaker declines to build man pages under the right conditions.
4
5 BEGIN {
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
15 use strict;
16 use Test::More tests => 9;
17
18 use File::Spec;
19 use TieOut;
20 use MakeMaker::Test::Utils;
21 use MakeMaker::Test::Setup::BFD;
22
23 use ExtUtils::MakeMaker;
24 use 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';
29
30 chdir 't';
31
32 perl_lib();
33
34 ok( setup_recurs(), 'setup' );
35 END {
36     ok( chdir File::Spec->updir );
37     ok( teardown_recurs(), 'teardown' );
38 }
39
40 ok( chdir 'Big-Dummy', "chdir'd to Big-Dummy" ) ||
41   diag("chdir failed: $!");
42
43 ok( my $stdout = tie *STDOUT, 'TieOut' );
44
45 SKIP: {
46     skip ("installman3dir is null", 1)
47         if !$Config{installman3dir} or
48             $Config{installman3dir} !~ /\S/ or
49             $Config{installman3dir} eq 'none';
50     my $mm = WriteMakefile(
51         NAME            => 'Big::Dummy',
52         VERSION_FROM    => 'lib/Big/Dummy.pm',
53     );
54
55     ok( keys %{ $mm->{MAN3PODS} } );
56 }
57
58 {
59     local $Config{installman3dir} = File::Spec->catdir(qw(t lib));
60
61     my $mm = WriteMakefile(
62         NAME            => 'Big::Dummy',
63         VERSION_FROM    => 'lib/Big/Dummy.pm',
64         INSTALLMAN3DIR  => 'none'
65     );
66
67     ok( !keys %{ $mm->{MAN3PODS} } );
68 }
69
70
71 {
72     my $mm = WriteMakefile(
73         NAME            => 'Big::Dummy',
74         VERSION_FROM    => 'lib/Big/Dummy.pm',
75         MAN3PODS        => {}
76     );
77
78     is_deeply( $mm->{MAN3PODS}, { } );
79 }
80
81
82 {
83     my $mm = WriteMakefile(
84         NAME            => 'Big::Dummy',
85         VERSION_FROM    => 'lib/Big/Dummy.pm',
86         MAN3PODS        => { "Foo.pm" => "Foo.1" }
87     );
88
89     is_deeply( $mm->{MAN3PODS}, { "Foo.pm" => "Foo.1" } );
90 }