Skip to content

Commit aad3e84

Browse files
tsibleywchristian
authored andcommitted
Catch "Misplaced _ in number" warnings from 5.6
If a Test::Warn dep isn't acceptable, the offending tests could be skipped on 5.6 instead.
1 parent 50d5965 commit aad3e84

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

Makefile.PL

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ requires 'Storable' => '2.17';
4040
test_requires 'Class::Inspector' => '1.22';
4141
test_requires 'File::Remove' => '1.42';
4242
test_requires 'Test::More' => '0.86';
43+
test_requires 'Test::Warn' => '0.30';
4344
test_requires 'Test::Object' => '0.07';
4445
test_requires 'Test::SubCalls' => '1.07';
4546
test_requires 'Test::Deep';

t/07_token.t

+8-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

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

99
use File::Spec::Functions ':ALL';
1010
use PPI;
@@ -100,7 +100,13 @@ SCOPE: {
100100

101101
if ($base != 256) {
102102
$^W = 0;
103-
my $literal = eval $code;
103+
my $literal;
104+
if ( $] >= 5.006 and $] < 5.008 and $code =~ /^1_0[.]?$/ ) {
105+
warning_is { $literal = eval $code } "Misplaced _ in number",
106+
"$] warns about misplaced underscore";
107+
} else {
108+
$literal = eval $code;
109+
}
104110
if ($@) {
105111
is($token->literal, undef, "literal('$code'), $@");
106112
} else {

0 commit comments

Comments
 (0)