[perl #32717] BeOS specific Updates
[p5sagit/p5-mst-13.2.git] / lib / ExtUtils / t / prereq_print.t
CommitLineData
2c91f887 1#!/usr/bin/perl -w
2
3BEGIN {
4 if( $ENV{PERL_CORE} ) {
5 chdir 't' if -d 't';
6 @INC = ('../lib', 'lib');
2799c206 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 }
2c91f887 12 }
13 else {
14 unshift @INC, 't/lib';
15 }
16}
17
18use strict;
19use Config;
20
a7d1454b 21use Test::More tests => 11;
2c91f887 22use MakeMaker::Test::Utils;
a7d1454b 23use MakeMaker::Test::Setup::BFD;
2c91f887 24
25# 'make disttest' sets a bunch of environment variables which interfere
26# with our testing.
27delete @ENV{qw(PREFIX LIB MAKEFLAGS)};
28
29my $Perl = which_perl();
30my $Makefile = makefile_name();
31my $Is_VMS = $^O eq 'VMS';
32
33chdir($Is_VMS ? 'BFD_TEST_ROOT:[t]' : 't');
34perl_lib;
35
36$| = 1;
37
a7d1454b 38ok( setup_recurs(), 'setup' );
39END {
40 ok( chdir File::Spec->updir );
41 ok( teardown_recurs(), 'teardown' );
42}
43
2c91f887 44ok( chdir('Big-Dummy'), "chdir'd to Big-Dummy" ) ||
45 diag("chdir failed: $!");
46
47unlink $Makefile;
48my $prereq_out = run(qq{$Perl Makefile.PL "PREREQ_PRINT=1"});
49ok( !-r $Makefile, "PREREQ_PRINT produces no $Makefile" );
50is( $?, 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"});
62ok( !-r $Makefile, "PRINT_PREREQ produces no $Makefile" );
63is( $?, 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;