3 # This is a test of the verification of the arguments to
13 use Test::More tests => 21;
14 use File::Temp qw[tempdir];
17 use MakeMaker::Test::Utils;
18 use MakeMaker::Test::Setup::BFD;
20 use ExtUtils::MakeMaker;
23 perl_lib; # sets $ENV{PERL5LIB} relative to t/
25 my $tmpdir = tempdir( DIR => '../t', CLEANUP => 1 );
26 use Cwd; my $cwd = getcwd; END { chdir $cwd } # so File::Temp can cleanup
29 ok( setup_recurs(), 'setup' );
31 ok( chdir File::Spec->updir, 'chdir updir' );
32 ok( teardown_recurs(), 'teardown' );
35 ok( chdir 'Big-Dummy', "chdir'd to Big-Dummy" ) ||
36 diag("chdir failed: $!");
39 ok my $stdout = tie(*STDOUT, 'TieOut'), 'tie STDOUT';
41 local $SIG{__WARN__} = sub {
42 if ( $Config{usecrosscompile} ) {
43 # libraries might not be present on the target system
44 # when cross-compiling
45 return if $_[0] =~ /\A\QWarning (mostly harmless): No library found for \E.+/
47 $warnings .= join '', @_;
49 # prerequisite warnings are disabled while building the perl core:
50 local $ExtUtils::MakeMaker::UNDER_CORE = 0;
58 is $warnings, '', 'basic prereq';
61 skip 'No CMR, no version ranges', 1
62 unless ExtUtils::MakeMaker::_has_cpan_meta_requirements;
67 strict => '>= 0, <= 99999',
70 is $warnings, '', 'version range';
81 sprintf("Warning: prerequisite strict 99999 not found. We have %s.\n",
82 $strict::VERSION), 'strict 99999';
88 "I::Do::Not::Exist" => 0,
92 "Warning: prerequisite I::Do::Not::Exist 0 not found.\n", 'non-exist prereq';
97 CONFIGURE_REQUIRES => {
98 "I::Do::Not::Configure" => 0,
102 "Warning: prerequisite I::Do::Not::Configure 0 not found.\n", 'non-exist prereq';
106 NAME => 'Big::Dummy',
108 "I::Do::Not::Test" => 0,
112 "Warning: prerequisite I::Do::Not::Test 0 not found.\n", 'non-exist prereq';
117 NAME => 'Big::Dummy',
119 "I::Do::Not::Exist" => "",
122 my @warnings = split /\n/, $warnings;
123 is @warnings, 2, '2 warnings';
124 like $warnings[0], qr{^Undefined requirement for I::Do::Not::Exist\b}, 'undef version warning';
125 is $warnings[1], "Warning: prerequisite I::Do::Not::Exist 0 not found.", 'not found warning';
130 NAME => 'Big::Dummy',
132 "I::Do::Not::Exist" => 0,
138 = sprintf("Warning: prerequisite strict 99999 not found. We have %s.\n",
140 # Done this way because EBCDIC sorts in a different order
141 ok( $warnings =~ s/Warning: prerequisite I::Do::Not::Exist 0 not found\.\n//
142 && $warnings =~ s/\Q$strict_warn//
143 && $warnings eq "", '2 bad prereq warnings');
148 NAME => 'Big::Dummy',
150 "I::Do::Not::Exist" => 0,
158 is $warnings, '', 'no warnings on PREREQ_FATAL';
159 is $@, <<'END', "PREREQ_FATAL";
160 MakeMaker FATAL: prerequisites not found.
161 I::Do::Not::Exist not installed
162 Nor::Do::I not installed
165 Please install these modules first and rerun 'perl Makefile.PL'.
172 NAME => 'Big::Dummy',
174 "I::Do::Not::Exist" => 0,
177 require I::Do::Not::Exist;
183 is $warnings, '', 'CONFIGURE sub non-exist req no warn';
184 is $@, <<'END', "PREREQ_FATAL happens before CONFIGURE";
185 MakeMaker FATAL: prerequisites not found.
186 I::Do::Not::Exist not installed
188 Please install these modules first and rerun 'perl Makefile.PL'.
193 @ARGV = 'PREREQ_FATAL=1';
196 NAME => 'Big::Dummy',
197 PREREQ_PM => { "I::Do::Not::Exist" => 0, },
200 is $warnings, "Warning: prerequisite I::Do::Not::Exist 0 not found.\n",
201 'CLI PREREQ_FATAL warns';
202 isnt $@, '', "CLI PREREQ_FATAL works";