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