Skip Menu |

This queue is for tickets about the Ogg-Vorbis-Header CPAN distribution.

Report information
The Basics
Id: 104869
Status: resolved
Priority: 0/
Queue: Ogg-Vorbis-Header

People
Owner: DAVECROSS [...] cpan.org
Requestors: HMBRAND [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.03
Fixed in: (no value)



Subject: [PATCH] Invalid tests
Too, old. I don't expect anyone to release a new version, but just for the record. I don't know what you were drinking when you wrote that test, but it was fun to analyze why it could have been passing :) ok(@{$ogg->comment("artist")}->[0] == "Dan"); $ogg->comment("artist") is a scalar containing "Dan" that puts @{...} in scalar context so scalar(@Dan) is used as an arrayref so @0 is vivified and its first entry taken, undef because there isn't one and that's numerically compared against "Dan" both zero, so pass --8<--- diff -purd test.pl.org test.pl --- test.pl.org 2015-06-02 15:49:17.716856098 +0200 +++ test.pl 2015-06-02 15:51:40.553271640 +0200 @@ -25,7 +25,7 @@ ok($ogg->load); # Try all the routines ok($ogg->info->{"rate"} == 44100); ok($ogg->comment_tags); -ok(@{$ogg->comment("artist")}->[0] == "Dan"); +ok([$ogg->comment("artist")]->[0] eq "Dan"); ok($ogg->add_comments("moog", "bog")); ok($ogg->edit_comment("moog", "bug")); ok($ogg->delete_comment("artist")); @@ -36,6 +36,6 @@ ok($ogg->clear_comments); # See if full load works ok(my $ogg = Ogg::Vorbis::Header->load("test.ogg.2")); -ok(@{$ogg->comment("moog")}->[0] == "bug"); +ok([$ogg->comment("moog")]->[0] eq "bug"); unlink("test.ogg.2"); -->8---
On 2015-06-02 09:56:21, HMBRAND wrote: Show quoted text
> Too, old. I don't expect anyone to release a new version, but just for > the record. > > I don't know what you were drinking when you wrote that test, but it > was fun to analyze why it could have been passing :) > > ok(@{$ogg->comment("artist")}->[0] == "Dan"); > > $ogg->comment("artist") is a scalar containing "Dan" > that puts @{...} in scalar context > so scalar(@Dan) is used as an arrayref > so @0 is vivified and its first entry taken, undef because there isn't > one > and that's numerically compared against "Dan" > both zero, so pass > > --8<--- diff -purd test.pl.org test.pl > --- test.pl.org 2015-06-02 15:49:17.716856098 +0200 > +++ test.pl 2015-06-02 15:51:40.553271640 +0200 > @@ -25,7 +25,7 @@ ok($ogg->load); > # Try all the routines > ok($ogg->info->{"rate"} == 44100); > ok($ogg->comment_tags); > -ok(@{$ogg->comment("artist")}->[0] == "Dan"); > +ok([$ogg->comment("artist")]->[0] eq "Dan"); > ok($ogg->add_comments("moog", "bog")); > ok($ogg->edit_comment("moog", "bug")); > ok($ogg->delete_comment("artist")); > @@ -36,6 +36,6 @@ ok($ogg->clear_comments); > > # See if full load works > ok(my $ogg = Ogg::Vorbis::Header->load("test.ogg.2")); > -ok(@{$ogg->comment("moog")}->[0] == "bug"); > +ok([$ogg->comment("moog")]->[0] eq "bug"); > > unlink("test.ogg.2"); > -->8---
Since perl 5.21.x this is a hard error: PERL_DL_NONLAZY=1 "/usr/perl5.23.4p/bin/perl5.23.4" "-Iblib/lib" "-Iblib/arch" test.pl 1..13 # Running under perl version 5.023004 for freebsd # Current time local: Thu Nov 12 22:24:26 2015 # Current time GMT: Thu Nov 12 21:24:26 2015 # Using Test.pm version 1.27 Can't use an array as a reference at test.pl line 28. One or more DATA sections were not processed by Inline. *** Error code 255 Stop. make: stopped in /home/cpansand/.cpan/build/2015111221/Ogg-Vorbis-Header-0.03-bIyzcw
I've just released version 0.04 which fixes this problem. Dave...