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