xref: /openbsd-src/gnu/usr.bin/perl/cpan/ExtUtils-MakeMaker/t/prereq_print.t (revision 50b7afb2c2c0993b0894d4e34bf857cb13ed9c80)
1#!/usr/bin/perl -w
2
3BEGIN {
4    unshift @INC, 't/lib';
5}
6
7use strict;
8use Config;
9
10use Test::More;
11
12unless( eval { require Data::Dumper } ) {
13    plan skip_all => 'Data::Dumper not available';
14}
15
16plan tests => 11;
17
18
19use MakeMaker::Test::Utils;
20use MakeMaker::Test::Setup::BFD;
21
22# 'make disttest' sets a bunch of environment variables which interfere
23# with our testing.
24delete @ENV{qw(PREFIX LIB MAKEFLAGS)};
25
26my $Perl = which_perl();
27my $Makefile = makefile_name();
28my $Is_VMS = $^O eq 'VMS';
29
30chdir 't';
31perl_lib;
32
33$| = 1;
34
35ok( setup_recurs(), 'setup' );
36END {
37    ok( chdir File::Spec->updir );
38    ok( teardown_recurs(), 'teardown' );
39}
40
41ok( chdir('Big-Dummy'), "chdir'd to Big-Dummy" ) ||
42  diag("chdir failed: $!");
43
44unlink $Makefile;
45my $prereq_out = run(qq{$Perl Makefile.PL "PREREQ_PRINT=1"});
46ok( !-r $Makefile, "PREREQ_PRINT produces no $Makefile" );
47is( $?, 0,         '  exited normally' );
48{
49    package _Prereq::Print;
50    no strict;
51    $PREREQ_PM = undef;  # shut up "used only once" warning.
52    eval $prereq_out;
53    ::is_deeply( $PREREQ_PM, { strict => 0 }, 'prereqs dumped' );
54    ::is( $@, '',                             '  without error' );
55}
56
57
58$prereq_out = run(qq{$Perl Makefile.PL "PRINT_PREREQ=1"});
59ok( !-r $Makefile, "PRINT_PREREQ produces no $Makefile" );
60is( $?, 0,         '  exited normally' );
61::like( $prereq_out, qr/^perl\(strict\) \s* >= \s* 0 \s*$/x,
62                                                      'prereqs dumped' );
63
64
65# Currently a bug.
66#my $prereq_out = run(qq{$Perl Makefile.PL "PREREQ_PRINT=0"});
67#ok( -r $Makefile, "PREREQ_PRINT=0 produces a $Makefile" );
68#is( $?, 0,         '  exited normally' );
69#unlink $Makefile;
70
71# Currently a bug.
72#my $prereq_out = run(qq{$Perl Makefile.PL "PRINT_PREREQ=1"});
73#ok( -r $Makefile, "PRINT_PREREQ=0 produces a $Makefile" );
74#is( $?, 0,         '  exited normally' );
75#unlink $Makefile;
76