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