package foo;
my $scalar;
my %hash;
my @array;
sub foo {
my $foo_scalar;
my %foo_hash;
my @foo_array;
my @foo9;
}
1;
and here's my foo.t
#!/usr/bin/perl
use warnings;
use strict;
use 5.010;
use experimental 'signatures';
use Test::More tests => 1;
use Test::Vars;
vars_ok( 'lib/foo.pm' );
exit 0;
And when I run it, I get three errors, not four.
$ prove foo.t
[11:15:13] foo.t .. 1/1
# Failed test 'lib/foo.pm'
# at foo.t line 13.
# $foo_scalar is used once in &foo::foo at lib/foo.pm line 8
# %foo_hash is used once in &foo::foo at lib/foo.pm line 8
# @foo_array is used once in &foo::foo at lib/foo.pm line 10
# Looks like you failed 1 test of 1.
[11:15:13] foo.t .. Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/1 subtests
[11:15:13]
Test Summary Report
-------------------
foo.t (Wstat: 256 Tests: 1 Failed: 1)
Failed test: 1
Non-zero exit status: 1
Files=1, Tests=1, 0 wallclock secs ( 0.02 usr 0.01 sys + 0.06 cusr 0.01 csys = 0.10 CPU)
Result: FAIL
If I change foo.pm to only have my $foo_scalar; in the sub, the test passes.
Here's my lib/foo.pm
and here's my foo.t
And when I run it, I get three errors, not four.
If I change foo.pm to only have
my $foo_scalar;
in the sub, the test passes.