Upgrade to ExtUtils::MakeMaker 6.16.
[p5sagit/p5-mst-13.2.git] / lib / ExtUtils / t / prereq_print.t
1 #!/usr/bin/perl -w
2
3 BEGIN {
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
13 use strict;
14 use Config;
15
16 use Test::More tests => 8;
17 use MakeMaker::Test::Utils;
18
19 # 'make disttest' sets a bunch of environment variables which interfere
20 # with our testing.
21 delete @ENV{qw(PREFIX LIB MAKEFLAGS)};
22
23 my $Perl = which_perl();
24 my $Makefile = makefile_name();
25 my $Is_VMS = $^O eq 'VMS';
26
27 chdir($Is_VMS ? 'BFD_TEST_ROOT:[t]' : 't');
28 perl_lib;
29
30 $| = 1;
31
32 ok( chdir('Big-Dummy'), "chdir'd to Big-Dummy" ) ||
33   diag("chdir failed: $!");
34
35 unlink $Makefile;
36 my $prereq_out = run(qq{$Perl Makefile.PL "PREREQ_PRINT=1"});
37 ok( !-r $Makefile, "PREREQ_PRINT produces no $Makefile" );
38 is( $?, 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"});
50 ok( !-r $Makefile, "PRINT_PREREQ produces no $Makefile" );
51 is( $?, 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;