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---