Full initial pass at perldelta. ready for sanity checking
[p5sagit/p5-mst-13.2.git] / cpan / ExtUtils-MakeMaker / t / prereq_print.t
1 #!/usr/bin/perl -w
2
3 BEGIN {
4     unshift @INC, 't/lib';
5 }
6
7 use strict;
8 use Config;
9
10 use Test::More;
11
12 unless( eval { require Data::Dumper } ) {
13     plan skip_all => 'Data::Dumper not available';
14 }
15
16 plan tests => 11;
17
18
19 use MakeMaker::Test::Utils;
20 use MakeMaker::Test::Setup::BFD;
21
22 # 'make disttest' sets a bunch of environment variables which interfere
23 # with our testing.
24 delete @ENV{qw(PREFIX LIB MAKEFLAGS)};
25
26 my $Perl = which_perl();
27 my $Makefile = makefile_name();
28 my $Is_VMS = $^O eq 'VMS';
29
30 chdir 't';
31 perl_lib;
32
33 $| = 1;
34
35 ok( setup_recurs(), 'setup' );
36 END {
37     ok( chdir File::Spec->updir );
38     ok( teardown_recurs(), 'teardown' );
39 }
40
41 ok( chdir('Big-Dummy'), "chdir'd to Big-Dummy" ) ||
42   diag("chdir failed: $!");
43
44 unlink $Makefile;
45 my $prereq_out = run(qq{$Perl Makefile.PL "PREREQ_PRINT=1"});
46 ok( !-r $Makefile, "PREREQ_PRINT produces no $Makefile" );
47 is( $?, 0,         '  exited normally' );
48 {
49     package _Prereq::Print;
50     no strict;
51     $PREREQ_PM = undef;  # shut up "used only once" warning.
52     eval $prereq_out;
53     ::is_deeply( $PREREQ_PM, { strict => 0 }, 'prereqs dumped' );
54     ::is( $@, '',                             '  without error' );
55 }
56
57
58 $prereq_out = run(qq{$Perl Makefile.PL "PRINT_PREREQ=1"});
59 ok( !-r $Makefile, "PRINT_PREREQ produces no $Makefile" );
60 is( $?, 0,         '  exited normally' );
61 ::like( $prereq_out, qr/^perl\(strict\) \s* >= \s* 0 \s*$/x, 
62                                                       'prereqs dumped' );
63
64
65 # Currently a bug.
66 #my $prereq_out = run(qq{$Perl Makefile.PL "PREREQ_PRINT=0"});
67 #ok( -r $Makefile, "PREREQ_PRINT=0 produces a $Makefile" );
68 #is( $?, 0,         '  exited normally' );
69 #unlink $Makefile;
70
71 # Currently a bug.
72 #my $prereq_out = run(qq{$Perl Makefile.PL "PRINT_PREREQ=1"});
73 #ok( -r $Makefile, "PRINT_PREREQ=0 produces a $Makefile" );
74 #is( $?, 0,         '  exited normally' );
75 #unlink $Makefile;