3 # Testing of common META.yml examples
6 if( $ENV{PERL_CORE} ) {
8 @INC = ('../lib', 'lib');
11 unshift @INC, 't/lib/';
21 use File::Spec::Functions ':ALL';
22 use Parse::CPAN::Meta::Test;
23 use Test::More tests(37);
29 #####################################################################
30 # In META.yml files, some hash keys contain module names
32 # Hash key legally containing a colon
35 [ { 'Foo::Bar' => 1 } ],
51 #####################################################################
52 # Support for literal multi-line scalars
54 # Declarative multi-line scalar
60 [ { foo => "bar baz\n" } ],
64 # Piped multi-line scalar
73 [ [ "foo\nbar\n", 1 ] ],
77 # ... with a pointless hyphen
78 yaml_ok( <<'END_YAML',
85 [ [ "foo\nbar", 1 ] ],
93 #####################################################################
94 # Support for YAML version directives
96 # Simple inline case (comment variant)
102 [ { foo => 'bar' } ],
103 'simple_doctype_comment',
107 # Simple inline case (percent variant)
113 [ { foo => 'bar' } ],
114 'simple_doctype_percent',
120 # Simple header (comment variant)
127 [ { foo => 'bar' } ],
135 # Simple inline case (comment variant)
142 [ { foo => 'bar' } ],
149 # Multiple inline documents (comment variant)
159 [ { foo => 'bar' }, [ 1 ], { foo => 'bar' } ],
160 'multi_doctype_comment',
163 # Simple pre-document case (comment variant)
170 [ { foo => 'bar' } ],
171 'predocument_percent',
177 # Simple pre-document case (comment variant)
184 [ { foo => 'bar' } ],
185 'predocument_comment',
192 #####################################################################
208 #####################################################################
218 [ [ 'foo', {}, 'bar' ] ],
219 'null hash in array',
229 [ [ 'foo', [], 'bar' ] ],
230 'null array in array',
239 [ { foo => {}, bar => 1 } ],
249 [ { foo => [], bar => 1 } ],
250 'null array in hash',
256 #####################################################################
257 # Trailing Whitespace
262 abstract: Generate fractal curves
270 abstract => 'Generate fractal curves',
272 arr => [ 'foo', undef, 'bar' ],
274 'trailing whitespace',
282 #####################################################################
289 - 'mst: Matt S. Trout <mst@shadowcatsystems.co.uk>'
291 [ { author => [ 'mst: Matt S. Trout <mst@shadowcatsystems.co.uk>' ] } ],
299 #####################################################################
300 # Quote and Escaping Idiosyncracies
306 name2: 'O''Reilly O''Tool'
307 name3: 'Double '''' Quote'
311 name2 => "O'Reilly O'Tool",
312 name3 => "Double '' Quote",
314 'single quote subtleties',
327 slash3 => "\\\\foo\\\\\\\\",
329 'single quote subtleties',
336 #####################################################################
337 # Empty Values and Premature EOF
346 [ { foo => 0, requires => undef, build_requires => undef } ],
359 [ [ 'foo', undef, undef ] ],
369 #####################################################################
370 # Comment on the Document Line
377 [ { foo => 'bar' } ],
388 #####################################################################
395 [ { foo => "foo\\\n\tbar" } ],
396 'special characters',
403 #####################################################################
404 # Confirm we can read the synopsis
417 rootproperty => 'blah',
433 #####################################################################
434 # Unprintable Characters
437 "--- \"foo\\n\\x00\"\n",
446 #####################################################################
456 [ [ "foo", "bar" ] ],
463 #####################################################################
464 # Indentation after empty hash value
481 note: 'note this test profile'
499 name => 'test profile',
500 note => 'note this test profile',
503 'Indentation after empty hash value',
511 #####################################################################
519 [ { 'the key' => 'the value' } ],
526 #####################################################################
529 # Tests a particular pathological case
537 [ [ 'value', '><' ] ],
538 'Pathological >< case',
545 #####################################################################
551 #- "Ingy d\xC3\xB6t Net"
553 # [ [ "Ingy d\xC3\xB6t Net" ] ],
561 ######################################################################
562 # Non-Indenting Sub-List
571 [ { foo => [ 'list' ], bar => 'value' } ],
572 'Non-indenting sub-list',
582 #####################################################################
583 # Check Multiple-Escaping
585 # RT #42119: write of two single quotes
589 'Multiple escaping of quote ok',
592 # Escapes without whitespace
596 'Multiple escaping of escape ok',
599 # Escapes with whitespace
603 'Multiple escaping of escape with whitespace ok',
610 ######################################################################
611 # Check illegal characters that are in legal places
621 'Ampersand in a quote',