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