diff --git a/.github/workflows/dzil-build-and-test.yml b/.github/workflows/dzil-build-and-test.yml index 1ffdc67..8c04a6b 100644 --- a/.github/workflows/dzil-build-and-test.yml +++ b/.github/workflows/dzil-build-and-test.yml @@ -64,6 +64,7 @@ jobs: - "5.34" - "5.36" - "5.38" + - "5.40" name: perl ${{ matrix.perl-version }} on ${{ matrix.os }} steps: - name: set up perl @@ -104,6 +105,7 @@ jobs: - "5.34" - "5.36" - "5.38" + - "5.40" name: perl ${{ matrix.perl-version }} on ${{ matrix.os }} steps: - name: set up perl @@ -143,6 +145,7 @@ jobs: - "5.32" - "5.36" - "5.38" + - "5.40" name: perl ${{ matrix.perl-version }} on ${{ matrix.os }} steps: - name: set up perl diff --git a/cpanfile b/cpanfile index 405e326..45609dc 100644 --- a/cpanfile +++ b/cpanfile @@ -6,7 +6,7 @@ requires "Moo" => "0"; requires "PPI::Document" => "0"; requires "Path::Tiny" => "0"; requires "Pod::Usage" => "0"; -requires "Test::Vars" => "0"; +requires "Test::Vars" => "0.017"; requires "autodie" => "0"; requires "perl" => "v5.14.0"; requires "strict" => "0"; diff --git a/t/app-perlvars.t b/t/app-perlvars.t index 121c6a7..12bc29c 100644 --- a/t/app-perlvars.t +++ b/t/app-perlvars.t @@ -6,33 +6,19 @@ use lib 'test-data/lib'; use App::perlvars (); use Test::More import => [qw( done_testing is ok subtest )]; -# For perl version 5.37.3 there was a change in the Perl internals such that -# some variables are no longer considered unused by Test::Vars. This is a known issue, see -# https://github.com/houseabsolute/p5-Test-Vars/issues/47 -# Until this is resolved, we need to adjust the expected number of errors depending on -# the Perl version. -my $perl_old = $] <= 5.037002; - subtest 'pkg with unused vars' => sub { my ( $exit_code, $msg, @errors ) = App::perlvars->new->validate_file('test-data/lib/Local/Unused.pm'); ok( $exit_code, 'non-zero exit code' ); - my $expected = $perl_old ? 4 : 5; - is( scalar @errors, $expected, 'found all errors' ); + is( scalar @errors, 4, 'found all errors' ); }; subtest 'pkg without unused vars' => sub { my ( $exit_code, $msg, @errors ) = App::perlvars->new->validate_file( 'test-data/lib/Local/NoUnused.pm'); - if ($perl_old) { - is( $exit_code, 0, '0 exit code' ); - is( scalar @errors, 0, 'found no errors' ); - } - else { - is( $exit_code, 256, 'exit code 256' ); - is( scalar @errors, 1, 'found 1 error' ); - } + is( $exit_code, 0, '0 exit code' ); + is( scalar @errors, 0, 'found no errors' ); }; subtest 'file not found' => sub { diff --git a/t/perlvars.t b/t/perlvars.t index 6192274..e25fb78 100644 --- a/t/perlvars.t +++ b/t/perlvars.t @@ -11,13 +11,6 @@ use Test::Script qw( script_stderr_like ); -# For perl version 5.37.3 there was a change in the Perl internals such that -# some variables are no longer considered unused by Test::Vars. This is a known issue, see -# https://github.com/houseabsolute/p5-Test-Vars/issues/47 -# Until this is resolved, we need to adjust the expected number of errors depending on -# the Perl version. -my $perl_old = $] <= 5.037002; - script_compiles('script/perlvars'); subtest 'file not found' => sub { @@ -46,40 +39,30 @@ subtest 'arg is a dir' => sub { }; subtest 'ignore file is used' => sub { - my @script = ( - 'script/perlvars', '--ignore-file', - 'test-data/ignore-file', 'test-data/lib/Local/Unused.pm', + script_runs( + [ + 'script/perlvars', + '--ignore-file', 'test-data/ignore-file', + 'test-data/lib/Local/Unused.pm' + ] ); - if ($perl_old) { - script_runs( \@script ); - } - else { - script_fails( \@script, { exit => 255 } ); - } }; subtest 'file has no errors' => sub { - my @script = ( 'script/perlvars', 'test-data/lib/Local/NoUnused.pm', ); - if ($perl_old) { - script_runs( \@script ); - } - else { - script_fails( \@script, { exit => 255 } ); - } + script_runs( + [ 'script/perlvars', 'test-data/lib/Local/NoUnused.pm' ], + ); }; subtest 'multiple files are checked' => sub { - my @script = ( - 'script/perlvars', '--ignore-file', - 'test-data/ignore-file', 'test-data/lib/Local/Unused.pm', - 'test-data/lib/Local/NoUnused.pm', + script_runs( + [ + 'script/perlvars', + '--ignore-file', 'test-data/ignore-file', + 'test-data/lib/Local/Unused.pm', + 'test-data/lib/Local/NoUnused.pm', + ] ); - if ($perl_old) { - script_runs( \@script ); - } - else { - script_fails( \@script, { exit => 255 } ); - } }; done_testing();