Skip to content

Commit

Permalink
Catch "Misplaced _ in number" warnings from 5.6
Browse files Browse the repository at this point in the history
If a Test::Warn dep isn't acceptable, the offending tests could be
skipped on 5.6 instead.
  • Loading branch information
tsibley authored and wchristian committed Dec 6, 2016
1 parent b9023e7 commit 3a053d7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions Makefile.PL
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ requires 'Storable' => '2.17';
test_requires 'Class::Inspector' => '1.22';
test_requires 'File::Remove' => '1.42';
test_requires 'Test::More' => '0.86';
test_requires 'Test::Warn' => '0.30';
test_requires 'Test::Object' => '0.07';
test_requires 'Test::SubCalls' => '1.07';
test_requires 'Test::Deep';
Expand Down
10 changes: 8 additions & 2 deletions t/07_token.t
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use lib 't/lib';
use PPI::Test::pragmas;
use Test::More tests => 570 + ($ENV{AUTHOR_TESTING} ? 1 : 0);
use Test::More tests => ($] >= 5.006 and $] < 5.008 ? 570 : 568) + ($ENV{AUTHOR_TESTING} ? 1 : 0);

use File::Spec::Functions ':ALL';
use PPI;
Expand Down Expand Up @@ -100,7 +100,13 @@ SCOPE: {

if ($base != 256) {
$^W = 0;
my $literal = eval $code;
my $literal;
if ( $] >= 5.006 and $] < 5.008 and $code =~ /^1_0[.]?$/ ) {
warning_is { $literal = eval $code } "Misplaced _ in number",
"$] warns about misplaced underscore";
} else {
$literal = eval $code;
}
if ($@) {
is($token->literal, undef, "literal('$code'), $@");
} else {
Expand Down

0 comments on commit 3a053d7

Please sign in to comment.