1#!/usr/bin/perl -w
2
3BEGIN {
4    unshift @INC, 't/lib';
5}
6
7use strict;
8use Config;
9
10use Test::More;
11use File::Temp qw[tempdir];
12
13unless( eval { require Data::Dumper } ) {
14    plan skip_all => 'Data::Dumper not available';
15}
16
17plan tests => 11;
18
19
20use MakeMaker::Test::Utils;
21use MakeMaker::Test::Setup::BFD;
22
23# 'make disttest' sets a bunch of environment variables which interfere
24# with our testing.
25delete @ENV{qw(PREFIX LIB MAKEFLAGS)};
26
27my $Perl = which_perl();
28my $Makefile = makefile_name();
29my $Is_VMS = $^O eq 'VMS';
30
31my $tmpdir = tempdir( DIR => 't', CLEANUP => 1 );
32chdir $tmpdir;
33
34perl_lib;
35
36$| = 1;
37
38ok( setup_recurs(), 'setup' );
39END {
40    ok( chdir File::Spec->updir );
41    ok( teardown_recurs(), 'teardown' );
42}
43
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;
79