houseabsolute / p5-Test-Vars

Detects unused variables in unit tests
https://metacpan.org/pod/Test::Vars
Other
6 stars 10 forks source link

0.015: test suite is failing #50

Closed kloczek closed 2 days ago

kloczek commented 1 year ago

perl 5.38.0 and test suite is failing with

+ cd Test-Vars-0.015
+ ./Build test
# Testing Test::Vars/0.015
t/00_load.t .............. ok
t/01_all_vars_ok_self.t .. ok
# Test::Vars ignores CompileError.pm because: Intentional compile error.
# Test::Vars ignores ImplicitTopic.pm because: Can't use global $_ in "my" at t/lib/ImplicitTopic.pm line 6, near "my $_ "
t/02_no_warnings.t ....... ok
t/03_warned.t ............ ok
t/04_ignores.t ........... ok
t/05_test_vars.t ......... ok
t/06_vars_ok_self.t ...... ok

#   Failed test 'got expected output from test_vars'
#   at t/07_stub_sub_bug.t line 25.
#     Structures begin differing at:
#          $got->[0][2][1][1] = '$x is used once in &StubSub::foo '
#     $expected->[0][2][1][1] = '$x is used once in &StubSub::foo at t/lib/StubSub.pm line 13'
# Looks like you failed 1 test of 2.
t/07_stub_sub_bug.t ......
Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/2 subtests
t/08_undef_aux_list.t .... ok
t/09_array_slice.t ....... ok
t/10_my_sub.t ............ ok

Test Summary Report
-------------------
t/07_stub_sub_bug.t    (Wstat: 256 Tests: 2 Failed: 1)
  Failed test:  2
  Non-zero exit status: 1
Files=11, Tests=71,  2 wallclock secs ( 0.09 usr  0.03 sys +  1.14 cusr  0.31 csys =  1.57 CPU)
Result: FAIL

I'm not sure what king of details I should provide to diagnose this issue. Please let me know if you need more details.

kloczek commented 7 months ago

Any update? 🤔

autarch commented 7 months ago

Hi, @kloczek,

I'm not really doing much Perl these days. I don't know if @gfx is either. If you're up for submitting a PR to fix this I can review it.

waterkip commented 6 months ago

It seems to go wrong around here:

sub _make_scan_subs

         my $optype = $op->type;
         return if !defined $padops[ $optype ];

The $padops[$optype] is not defined (the optype is 5). I'm not too familiar with the internal of Perl to say anything useful about the why/what and how in this function.

jkeenan commented 1 week ago

It seems to go wrong around here:

sub _make_scan_subs

         my $optype = $op->type;
         return if !defined $padops[ $optype ];

The $padops[$optype] is not defined (the optype is 5). I'm not too familiar with the internal of Perl to say anything useful about the why/what and how in this function.

This should be alleviated by the release of Test-Vars-0.016, which I hope to make by September 19. If you'd like, you can test out this tarball which contains most of the changes that will go into 0.016.

jkeenan commented 3 days ago

@waterkip, @kloczek, @autarch please try Test-Vars-0.017, released today to CPAN.

waterkip commented 2 days ago

Thanks, it works for me:

$ cpanm Test::Vars
--> Working on Test::Vars
Fetching http://www.cpan.org/authors/id/J/JK/JKEENAN/Test-Vars-0.017.tar.gz ... OK
Configuring Test-Vars-0.017 ... OK
Building and testing Test-Vars-0.017 ... OK
Successfully installed Test-Vars-0.017 (upgraded from 0.015)
1 distribution installed

$ cpanm Test::Vars@0.015
--> Working on Test::Vars
Fetching http://www.cpan.org/authors/id/G/GF/GFUJI/Test-Vars-0.015.tar.gz ... OK
Configuring Test-Vars-0.015 ... OK
Building and testing Test-Vars-0.015 ... FAIL
! Installing Test::Vars failed. See [snip]/build.log for details. Retry with --force to force install it.

t/06_vars_ok_self.t ...... ok

#   Failed test 'got expected output from test_vars'
#   at t/07_stub_sub_bug.t line 25.
#     Structures begin differing at:
#          $got->[0][2][1][1] = '$x is used once in &StubSub::foo '
#     $expected->[0][2][1][1] = '$x is used once in &StubSub::foo at t/lib/StubSub.pm line 13'
# Looks like you failed 1 test of 2.
t/07_stub_sub_bug.t ......
Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/2 subtests
t/08_undef_aux_list.t .... ok