Upgrade to Parse::CPAN::Meta 1.38
[perl.git] / lib / Parse / CPAN / Meta / t / 11_meta_yml.t
1 #!/usr/bin/perl
2
3 # Testing of common META.yml examples
4
5 BEGIN {
6         if( $ENV{PERL_CORE} ) {
7                 chdir 't';
8                 @INC = ('../lib', 'lib');
9         }
10         else {
11                 unshift @INC, 't/lib/';
12         }
13 }
14
15 use strict;
16 BEGIN {
17         $|  = 1;
18         $^W = 1;
19 }
20
21 use File::Spec::Functions ':ALL';
22 use Parse::CPAN::Meta::Test;
23 use Test::More tests(8, 3);
24
25
26
27
28
29 #####################################################################
30 # Testing YAML::Tiny's own META.yml file
31
32 yaml_ok(
33         <<'END_YAML',
34 abstract: Read/Write YAML files with as little code as possible
35 author: 'Adam Kennedy <cpan@ali.as>'
36 build_requires:
37   File::Spec: 0.80
38   Test::More: 0.47
39 distribution_type: module
40 generated_by: Module::Install version 0.63
41 license: perl
42 name: YAML-Tiny
43 no_index:
44   directory:
45     - inc
46     - t
47 requires:
48   perl: 5.005
49 version: 0.03
50 END_YAML
51         [ {
52                 abstract          => 'Read/Write YAML files with as little code as possible',
53                 author            => 'Adam Kennedy <cpan@ali.as>',
54                 build_requires    => {
55                         'File::Spec' => '0.80',
56                         'Test::More' => '0.47',
57                 },
58                 distribution_type => 'module',
59                 generated_by      => 'Module::Install version 0.63',
60                 license           => 'perl',
61                 name              => 'YAML-Tiny',
62                 no_index          => {
63                         directory    => [ qw{inc t} ],
64                 },
65                 requires          => {
66                         perl         => '5.005',
67                 },
68                 version           => '0.03',
69         } ],
70         'YAML::Tiny',
71 );
72
73
74
75
76
77
78 #####################################################################
79 # Testing a META.yml from a commercial project that crashed
80
81 yaml_ok(
82         <<'END_YAML',
83 # http://module-build.sourceforge.net/META-spec.html
84 #XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
85 name:         ITS-SIN-FIDS-Content-XML
86 version:      0.01
87 version_from: lib/ITS/SIN/FIDS/Content/XML.pm
88 installdirs:  site
89 requires:
90     Test::More:                    0.45
91     XML::Simple:                   2
92
93 distribution_type: module
94 generated_by: ExtUtils::MakeMaker version 6.30
95 END_YAML
96         [ {
97                 name              => 'ITS-SIN-FIDS-Content-XML',
98                 version           => "0.01",
99                 version_from      => 'lib/ITS/SIN/FIDS/Content/XML.pm',
100                 installdirs       => 'site',
101                 requires          => {
102                         'Test::More'  => 0.45,
103                         'XML::Simple' => 2,
104                         },
105                 distribution_type => 'module',
106                 generated_by      => 'ExtUtils::MakeMaker version 6.30',
107         } ],
108         'YAML::Tiny',
109 );
110
111
112
113
114
115
116 #####################################################################
117 # Testing various failing META.yml files from CPAN
118
119 yaml_ok(
120         <<'END_YAML',
121 ---
122 abstract: Mii in Nintendo Wii data parser and builder
123 author: Toru Yamaguchi <zigorou@cpan.org>
124 distribution_type: module
125 generated_by: Module::Install version 0.65
126 license: perl
127 meta-spec:
128   url: http://module-build.sourceforge.net/META-spec-v1.3.html
129   version: 1.3
130 name: Games-Nintendo-Wii-Mii
131 no_index:
132   directory:
133     - inc
134     - t
135 requires:
136   Carp: 1.03
137   Class::Accessor::Fast: 0.3
138   File::Slurp: 9999.12
139   IO::File: 1.1
140   Readonly: 0
141   Tie::IxHash: 1.21
142   URI: 1.35
143   XML::LibXML: 1.62
144 version: 0.02
145 END_YAML
146         [ {
147                 abstract => 'Mii in Nintendo Wii data parser and builder',
148                 author   => 'Toru Yamaguchi <zigorou@cpan.org>',
149                 distribution_type => 'module',
150                 generated_by => 'Module::Install version 0.65',
151                 license => 'perl',
152                 'meta-spec' => {
153                         url => 'http://module-build.sourceforge.net/META-spec-v1.3.html',
154                         version => '1.3',
155                 },
156                 name => 'Games-Nintendo-Wii-Mii',
157                 no_index => {
158                         directory => [ qw{ inc t } ],
159                 },
160                 requires => {
161                         'Carp' => '1.03',
162                         'Class::Accessor::Fast' => '0.3',
163                         'File::Slurp' => '9999.12',
164                         'IO::File'    => '1.1',
165                         'Readonly'    => '0',
166                         'Tie::IxHash' => '1.21',
167                         'URI'         => '1.35',
168                         'XML::LibXML' => '1.62',
169                 },
170                 version => '0.02',
171         } ],
172         'Games-Nintendo-Wii-Mii',
173 );
174
175 yaml_ok(
176         <<'END_YAML',
177 # http://module-build.sourceforge.net/META-spec.html
178 #XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
179 name:         Acme-Time-Baby
180 version:      2.106
181 version_from: Baby.pm
182 installdirs:  site
183 requires:
184     warnings:
185
186 distribution_type: module
187 generated_by: ExtUtils::MakeMaker version 6.17
188 END_YAML
189         [ {
190                 name => 'Acme-Time-Baby',
191                 version => '2.106',
192                 version_from => 'Baby.pm',
193                 installdirs => 'site',
194                 requires => {
195                         warnings => undef,
196                 },
197                 distribution_type => 'module',
198                 generated_by => 'ExtUtils::MakeMaker version 6.17',
199         } ],
200         'Acme-Time-Baby',
201         noyamlperl => 1,
202 );
203
204
205
206
207
208 #####################################################################
209 # File with a YAML header
210
211 yaml_ok(
212         <<'END_YAML',
213 --- #YAML:1.0
214 name:     Data-Swap
215 version:  0.05
216 license:  perl
217 distribution_type: module
218 requires:
219    perl:  5.6.0
220 dynamic_config: 0
221 END_YAML
222         [ {
223                 name => 'Data-Swap',
224                 version => '0.05',
225                 license => 'perl',
226                 distribution_type => 'module',
227                 requires => {
228                         perl => '5.6.0',
229                 },
230                 dynamic_config => '0',
231         } ],
232         'Data-Swap',
233         nosyck => 1,
234 );
235
236
237
238
239
240 #####################################################################
241 # Various files that fail for unknown reasons
242
243 SCOPE: {
244         my $content = load_ok(
245                 'Template-Provider-Unicode-Japanese.yml',
246                 catfile( test_data_directory(), 'Template-Provider-Unicode-Japanese.yml' ),
247                 100
248         );
249         yaml_ok(
250                 $content,
251                 [ {
252                         abstract => 'Decode all templates by Unicode::Japanese',
253                         author   => 'Hironori Yoshida C<< <yoshida@cpan.org> >>',
254                         distribution_type => 'module',
255                         generated_by => 'Module::Install version 0.65',
256                         license => 'perl',
257                         'meta-spec' => {
258                                 url => 'http://module-build.sourceforge.net/META-spec-v1.3.html',
259                                 version => '1.3',
260                         },
261                         name => 'Template-Provider-Unicode-Japanese',
262                         no_index => {
263                                 directory => [ qw{ inc t } ],
264                         },
265                         requires => {
266                                 'Template::Config' => 0,
267                                 'Unicode::Japanese' => 0,
268                                 perl => '5.6.0',
269                                 version => '0',
270                         },
271                         version => '1.2.1',
272                 } ],
273                 'Template-Provider-Unicode-Japanese',
274                 noyamlperl => 1,
275         );
276 }
277
278 SCOPE: {
279         my $content = load_ok(
280                 'HTML-WebDAO.yml',
281                 catfile( test_data_directory(), 'HTML-WebDAO.yml' ),
282                 100
283         );
284         yaml_ok(
285                 $content,
286                 [ {
287                         abstract => 'Perl extension for create complex web application',
288                         author   => [
289                                 'Zahatski Aliaksandr, E<lt>zagap@users.sourceforge.netE<gt>',
290                         ],
291                         license  => 'perl',
292                         name     => 'HTML-WebDAO',
293                         version  => '0.04',
294                 } ],
295                 'HTML-WebDAO',
296                 nosyck => 1,
297         );
298 }
299
300 SCOPE: {
301         my $content = load_ok(
302                 'Spreadsheet-Read.yml',
303                 catfile( test_data_directory(), 'Spreadsheet-Read.yml' ),
304                 100
305         );
306         yaml_ok(
307                 $content,
308                 [ {
309                         'resources' => {
310                                 'license' => 'http://dev.perl.org/licenses/'
311                         },
312                         'meta-spec' => {
313                                 'version' => '1.4',
314                                 'url' => 'http://module-build.sourceforge.net/META-spec-v1.4.html'
315                         },
316                         'distribution_type' => 'module',
317                         'generated_by' => 'Author',
318                         'version' => 'VERSION',
319                         'name' => 'Read',
320                         'author' => [
321                                 'H.Merijn Brand <h.m.brand@xs4all.nl>'
322                         ],
323                         'license' => 'perl',
324                         'build_requires' => {
325                                 'Test::More' => '0',
326                                 'Test::Harness' => '0',
327                                 'perl' => '5.006'
328                         },
329                         'provides' => {
330                                 'Spreadsheet::Read' => {
331                                         'version' => 'VERSION',
332                                         'file' => 'Read.pm'
333                                 }
334                         },
335                         'optional_features' => [
336                                 {
337                                         'opt_csv' => {
338                                                 'requires' => {
339                                                         'Text::CSV_XS' => '0.23'
340                                                 },
341                                                 'recommends' => {
342                                                         'Text::CSV_PP' => '1.10',
343                                                         'Text::CSV_XS' => '0.58',
344                                                         'Text::CSV' => '1.10'
345                                                 },
346                                                 'description' => 'Provides parsing of CSV streams'
347                                         }
348                                 },
349                                 {
350                                         'opt_excel' => {
351                                                 'requires' => {
352                                                         'Spreadsheet::ParseExcel' => '0.26',
353                                                         'Spreadsheet::ParseExcel::FmtDefault' => '0'
354                                                 },
355                                                 'recommends' => {
356                                                         'Spreadsheet::ParseExcel' => '0.42'
357                                                 },
358                                                 'description' => 'Provides parsing of Microsoft Excel files'
359                                         }
360                                 },
361                                 {
362                                         'opt_excelx' => {
363                                                 'requires' => {
364                                                         'Spreadsheet::XLSX' => '0.07'
365                                                 },
366                                                 'description' => 'Provides parsing of Microsoft Excel 2007 files'
367                                         }
368                                 },
369                                 {
370                                         'opt_oo' => {
371                                                 'requires' => {
372                                                         'Spreadsheet::ReadSXC' => '0.2'
373                                                 },
374                                                 'description' => 'Provides parsing of OpenOffice spreadsheets'
375                                         }
376                                 },
377                                 {
378                                         'opt_tools' => {
379                                                 'recommends' => {
380                                                         'Tk::TableMatrix::Spreadsheet' => '0',
381                                                         'Tk::NoteBook' => '0',
382                                                         'Tk' => '0'
383                                                 },
384                                                 'description' => 'Spreadsheet tools'
385                                         }
386                                 }
387                         ],
388                         'requires' => {
389                                 'perl' => '5.006',
390                                 'Data::Dumper' => '0',
391                                 'Exporter' => '0',
392                                 'Carp' => '0'
393                         },
394                         'recommends' => {
395                                 'perl' => '5.008005',
396                                 'IO::Scalar' => '0',
397                                 'File::Temp' => '0.14'
398                         },
399                         'abstract' => 'Meta-Wrapper for reading spreadsheet data'
400                 } ],
401                 'Spreadsheet-Read',
402                 noyamlpm   => 1,
403                 noyamlperl => 1,
404         );
405 }