You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is the smallest test case I was able to come up with:
package foo;
sub func {
my $false_positive = 'anything';
return $false_positive =~ tr/,/,/;
}
1;
And this is how it triggers a false positive:
$ TEST_VERBOSE=1 perl -I. -MTest::Vars -E 'vars_ok(shift)' foo.pm
not ok 1 - foo.pm
# Failed test 'foo.pm'
# at -e line 1.
# checking foo in foo.pm ...
# $false_positive is used once in &foo::func at foo.pm line 4
# Tests were run but no plan was declared and done_testing() was not seen.
Shouldn't $false_positive =~ tr/,/,/ count as the variable being used?
The text was updated successfully, but these errors were encountered:
It tests if there are unused variables.
It found a few of them which were fixed.
The $decoration variable, in PrepareLog.pm, wasn't really unused, but
the tests warned as if it were. I opened a issue on the Test::Vars
module [0] reporting a possible false positive. I changed the code to
avoid this problem. Fortunately, the result is shorter and simpler
than before.
Ref: houseabsolute/p5-Test-Vars#36
This is the smallest test case I was able to come up with:
And this is how it triggers a false positive:
Shouldn't
$false_positive =~ tr/,/,/
count as the variable being used?The text was updated successfully, but these errors were encountered: