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