Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Devel-Cover CPAN distribution.

Report information
The Basics
Id: 27526
Status: resolved
Priority: 0/
Queue: Devel-Cover

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

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



Subject: "Bizarre Copy of Hash" error
The following test passes on Perl 5.8.7 (note the strange attempt to take a hash slice on the last line): #!/usr/bin/perl use warnings; use strict; use Test::More 'no_plan'; ok $_ = {}, 'assign empty hashref'; ok ! @{%$_}{qw/ accounts /}, '... and it should have no data'; However, when run withe Devel::Cover: HARNESS_PERL_SWITCHES=-MDevel::Cover prove -lr t/cover.t t/cover....ok 1/0Bizarre copy of HASH in leave at t/cover.t line 8. # Looks like your test died just after 1. t/cover....dubious Test returned status 255 (wstat 65280, 0xff00) after all the subtests completed successfully Failed Test Stat Wstat Total Fail List of Failed ------------------------------------------------------------------------------- t/cover.t 255 65280 1 0 ?? Failed 1/1 test scripts. 0/1 subtests failed. Files=1, Tests=1, 1 wallclock secs ( 1.48 cusr + 0.37 csys = 1.85 CPU) Failed 1/1 test programs. 0/1 subtests failed. Cheers, Ovid
On Mon Jun 11 04:27:47 2007, OVID wrote: Show quoted text
> The following test passes on Perl 5.8.7 (note the strange attempt to > take a hash slice on the last line): > > #!/usr/bin/perl > > use warnings; > use strict; > > use Test::More 'no_plan'; > ok $_ = {}, 'assign empty hashref'; > ok ! @{%$_}{qw/ accounts /}, '... and it should have no data'; > > However, when run withe Devel::Cover: > > HARNESS_PERL_SWITCHES=-MDevel::Cover prove -lr t/cover.t > t/cover....ok 1/0Bizarre copy of HASH in leave at t/cover.t line 8. > > # Looks like your test died just after 1. > t/cover....dubious >
Sounds like a problem I had a couple of years back and reported on comp.lang.perl.modules: http://tinyurl.com/37pvwc This usually happens when you try to do something dodgy. See attached file, ovid_reply.t. Note what I get when I remove all the test-related code from the questionable statement and run it: [develcover] 515 $ prove -v ovid_reply.t ovid_reply....Useless use of hash slice in void context at ovid_reply.t line 13. ok 1 - assign empty hashref ok 2 - nothing in the hashref 1..2 ok All tests successful. Files=1, Tests=2, 0 wallclock secs ( 0.05 cusr + 0.02 csys = 0.07 CPU) Perhaps if you cleared up that warning before testing the statement Devel::Cover wouldn't barf. Jim Keenan
#!/usr/bin/perl use warnings; use strict; use Test::More 'no_plan'; my $href; ok($href = {}, 'assign empty hashref'); ok(! scalar keys %$href, 'nothing in the hashref'); # ok ! @{%$href}{qw/ accounts /}, '... and it should have no data'; @{%$href}{qw/ accounts /};
I think this ticket can be closed. The code originally submitted now (Perl 5.16.0; prove from TAP::Harness v3.23) gets a clear run-time error, so any Devel-Cover-related problem is beside the point. ##### $ cat 27526_ovid_original.t use warnings; use strict; use Test::More 'no_plan'; ok $_ = {}, 'assign empty hashref'; ok ! @{%$_}{qw/ accounts /}, '... and it should have no data'; $ prove -v 27526_ovid_original.t 27526_ovid_original.t .. ok 1 - assign empty hashref 1..1 Can't use string ("0") as a HASH ref while "strict refs" in use at 27526_ovid_original.t line 5. # Looks like your test exited with 255 just after 1. Dubious, test returned 255 (wstat 65280, 0xff00) All 1 subtests passed Test Summary Report ------------------- 27526_ovid_original.t (Wstat: 65280 Tests: 1 Failed: 0) Non-zero exit status: 255 Files=1, Tests=1, 0 wallclock secs ( 0.12 usr 0.03 sys + 0.08 cusr 0.03 csys = 0.26 CPU) Result: FAIL ##### Thank you very much. Jim Keenan
Closing as suggested by Jim. Thanks all,