Upgrade to ExtUtils::MakeMaker 6.19
[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 => 11;
17 use MakeMaker::Test::Utils;
18 use MakeMaker::Test::Setup::BFD;
19
20 # 'make disttest' sets a bunch of environment variables which interfere
21 # with our testing.
22 delete @ENV{qw(PREFIX LIB MAKEFLAGS)};
23
24 my $Perl = which_perl();
25 my $Makefile = makefile_name();
26 my $Is_VMS = $^O eq 'VMS';
27
28 chdir($Is_VMS ? 'BFD_TEST_ROOT:[t]' : 't');
29 perl_lib;
30
31 $| = 1;
32
33 ok( setup_recurs(), 'setup' );
34 END {
35     ok( chdir File::Spec->updir );
36     ok( teardown_recurs(), 'teardown' );
37 }
38
39 ok( chdir('Big-Dummy'), "chdir'd to Big-Dummy" ) ||
40   diag("chdir failed: $!");
41
42 unlink $Makefile;
43 my $prereq_out = run(qq{$Perl Makefile.PL "PREREQ_PRINT=1"});
44 ok( !-r $Makefile, "PREREQ_PRINT produces no $Makefile" );
45 is( $?, 0,         '  exited normally' );
46 {
47     package _Prereq::Print;
48     no strict;
49     $PREREQ_PM = undef;  # shut up "used only once" warning.
50     eval $prereq_out;
51     ::is_deeply( $PREREQ_PM, { strict => 0 }, 'prereqs dumped' );
52     ::is( $@, '',                             '  without error' );
53 }
54
55
56 $prereq_out = run(qq{$Perl Makefile.PL "PRINT_PREREQ=1"});
57 ok( !-r $Makefile, "PRINT_PREREQ produces no $Makefile" );
58 is( $?, 0,         '  exited normally' );
59 ::like( $prereq_out, qr/^perl\(strict\) \s* >= \s* 0 \s*$/x, 
60                                                       'prereqs dumped' );
61
62
63 # Currently a bug.
64 #my $prereq_out = run(qq{$Perl Makefile.PL "PREREQ_PRINT=0"});
65 #ok( -r $Makefile, "PREREQ_PRINT=0 produces a $Makefile" );
66 #is( $?, 0,         '  exited normally' );
67 #unlink $Makefile;
68
69 # Currently a bug.
70 #my $prereq_out = run(qq{$Perl Makefile.PL "PRINT_PREREQ=1"});
71 #ok( -r $Makefile, "PRINT_PREREQ=0 produces a $Makefile" );
72 #is( $?, 0,         '  exited normally' );
73 #unlink $Makefile;