Upgrade to ExtUtils-MakeMaker-6.32. Included a version
[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     use Config;
47     skip ("installman3dir is null", 1)
48         if !$Config{installman3dir} or
49             $Config{installman3dir} !~ /\S/ or
50             $Config{installman3dir} eq 'none';
51     my $mm = WriteMakefile(
52         NAME            => 'Big::Dummy',
53         VERSION_FROM    => 'lib/Big/Dummy.pm',
54     );
55
56     ok( keys %{ $mm->{MAN3PODS} } );
57 }
58
59 {
60     local $Config{installman3dir} = File::Spec->catdir(qw(t lib));
61
62     my $mm = WriteMakefile(
63         NAME            => 'Big::Dummy',
64         VERSION_FROM    => 'lib/Big/Dummy.pm',
65         INSTALLMAN3DIR  => 'none'
66     );
67
68     ok( !keys %{ $mm->{MAN3PODS} } );
69 }
70
71
72 {
73     my $mm = WriteMakefile(
74         NAME            => 'Big::Dummy',
75         VERSION_FROM    => 'lib/Big/Dummy.pm',
76         MAN3PODS        => {}
77     );
78
79     is_deeply( $mm->{MAN3PODS}, { } );
80 }
81
82
83 {
84     my $mm = WriteMakefile(
85         NAME            => 'Big::Dummy',
86         VERSION_FROM    => 'lib/Big/Dummy.pm',
87         MAN3PODS        => { "Foo.pm" => "Foo.1" }
88     );
89
90     is_deeply( $mm->{MAN3PODS}, { "Foo.pm" => "Foo.1" } );
91 }