82dee7de92a0bd35 failed to add ext/lib/Makefile.PL. Oops.
[p5sagit/p5-mst-13.2.git] / ext / ExtUtils-MakeMaker / t / prereq.t
CommitLineData
277189c8 1#!/usr/bin/perl -w
2
3# This is a test of the verification of the arguments to
4# WriteMakefile.
5
6BEGIN {
b78fd716 7 unshift @INC, 't/lib';
277189c8 8}
9
10use strict;
6d6be53e 11use Test::More tests => 13;
277189c8 12
13use TieOut;
14use MakeMaker::Test::Utils;
15use MakeMaker::Test::Setup::BFD;
16
17use ExtUtils::MakeMaker;
18
19chdir 't';
20
21perl_lib();
22
23ok( setup_recurs(), 'setup' );
24END {
25 ok( chdir File::Spec->updir );
26 ok( teardown_recurs(), 'teardown' );
27}
28
29ok( chdir 'Big-Dummy', "chdir'd to Big-Dummy" ) ||
30 diag("chdir failed: $!");
31
32{
33 ok( my $stdout = tie *STDOUT, 'TieOut' );
34 my $warnings = '';
35 local $SIG{__WARN__} = sub {
36 $warnings .= join '', @_;
37 };
38
39 WriteMakefile(
40 NAME => 'Big::Dummy',
41 PREREQ_PM => {
42 strict => 0
43 }
44 );
45 is $warnings, '';
46
47 $warnings = '';
48 WriteMakefile(
49 NAME => 'Big::Dummy',
50 PREREQ_PM => {
51 strict => 99999
52 }
53 );
54 is $warnings,
2e0bd20a 55 sprintf("Warning: prerequisite strict 99999 not found. We have %s.\n",
75e3c8a3 56 $strict::VERSION);
277189c8 57
58 $warnings = '';
59 WriteMakefile(
60 NAME => 'Big::Dummy',
61 PREREQ_PM => {
62 "I::Do::Not::Exist" => 0,
63 }
64 );
65 is $warnings,
66 "Warning: prerequisite I::Do::Not::Exist 0 not found.\n";
67
68 $warnings = '';
69 WriteMakefile(
70 NAME => 'Big::Dummy',
71 PREREQ_PM => {
72 "I::Do::Not::Exist" => 0,
73 "strict" => 99999,
74 }
75 );
76 is $warnings,
77 "Warning: prerequisite I::Do::Not::Exist 0 not found.\n".
2e0bd20a 78 sprintf("Warning: prerequisite strict 99999 not found. We have %s.\n",
75e3c8a3 79 $strict::VERSION);
277189c8 80
81 $warnings = '';
82 eval {
83 WriteMakefile(
84 NAME => 'Big::Dummy',
85 PREREQ_PM => {
86 "I::Do::Not::Exist" => 0,
87 "Nor::Do::I" => 0,
88 "strict" => 99999,
89 },
90 PREREQ_FATAL => 1,
91 );
92 };
93
94 is $warnings, '';
95 is $@, <<'END', "PREREQ_FATAL";
96MakeMaker FATAL: prerequisites not found.
97 I::Do::Not::Exist not installed
98 Nor::Do::I not installed
99 strict 99999
100
101Please install these modules first and rerun 'perl Makefile.PL'.
102END
103
6d6be53e 104
105 $warnings = '';
106 eval {
107 WriteMakefile(
108 NAME => 'Big::Dummy',
109 PREREQ_PM => {
110 "I::Do::Not::Exist" => 0,
111 },
112 CONFIGURE => sub {
113 require I::Do::Not::Exist;
114 },
115 PREREQ_FATAL => 1,
116 );
117 };
118
119 is $warnings, '';
120 is $@, <<'END', "PREREQ_FATAL happens before CONFIGURE";
121MakeMaker FATAL: prerequisites not found.
122 I::Do::Not::Exist not installed
123
124Please install these modules first and rerun 'perl Makefile.PL'.
125END
126
277189c8 127}