Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert PR #12 #18

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/dzil-build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion cpanfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ requires "Moo" => "0";
requires "PPI::Document" => "0";
requires "Path::Tiny" => "0";
requires "Pod::Usage" => "0";
requires "Test::Vars" => "0";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this line is enough. We don't need to set the version in dist.ini and the other changes will be generated by Dist::Zilla as well. I could have been a lot clearer about that. My bad!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem! I have reverted the other changes :)

requires "Test::Vars" => "0.017";
requires "autodie" => "0";
requires "perl" => "v5.14.0";
requires "strict" => "0";
Expand Down
20 changes: 3 additions & 17 deletions t/app-perlvars.t
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
49 changes: 16 additions & 33 deletions t/perlvars.t
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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();