Lines Matching full:yaml

17 use CPAN::Meta::YAML;
39 E_CIRCULAR => qr{\QCPAN::Meta::YAML does not support circular references},
40 E_FEATURE => qr{\QCPAN::Meta::YAML does not support a feature},
41 E_PLAIN => qr{\QCPAN::Meta::YAML found illegal characters in plain scalar},
42 E_CLASSIFY => qr{\QCPAN::Meta::YAML failed to classify the line},
46 E_DUPKEY => qr{\QCPAN::Meta::YAML found a duplicate key},
49 # use XXX -with => 'YAML::XS';
101 # two blocks: perl, yaml
103 # Tests that a YAML string loads to the expected perl data. Also, tests
104 # roundtripping from perl->YAML->perl.
106 # We can't compare the YAML for roundtripping because CPAN::Meta::YAML doesn't
108 # YAML we can produce output YAML that produces the same Perl data as the
115 # However, if a test point called 'serializes' exists, the output YAML is
116 # expected to match the input YAML and will be checked for equality.
122 my ($yaml, $perl, $label) =
123 _testml_has_points($block, qw(yaml perl)) or return;
133 bless $expected, 'CPAN::Meta::YAML';
137 my $yaml_copy = $yaml;
138 my $got = eval { CPAN::Meta::YAML->read_string( $yaml_copy ); };
139 is( $@, '', "CPAN::Meta::YAML parses without error" );
140 is( $yaml_copy, $yaml, "CPAN::Meta::YAML does not modify the input string" );
143 isa_ok( $got, 'CPAN::Meta::YAML' );
144 cmp_deeply( $got, $expected, "CPAN::Meta::YAML parses correctly" )
145 or diag "ERROR: $CPAN::Meta::YAML::errstr\n\nYAML:$yaml";
153 is( $@, '', "CPAN::Meta::YAML serializes without error" );
158 "CPAN::Meta::YAML serializes to scalar",
160 my $roundtrip = eval { CPAN::Meta::YAML->read_string( $output ) };
161 is( $@, '', "CPAN::Meta::YAML round-trips without error" );
163 isa_ok( $roundtrip, 'CPAN::Meta::YAML' );
164 cmp_deeply( $roundtrip, $expected, "CPAN::Meta::YAML round-trips correctly" );
168 is( $output, $yaml, 'Serializes ok' );
177 # two blocks: perl, yaml
179 # Tests that perl references serialize correctly to a specific YAML output
189 my ($perl, $yaml, $label) =
190 _testml_has_points($block, qw(perl yaml)) or return;
195 my $result = eval { CPAN::Meta::YAML->new( @$input )->write_string };
197 is( $result, $yaml, "dumped YAML correct" );
226 my $result = eval { CPAN::Meta::YAML->new( @$input )->write_string };
235 # two blocks: yaml, error
237 # Tests that a YAML string results in an error when loaded
245 my ($yaml, $error, $label) =
246 _testml_has_points($block, qw(yaml error)) or return;
252 my $result = eval { CPAN::Meta::YAML->read_string( $yaml ) };
255 or diag "YAML:\n$yaml";
262 # two blocks: yaml, warning
264 # Tests that a YAML string results in warning when loaded
271 my ($yaml, $warning, $label) =
272 _testml_has_points($block, qw(yaml warning)) or return;
283 my $result = eval { CPAN::Meta::YAML->read_string( $yaml ) };
290 ) or diag "YAML:\n$yaml\n", 'warning: ', explain(\@warnings);
297 # two blocks: yaml, json
299 # Tests that a YAML string can be loaded to Perl and dumped to JSON and
308 my ($yaml, $json, $label) =
309 _testml_has_points($block, qw(yaml json)) or return;
312 # test YAML Load
314 CPAN::Meta::YAML::Load($yaml);
317 ok !$err, "YAML loads";
320 # test YAML->Perl->JSON
334 # two blocks: code, yaml
336 # Tests that a Unicode codepoint is correctly dumped to YAML as both
341 # The yaml code point is the expected output of { $key => $value } where
348 my ($code, $yaml, $label) =
349 _testml_has_points($block, qw(code yaml)) or return;
353 my $dump = CPAN::Meta::YAML::Dump($data);
355 is $dump, $yaml, "Dump key and value of code point char $code";
357 my $yny = CPAN::Meta::YAML::Dump(CPAN::Meta::YAML::Load($yaml));
359 is $yny, $yaml, "YAML for code point $code YNY roundtrips";
361 my $nyn = CPAN::Meta::YAML::Load(CPAN::Meta::YAML::Dump($data));
362 cmp_deeply( $nyn, $data, "YAML for code point $code NYN roundtrips" );
369 # Test CPAN::Meta::YAML->errstr against a regular expression and clear the