Devel--Cover
Devel--Cover copied to clipboard
Devel::Cover changes result of tests with magic variables
perl v5.24.0 on x86_64-linux only with core modules Devel::Cover 26cdb74c13457fcf3bc13f3b568b7028478c3a99
Test file:
use Encode qw(find_encoding);
use Test::More tests => 1;
my $latin1 = find_encoding('latin1');
my $orig = "\N{U+0080}";
$orig =~ /(.)/;
is($latin1->decode($1), $orig); # without this call below Dump problem cannot be reproduced
$orig = "\x80";
$orig =~ /(.)/;
use Devel::Peek;
Dump $1;
Due to bug in Encode this test fails -- it is expected. But when running under Devel::Cover test for some unexpected reason passes. Which is wrong! And so this is bug in Devel::Cover.
Next, output from Dump $1 is different when running test under Devel::Cover and when running without it.
Without Devel::Cover: FLAGS = (GMG,SMG,POK,pPOK,UTF8)
With Devel::Cover: FLAGS = (GMG,SMG)
I believe that Devel::Cover should not modify SV flags on magic variables (like $1). So this is second bug.