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