82dee7de92a0bd35 failed to add ext/lib/Makefile.PL. Oops.
[p5sagit/p5-mst-13.2.git] / ext / ExtUtils-MakeMaker / t / metafile_data.t
CommitLineData
2e65e370 1BEGIN {
b78fd716 2 unshift @INC, 't/lib';
2e65e370 3}
4
5use strict;
b6d6132c 6use Test::More tests => 7;
2e65e370 7
8use Data::Dumper;
9
10require ExtUtils::MM_Any;
11
12my $new_mm = sub {
b6d6132c 13 return bless { ARGS => {@_}, @_ }, 'ExtUtils::MM_Any';
2e65e370 14};
15
16{
17 my $mm = $new_mm->(
18 DISTNAME => 'Foo-Bar',
19 VERSION => 1.23,
20 PM => {
21 "Foo::Bar" => 'lib/Foo/Bar.pm',
22 },
23 );
24
25 is_deeply [$mm->metafile_data], [
26 name => 'Foo-Bar',
27 version => 1.23,
28 abstract => undef,
29 author => [],
30 license => 'unknown',
31 distribution_type => 'module',
32
33 configure_requires => {
34 'ExtUtils::MakeMaker' => 0,
35 },
1487aac6 36 build_requires => {
37 'ExtUtils::MakeMaker' => 0,
38 },
2e65e370 39
40 no_index => {
41 directory => [qw(t inc)],
42 },
43
44 generated_by => "ExtUtils::MakeMaker version $ExtUtils::MakeMaker::VERSION",
45 'meta-spec' => {
46 url => 'http://module-build.sourceforge.net/META-spec-v1.4.html',
47 version => 1.4
48 },
49 ];
50
51
52 is_deeply [$mm->metafile_data({}, { no_index => { directory => [qw(foo)] } })], [
53 name => 'Foo-Bar',
54 version => 1.23,
55 abstract => undef,
56 author => [],
57 license => 'unknown',
58 distribution_type => 'module',
59
60 configure_requires => {
61 'ExtUtils::MakeMaker' => 0,
62 },
1487aac6 63 build_requires => {
64 'ExtUtils::MakeMaker' => 0,
65 },
2e65e370 66
67 no_index => {
68 directory => [qw(t inc foo)],
69 },
70
71 generated_by => "ExtUtils::MakeMaker version $ExtUtils::MakeMaker::VERSION",
72 'meta-spec' => {
73 url => 'http://module-build.sourceforge.net/META-spec-v1.4.html',
74 version => 1.4
75 },
76 ], 'rt.cpan.org 39348';
77}
78
79
80{
81 my $mm = $new_mm->(
82 DISTNAME => 'Foo-Bar',
83 VERSION => 1.23,
84 AUTHOR => 'Some Guy',
85 PREREQ_PM => {
86 Foo => 2.34,
87 Bar => 4.56,
88 },
89 );
90
91 is_deeply [$mm->metafile_data(
92 {
93 configure_requires => {
94 Stuff => 2.34
95 },
96 wobble => 42
97 },
98 {
99 no_index => {
100 package => "Thing"
101 },
102 wibble => 23
103 },
104 )],
105 [
106 name => 'Foo-Bar',
107 version => 1.23,
108 abstract => undef,
109 author => ['Some Guy'],
110 license => 'unknown',
111 distribution_type => 'script',
112
113 configure_requires => {
114 Stuff => 2.34,
115 },
1487aac6 116 build_requires => {
117 'ExtUtils::MakeMaker' => 0,
118 },
119
2e65e370 120 requires => {
121 Foo => 2.34,
122 Bar => 4.56,
123 },
124
125 no_index => {
126 directory => [qw(t inc)],
127 package => 'Thing',
128 },
129
130 generated_by => "ExtUtils::MakeMaker version $ExtUtils::MakeMaker::VERSION",
131 'meta-spec' => {
132 url => 'http://module-build.sourceforge.net/META-spec-v1.4.html',
133 version => 1.4
134 },
135
136 wibble => 23,
137 wobble => 42,
138 ];
139}
bf87a6a1 140
141
142# Test MIN_PERL_VERSION
143{
144 my $mm = $new_mm->(
145 DISTNAME => 'Foo-Bar',
146 VERSION => 1.23,
147 PM => {
148 "Foo::Bar" => 'lib/Foo/Bar.pm',
149 },
150 MIN_PERL_VERSION => 5.006,
151 );
152
153 is_deeply [$mm->metafile_data], [
154 name => 'Foo-Bar',
155 version => 1.23,
156 abstract => undef,
157 author => [],
158 license => 'unknown',
159 distribution_type => 'module',
160
161 configure_requires => {
162 'ExtUtils::MakeMaker' => 0,
163 },
1487aac6 164 build_requires => {
165 'ExtUtils::MakeMaker' => 0,
166 },
bf87a6a1 167
168 requires => {
169 perl => '5.006',
170 },
171
172 no_index => {
173 directory => [qw(t inc)],
174 },
175
176 generated_by => "ExtUtils::MakeMaker version $ExtUtils::MakeMaker::VERSION",
177 'meta-spec' => {
178 url => 'http://module-build.sourceforge.net/META-spec-v1.4.html',
179 version => 1.4
180 },
181 ];
182}
183
184
185# Test MIN_PERL_VERSION
186{
187 my $mm = $new_mm->(
188 DISTNAME => 'Foo-Bar',
189 VERSION => 1.23,
190 PM => {
191 "Foo::Bar" => 'lib/Foo/Bar.pm',
192 },
193 MIN_PERL_VERSION => 5.006,
194 PREREQ_PM => {
195 'Foo::Bar' => 1.23,
196 },
197 );
198
199 is_deeply [$mm->metafile_data], [
200 name => 'Foo-Bar',
201 version => 1.23,
202 abstract => undef,
203 author => [],
204 license => 'unknown',
205 distribution_type => 'module',
206
207 configure_requires => {
208 'ExtUtils::MakeMaker' => 0,
209 },
1487aac6 210 build_requires => {
211 'ExtUtils::MakeMaker' => 0,
212 },
bf87a6a1 213
214 requires => {
215 perl => '5.006',
216 'Foo::Bar' => 1.23,
217 },
218
219 no_index => {
220 directory => [qw(t inc)],
221 },
222
223 generated_by => "ExtUtils::MakeMaker version $ExtUtils::MakeMaker::VERSION",
224 'meta-spec' => {
225 url => 'http://module-build.sourceforge.net/META-spec-v1.4.html',
226 version => 1.4
227 },
228 ];
229}
5bdf71cc 230
231# Test CONFIGURE_REQUIRES
232{
233 my $mm = $new_mm->(
234 DISTNAME => 'Foo-Bar',
235 VERSION => 1.23,
236 CONFIGURE_REQUIRES => {
237 "Fake::Module1" => 1.01,
238 },
239 PM => {
240 "Foo::Bar" => 'lib/Foo/Bar.pm',
241 },
242 );
243
244 is_deeply [$mm->metafile_data], [
245 name => 'Foo-Bar',
246 version => 1.23,
247 abstract => undef,
248 author => [],
249 license => 'unknown',
250 distribution_type => 'module',
251
252 configure_requires => {
253 'Fake::Module1' => 1.01,
254 },
255 build_requires => {
256 'ExtUtils::MakeMaker' => 0,
257 },
258
259 no_index => {
260 directory => [qw(t inc)],
261 },
262
263 generated_by => "ExtUtils::MakeMaker version $ExtUtils::MakeMaker::VERSION",
264 'meta-spec' => {
265 url => 'http://module-build.sourceforge.net/META-spec-v1.4.html',
266 version => 1.4
267 },
268 ],'CONFIGURE_REQUIRES';
269}
b6d6132c 270
271# Test BUILD_REQUIRES
272{
273 my $mm = $new_mm->(
274 DISTNAME => 'Foo-Bar',
275 VERSION => 1.23,
276 BUILD_REQUIRES => {
277 "Fake::Module1" => 1.01,
278 },
279 PM => {
280 "Foo::Bar" => 'lib/Foo/Bar.pm',
281 },
282 );
283
284 is_deeply [$mm->metafile_data], [
285 name => 'Foo-Bar',
286 version => 1.23,
287 abstract => undef,
288 author => [],
289 license => 'unknown',
290 distribution_type => 'module',
291
292 configure_requires => {
293 'ExtUtils::MakeMaker' => 0,
294 },
295 build_requires => {
296 'Fake::Module1' => 1.01,
297 },
298
299 no_index => {
300 directory => [qw(t inc)],
301 },
302
303 generated_by => "ExtUtils::MakeMaker version $ExtUtils::MakeMaker::VERSION",
304 'meta-spec' => {
305 url => 'http://module-build.sourceforge.net/META-spec-v1.4.html',
306 version => 1.4
307 },
308 ],'CONFIGURE_REQUIRES';
309}