Skip Menu |

This queue is for tickets about the YAML-Tiny CPAN distribution.

Report information
The Basics
Id: 55385
Status: resolved
Priority: 0/
Queue: YAML-Tiny

People
Owner: Nobody in particular
Requestors: TODDR [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.41
Fixed in: (no value)



Subject: Tests should test against YAML not YAML::Perl
while testing quoted hash keys, I discovered YAML::Perl does not support Dump if a key has new lines. YAML does. I suggest switching to YAML to fix this. it would be more commonly present on a system anyways.
patch is available on github: http://github.com/toddr/YAML- Tiny/commit/89c363cfcd88471070b8ead180dbea4488571867.diff also attached.
Subject: YAMLPerl.txt
--- a/t/lib/Test.pm +++ b/t/lib/Test.pm @@ -29,14 +29,14 @@ ); sub have_yamlpm { $HAVE_YAMLPM } -# Do we have YAML::Perl to test against? +# Do we have YAML to test against? eval { - require YAML::Perl; + require YAML; }; my $HAVE_YAMLPERL = !! ( - $YAML::Perl::VERSION + $YAML::VERSION and - $YAML::Perl::VERSION >= 0.02 + $YAML::VERSION >= 0.02 ); sub have_yamlperl { $HAVE_YAMLPERL } @@ -109,7 +109,7 @@ Test::More::is( $@, '', "$name: YAML.pm round-trips without error" ); Test::More::skip( "Shortcutting after failure", 2 ) if $@; my $round = bless [ @yamlpm_round ], 'YAML::Tiny'; - Test::More::is_deeply( $round, $object, "$name: YAML.pm round-trips correctly" ); + Test::More::is_deeply( $round, $object, "$name: YAML.pm round-trips correctly" ); } # Test reading with YAML.pm @@ -198,39 +198,39 @@ } } - # If YAML::Perl is available, test with it + # If YAML is available, test with it SKIP: { unless ( $HAVE_YAMLPERL ) { - Test::More::skip( "Skipping YAML::Perl, not available for testing", 7 ); + Test::More::skip( "Skipping YAML, not available for testing", 7 ); } if ( $options{noyamlperl} ) { - Test::More::skip( "Skipping YAML::Perl for known-broken feature", 7 ); + Test::More::skip( "Skipping YAML for known-broken feature", 7 ); } # Test writing with YAML.pm - my $yamlperl_out = eval { YAML::Perl::Dump( @$object ) }; - Test::More::is( $@, '', "$name: YAML::Perl saves without error" ); + my $yamlperl_out = eval { YAML::Dump( @$object ) }; + Test::More::is( $@, '', "$name: YAML saves without error" ); SKIP: { Test::More::skip( "Shortcutting after failure", 4 ) if $@; Test::More::ok( !!(defined $yamlperl_out and ! ref $yamlperl_out), - "$name: YAML::Perl serializes correctly", + "$name: YAML serializes correctly", ); - my @yamlperl_round = eval { YAML::Perl::Load( $yamlperl_out ) }; - Test::More::is( $@, '', "$name: YAML::Perl round-trips without error" ); + my @yamlperl_round = eval { YAML::Load( $yamlperl_out ) }; + Test::More::is( $@, '', "$name: YAML round-trips without error" ); Test::More::skip( "Shortcutting after failure", 2 ) if $@; my $round = bless [ @yamlperl_round ], 'YAML::Tiny'; - Test::More::is_deeply( $round, $object, "$name: YAML::Perl round-trips correctly" ); + Test::More::is_deeply( $round, $object, "$name: YAML round-trips correctly" ); } - # Test reading with YAML::Perl + # Test reading with YAML my $yamlperl_copy = $string; my @yamlperl_in = eval { YAML::Load( $yamlperl_copy ) }; - Test::More::is( $@, '', "$name: YAML::Perl loads without error" ); - Test::More::is( $yamlperl_copy, $string, "$name: YAML::Perl does not modify the input string" ); + Test::More::is( $@, '', "$name: YAML loads without error" ); + Test::More::is( $yamlperl_copy, $string, "$name: YAML does not modify the input string" ); SKIP: { Test::More::skip( "Shortcutting after failure", 1 ) if $@; - Test::More::is_deeply( \@yamlperl_in, $object, "$name: YAML::Perl parses correctly" ); + Test::More::is_deeply( \@yamlperl_in, $object, "$name: YAML parses correctly" ); } }
Subject: Re: [rt.cpan.org #55385] Tests should test against YAML not YAML::Perl
Date: Wed, 10 Mar 2010 14:09:20 +1100
To: bug-YAML-Tiny [...] rt.cpan.org
From: Adam Kennedy <adamkennedybackup [...] gmail.com>
It's the policy of YAML::Tiny to test against ALL installed YAML parsers. So rather than change, we should add. It did used to use YAML, if it's been dropped I'm not sure why. Adam K On 10 March 2010 08:22, Todd Rinaldo via RT <bug-YAML-Tiny@rt.cpan.org> wrote: Show quoted text
>       Queue: YAML-Tiny >  Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=55385 > > > patch is available on github: > http://github.com/toddr/YAML- > Tiny/commit/89c363cfcd88471070b8ead180dbea4488571867.diff > > also attached. > > > > --- a/t/lib/Test.pm > +++ b/t/lib/Test.pm > @@ -29,14 +29,14 @@ >  ); >  sub have_yamlpm { $HAVE_YAMLPM } > > -# Do we have YAML::Perl to test against? > +# Do we have YAML to test against? >  eval { > -       require YAML::Perl; > +       require YAML; >  }; >  my $HAVE_YAMLPERL = !! ( > -       $YAML::Perl::VERSION > +       $YAML::VERSION >        and > -       $YAML::Perl::VERSION >= 0.02 > +       $YAML::VERSION >= 0.02 >  ); >  sub have_yamlperl { $HAVE_YAMLPERL } > > @@ -109,7 +109,7 @@ >                        Test::More::is( $@, '', "$name: YAML.pm round-trips without error" ); >                        Test::More::skip( "Shortcutting after failure", 2 ) if $@; >                        my $round = bless [ @yamlpm_round ], 'YAML::Tiny'; > -                       Test::More::is_deeply( $round, $object, "$name: YAML.pm round-trips correctly" ); > +                       Test::More::is_deeply( $round, $object, "$name: YAML.pm round-trips correctly" ); >                } > >                # Test reading with YAML.pm > > > > > > > > > > @@ -198,39 +198,39 @@ >                } >        } > > -       # If YAML::Perl is available, test with it > +       # If YAML is available, test with it >        SKIP: { >                unless ( $HAVE_YAMLPERL ) { > -                       Test::More::skip( "Skipping YAML::Perl, not available for testing", 7 ); > +                       Test::More::skip( "Skipping YAML, not available for testing", 7 ); >                } >                if ( $options{noyamlperl} ) { > -                       Test::More::skip( "Skipping YAML::Perl for known-broken feature", 7 ); > +                       Test::More::skip( "Skipping YAML for known-broken feature", 7 ); >                } > >                # Test writing with YAML.pm > -               my $yamlperl_out = eval { YAML::Perl::Dump( @$object ) }; > -               Test::More::is( $@, '', "$name: YAML::Perl saves without error" ); > +               my $yamlperl_out = eval { YAML::Dump( @$object ) }; > +               Test::More::is( $@, '', "$name: YAML saves without error" ); >                SKIP: { >                        Test::More::skip( "Shortcutting after failure", 4 ) if $@; >                        Test::More::ok( >                                !!(defined $yamlperl_out and ! ref $yamlperl_out), > -                               "$name: YAML::Perl serializes correctly", > +                               "$name: YAML serializes correctly", >                        ); > -                       my @yamlperl_round = eval { YAML::Perl::Load( $yamlperl_out ) }; > -                       Test::More::is( $@, '', "$name: YAML::Perl round-trips without error" ); > +                       my @yamlperl_round = eval { YAML::Load( $yamlperl_out ) }; > +                       Test::More::is( $@, '', "$name: YAML round-trips without error" ); >                        Test::More::skip( "Shortcutting after failure", 2 ) if $@; >                        my $round = bless [ @yamlperl_round ], 'YAML::Tiny'; > -                       Test::More::is_deeply( $round, $object, "$name: YAML::Perl round-trips correctly" ); > +                       Test::More::is_deeply( $round, $object, "$name: YAML round-trips correctly" ); >                } > > -               # Test reading with YAML::Perl > +               # Test reading with YAML >                my $yamlperl_copy = $string; >                my @yamlperl_in   = eval { YAML::Load( $yamlperl_copy ) }; > -               Test::More::is( $@, '', "$name: YAML::Perl loads without error" ); > -               Test::More::is( $yamlperl_copy, $string, "$name: YAML::Perl does not modify the input string" ); > +               Test::More::is( $@, '', "$name: YAML loads without error" ); > +               Test::More::is( $yamlperl_copy, $string, "$name: YAML does not modify the input string" ); >                SKIP: { >                        Test::More::skip( "Shortcutting after failure", 1 ) if $@; > -                       Test::More::is_deeply( \@yamlperl_in, $object, "$name: YAML::Perl parses correctly" ); > +                       Test::More::is_deeply( \@yamlperl_in, $object, "$name: YAML parses correctly" ); >                } >        } > >
RT-Send-CC: adamkennedybackup [...] gmail.com
On Tue Mar 09 22:10:18 2010, adam@ali.as wrote: Show quoted text
> It's the policy of YAML::Tiny to test against ALL installed YAML > parsers. > > So rather than change, we should add. It did used to use YAML, if it's > been dropped I'm not sure why. >
The problem here is that YAML and YAML::Perl do not always produce the same YAML. So if you were to test against both, there would have to be a way to flag yaml_ok which round trip you expected to behave as expected and which one you expected to be a skip or todo. The tests introduced in RT 54790 for quoted keys show how this would be a problem since YAML supports it and YAML::Perl does not.
The tests against other YAML parsers have been moved to xt to ensure they don't interfere with end user installation. They will be run by developers to check compatibility. Therefore, I'm closing this ticket.