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