Commit | Line | Data |
---|---|---|
58d32538 RGS |
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 | ||
608a105b | 18 | use File::Spec; |
58d32538 RGS |
19 | use TieOut; |
20 | use MakeMaker::Test::Utils; | |
21 | use MakeMaker::Test::Setup::BFD; | |
22 | ||
23 | use ExtUtils::MakeMaker; | |
608a105b RGS |
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'; | |
58d32538 RGS |
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 | ||
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 | } |