Upgrade to ExtUtils::MakeMaker 6.49_01
[p5sagit/p5-mst-13.2.git] / lib / ExtUtils / t / metafile_data.t
CommitLineData
2e65e370 1BEGIN {
2 if( $ENV{PERL_CORE} ) {
3 chdir 't' if -d 't';
4 @INC = ('../lib', 'lib');
5 }
6 else {
7 unshift @INC, 't/lib';
8 }
9}
10
11use strict;
bf87a6a1 12use Test::More tests => 5;
2e65e370 13
14use Data::Dumper;
15
16require ExtUtils::MM_Any;
17
18my $new_mm = sub {
19 return bless {@_}, 'ExtUtils::MM_Any';
20};
21
22{
23 my $mm = $new_mm->(
24 DISTNAME => 'Foo-Bar',
25 VERSION => 1.23,
26 PM => {
27 "Foo::Bar" => 'lib/Foo/Bar.pm',
28 },
29 );
30
31 is_deeply [$mm->metafile_data], [
32 name => 'Foo-Bar',
33 version => 1.23,
34 abstract => undef,
35 author => [],
36 license => 'unknown',
37 distribution_type => 'module',
38
39 configure_requires => {
40 'ExtUtils::MakeMaker' => 0,
41 },
1487aac6 42 build_requires => {
43 'ExtUtils::MakeMaker' => 0,
44 },
2e65e370 45
46 no_index => {
47 directory => [qw(t inc)],
48 },
49
50 generated_by => "ExtUtils::MakeMaker version $ExtUtils::MakeMaker::VERSION",
51 'meta-spec' => {
52 url => 'http://module-build.sourceforge.net/META-spec-v1.4.html',
53 version => 1.4
54 },
55 ];
56
57
58 is_deeply [$mm->metafile_data({}, { no_index => { directory => [qw(foo)] } })], [
59 name => 'Foo-Bar',
60 version => 1.23,
61 abstract => undef,
62 author => [],
63 license => 'unknown',
64 distribution_type => 'module',
65
66 configure_requires => {
67 'ExtUtils::MakeMaker' => 0,
68 },
1487aac6 69 build_requires => {
70 'ExtUtils::MakeMaker' => 0,
71 },
2e65e370 72
73 no_index => {
74 directory => [qw(t inc foo)],
75 },
76
77 generated_by => "ExtUtils::MakeMaker version $ExtUtils::MakeMaker::VERSION",
78 'meta-spec' => {
79 url => 'http://module-build.sourceforge.net/META-spec-v1.4.html',
80 version => 1.4
81 },
82 ], 'rt.cpan.org 39348';
83}
84
85
86{
87 my $mm = $new_mm->(
88 DISTNAME => 'Foo-Bar',
89 VERSION => 1.23,
90 AUTHOR => 'Some Guy',
91 PREREQ_PM => {
92 Foo => 2.34,
93 Bar => 4.56,
94 },
95 );
96
97 is_deeply [$mm->metafile_data(
98 {
99 configure_requires => {
100 Stuff => 2.34
101 },
102 wobble => 42
103 },
104 {
105 no_index => {
106 package => "Thing"
107 },
108 wibble => 23
109 },
110 )],
111 [
112 name => 'Foo-Bar',
113 version => 1.23,
114 abstract => undef,
115 author => ['Some Guy'],
116 license => 'unknown',
117 distribution_type => 'script',
118
119 configure_requires => {
120 Stuff => 2.34,
121 },
1487aac6 122 build_requires => {
123 'ExtUtils::MakeMaker' => 0,
124 },
125
2e65e370 126 requires => {
127 Foo => 2.34,
128 Bar => 4.56,
129 },
130
131 no_index => {
132 directory => [qw(t inc)],
133 package => 'Thing',
134 },
135
136 generated_by => "ExtUtils::MakeMaker version $ExtUtils::MakeMaker::VERSION",
137 'meta-spec' => {
138 url => 'http://module-build.sourceforge.net/META-spec-v1.4.html',
139 version => 1.4
140 },
141
142 wibble => 23,
143 wobble => 42,
144 ];
145}
bf87a6a1 146
147
148# Test MIN_PERL_VERSION
149{
150 my $mm = $new_mm->(
151 DISTNAME => 'Foo-Bar',
152 VERSION => 1.23,
153 PM => {
154 "Foo::Bar" => 'lib/Foo/Bar.pm',
155 },
156 MIN_PERL_VERSION => 5.006,
157 );
158
159 is_deeply [$mm->metafile_data], [
160 name => 'Foo-Bar',
161 version => 1.23,
162 abstract => undef,
163 author => [],
164 license => 'unknown',
165 distribution_type => 'module',
166
167 configure_requires => {
168 'ExtUtils::MakeMaker' => 0,
169 },
1487aac6 170 build_requires => {
171 'ExtUtils::MakeMaker' => 0,
172 },
bf87a6a1 173
174 requires => {
175 perl => '5.006',
176 },
177
178 no_index => {
179 directory => [qw(t inc)],
180 },
181
182 generated_by => "ExtUtils::MakeMaker version $ExtUtils::MakeMaker::VERSION",
183 'meta-spec' => {
184 url => 'http://module-build.sourceforge.net/META-spec-v1.4.html',
185 version => 1.4
186 },
187 ];
188}
189
190
191# Test MIN_PERL_VERSION
192{
193 my $mm = $new_mm->(
194 DISTNAME => 'Foo-Bar',
195 VERSION => 1.23,
196 PM => {
197 "Foo::Bar" => 'lib/Foo/Bar.pm',
198 },
199 MIN_PERL_VERSION => 5.006,
200 PREREQ_PM => {
201 'Foo::Bar' => 1.23,
202 },
203 );
204
205 is_deeply [$mm->metafile_data], [
206 name => 'Foo-Bar',
207 version => 1.23,
208 abstract => undef,
209 author => [],
210 license => 'unknown',
211 distribution_type => 'module',
212
213 configure_requires => {
214 'ExtUtils::MakeMaker' => 0,
215 },
1487aac6 216 build_requires => {
217 'ExtUtils::MakeMaker' => 0,
218 },
bf87a6a1 219
220 requires => {
221 perl => '5.006',
222 'Foo::Bar' => 1.23,
223 },
224
225 no_index => {
226 directory => [qw(t inc)],
227 },
228
229 generated_by => "ExtUtils::MakeMaker version $ExtUtils::MakeMaker::VERSION",
230 'meta-spec' => {
231 url => 'http://module-build.sourceforge.net/META-spec-v1.4.html',
232 version => 1.4
233 },
234 ];
235}