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