diff options
author | Steve Hay <steve.m.hay@googlemail.com> | 2015-06-05 08:36:40 +0100 |
---|---|---|
committer | Steve Hay <steve.m.hay@googlemail.com> | 2015-06-05 08:36:40 +0100 |
commit | e586de20812e9f61c323eb589c4aa5f2063dca68 (patch) | |
tree | 2cbbbc626dcc744229203e8abb5326b8e8a5e420 /cpan/CPAN-Meta-YAML | |
parent | 374c951fdd2c4790cd23a67880bb9ef72eb97a33 (diff) | |
download | perl-e586de20812e9f61c323eb589c4aa5f2063dca68.tar.gz |
Upgrade CPAN-Meta-YAML from version 0.014 to 0.016
Diffstat (limited to 'cpan/CPAN-Meta-YAML')
-rw-r--r-- | cpan/CPAN-Meta-YAML/lib/CPAN/Meta/YAML.pm | 8 | ||||
-rw-r--r-- | cpan/CPAN-Meta-YAML/t/00-report-prereqs.dd | 2 | ||||
-rw-r--r-- | cpan/CPAN-Meta-YAML/t/12_write.t | 2 | ||||
-rw-r--r-- | cpan/CPAN-Meta-YAML/t/21_yamlpm_compat.t | 2 | ||||
-rw-r--r-- | cpan/CPAN-Meta-YAML/t/lib/TestBridge.pm | 42 | ||||
-rwxr-xr-x | cpan/CPAN-Meta-YAML/t/tml | 1 | ||||
-rw-r--r-- | cpan/CPAN-Meta-YAML/t/tml-local/load-error/document.tml | 6 | ||||
-rw-r--r-- | cpan/CPAN-Meta-YAML/t/tml-local/load-warning/document.tml | 5 |
8 files changed, 55 insertions, 13 deletions
diff --git a/cpan/CPAN-Meta-YAML/lib/CPAN/Meta/YAML.pm b/cpan/CPAN-Meta-YAML/lib/CPAN/Meta/YAML.pm index 604a6450fa..96ed0caaca 100644 --- a/cpan/CPAN-Meta-YAML/lib/CPAN/Meta/YAML.pm +++ b/cpan/CPAN-Meta-YAML/lib/CPAN/Meta/YAML.pm @@ -1,11 +1,11 @@ use 5.008001; # sane UTF-8 support use strict; use warnings; -package CPAN::Meta::YAML; # git description: v1.65-6-gfa117d1 +package CPAN::Meta::YAML; # git description: v1.66-5-ge09e1ae # XXX-INGY is 5.8.1 too old/broken for utf8? # XXX-XDG Lancaster consensus was that it was sufficient until # proven otherwise -$CPAN::Meta::YAML::VERSION = '0.014'; +$CPAN::Meta::YAML::VERSION = '0.016'; ; # original $VERSION removed by Doppelgaenger ##################################################################### @@ -512,7 +512,7 @@ sub _load_hash { } if ( exists $hash->{$key} ) { - die \"CPAN::Meta::YAML found a duplicate key '$key' in line '$lines->[0]'"; + warn "CPAN::Meta::YAML found a duplicate key '$key' in line '$lines->[0]'"; } # Do we have a value? @@ -878,7 +878,7 @@ CPAN::Meta::YAML - Read and write a subset of YAML for CPAN Meta files =head1 VERSION -version 0.014 +version 0.016 =head1 SYNOPSIS diff --git a/cpan/CPAN-Meta-YAML/t/00-report-prereqs.dd b/cpan/CPAN-Meta-YAML/t/00-report-prereqs.dd index 589a97a190..98d00aac11 100644 --- a/cpan/CPAN-Meta-YAML/t/00-report-prereqs.dd +++ b/cpan/CPAN-Meta-YAML/t/00-report-prereqs.dd @@ -51,7 +51,7 @@ do { my $x = { 'File::Find' => '0', 'File::Spec' => '0', 'File::Spec::Functions' => '0', - 'File::Temp' => '0.18', + 'File::Temp' => '0.19', 'IO::Dir' => '0', 'JSON::PP' => '0', 'Test::More' => '0.99', diff --git a/cpan/CPAN-Meta-YAML/t/12_write.t b/cpan/CPAN-Meta-YAML/t/12_write.t index 4c099e4d27..b4be78a238 100644 --- a/cpan/CPAN-Meta-YAML/t/12_write.t +++ b/cpan/CPAN-Meta-YAML/t/12_write.t @@ -9,7 +9,7 @@ use TestUtils; use CPAN::Meta::YAML; use File::Basename qw/basename/; use File::Spec::Functions 'catfile'; -use File::Temp 0.18; +use File::Temp 0.19; # newdir #--------------------------------------------------------------------------# # Error conditions diff --git a/cpan/CPAN-Meta-YAML/t/21_yamlpm_compat.t b/cpan/CPAN-Meta-YAML/t/21_yamlpm_compat.t index aa587114c3..944ceff745 100644 --- a/cpan/CPAN-Meta-YAML/t/21_yamlpm_compat.t +++ b/cpan/CPAN-Meta-YAML/t/21_yamlpm_compat.t @@ -4,7 +4,7 @@ use lib 't/lib/'; use Test::More 0.99; use TestBridge; use File::Spec::Functions 'catfile'; -use File::Temp 0.18; +use File::Temp 0.19; # newdir #--------------------------------------------------------------------------# # This file test that the YAML.pm compatible Dump/Load/DumpFile/LoadFile diff --git a/cpan/CPAN-Meta-YAML/t/lib/TestBridge.pm b/cpan/CPAN-Meta-YAML/t/lib/TestBridge.pm index addec9a7f8..eb2ebe77d2 100644 --- a/cpan/CPAN-Meta-YAML/t/lib/TestBridge.pm +++ b/cpan/CPAN-Meta-YAML/t/lib/TestBridge.pm @@ -24,6 +24,7 @@ our @EXPORT = qw{ test_perl_to_yaml test_dump_error test_load_error + test_load_warning test_yaml_json test_code_point error_like @@ -38,6 +39,9 @@ my %ERROR = ( E_FEATURE => qr{\QCPAN::Meta::YAML does not support a feature}, E_PLAIN => qr{\QCPAN::Meta::YAML found illegal characters in plain scalar}, E_CLASSIFY => qr{\QCPAN::Meta::YAML failed to classify the line}, +); + +my %WARN = ( E_DUPKEY => qr{\QCPAN::Meta::YAML found a duplicate key}, ); @@ -78,6 +82,9 @@ sub run_testml_file { $code->($file, $blocks); } +# retrieves all the keys in @point from the $block hash, returning them in +# order, along with $block->{Label}. +# returns false if any keys cannot be found sub _testml_has_points { my ($block, @points) = @_; my @values; @@ -251,6 +258,41 @@ sub test_load_error { } #--------------------------------------------------------------------------# +# test_load_warning +# +# two blocks: yaml, warning +# +# Tests that a YAML string results in warning when loaded +# +# The warning must be a key in the %WARN hash in this file +#--------------------------------------------------------------------------# +sub test_load_warning { + my ($block) = @_; + + my ($yaml, $warning, $label) = + _testml_has_points($block, qw(yaml warning)) or return; + + chomp $warning; + my $expected = $WARN{$warning}; + + subtest $label, sub { + # this is not in a sub like warning_like because of the danger of + # matching the regex parameter against something earlier in the stack + my @warnings; + local $SIG{__WARN__} = sub { push @warnings, shift; }; + + my $result = eval { CPAN::Meta::YAML->read_string( $yaml ) }; + + is(scalar(@warnings), 1, 'got exactly one warning'); + like( + $warnings[0], + $expected, + 'Got expected warning', + ) or diag "YAML:\n$yaml\n", 'warning: ', explain(\@warnings); + }; +} + +#--------------------------------------------------------------------------# # test_yaml_json # # two blocks: yaml, json diff --git a/cpan/CPAN-Meta-YAML/t/tml b/cpan/CPAN-Meta-YAML/t/tml index 4ae95e9922..d4e3fe7d0a 100755 --- a/cpan/CPAN-Meta-YAML/t/tml +++ b/cpan/CPAN-Meta-YAML/t/tml @@ -17,6 +17,7 @@ use TestUtils; my %BRIDGE_MAP = ( 'tml-local/dump-error' => \&test_dump_error, 'tml-local/load-error' => \&test_load_error, + 'tml-local/load-warning' => \&test_load_warning, 'tml-local/perl-to-yaml' => \&test_perl_to_yaml, 'tml-local/yaml-roundtrip' => \&test_yaml_roundtrip, 'tml-spec/basic-data.tml' => \&test_yaml_json, diff --git a/cpan/CPAN-Meta-YAML/t/tml-local/load-error/document.tml b/cpan/CPAN-Meta-YAML/t/tml-local/load-error/document.tml index 9e881f4ea1..454c5d0f6e 100644 --- a/cpan/CPAN-Meta-YAML/t/tml-local/load-error/document.tml +++ b/cpan/CPAN-Meta-YAML/t/tml-local/load-error/document.tml @@ -3,9 +3,3 @@ \--- foo a: 1 --- error: E_CLASSIFY - -=== mapping with double key ---- yaml -foo: 1 -foo: 2 ---- error: E_DUPKEY diff --git a/cpan/CPAN-Meta-YAML/t/tml-local/load-warning/document.tml b/cpan/CPAN-Meta-YAML/t/tml-local/load-warning/document.tml new file mode 100644 index 0000000000..482a4900d6 --- /dev/null +++ b/cpan/CPAN-Meta-YAML/t/tml-local/load-warning/document.tml @@ -0,0 +1,5 @@ +=== mapping with double key +--- yaml +foo: 1 +foo: 2 +--- warning: E_DUPKEY |