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