From 3a053d79b19104089d22da85ba1d69aadd6df42e Mon Sep 17 00:00:00 2001 From: Thomas Sibley Date: Sun, 18 Jan 2015 14:27:26 -0800 Subject: [PATCH] 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. --- Makefile.PL | 1 + t/07_token.t | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Makefile.PL b/Makefile.PL index cc67f657..44efe1f5 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -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'; diff --git a/t/07_token.t b/t/07_token.t index 6cd8b9ae..2ef20dea 100644 --- a/t/07_token.t +++ b/t/07_token.t @@ -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; @@ -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 {