|
|
8192a3 |
From d350b6338066d2563b4abacf1eb7da56c5264b22 Mon Sep 17 00:00:00 2001
|
|
|
8192a3 |
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
|
|
|
8192a3 |
Date: Fri, 12 Jun 2015 13:27:07 +0200
|
|
|
8192a3 |
Subject: [PATCH] Skip a bare-sub test
|
|
|
8192a3 |
MIME-Version: 1.0
|
|
|
8192a3 |
Content-Type: text/plain; charset=UTF-8
|
|
|
8192a3 |
Content-Transfer-Encoding: 8bit
|
|
|
8192a3 |
|
|
|
8192a3 |
Perl 5.22 optimization causes B::Lint not to recognize $a{b} for
|
|
|
8192a3 |
bare-sub check. This patch document this deficency and skips a test
|
|
|
8192a3 |
for it.
|
|
|
8192a3 |
|
|
|
8192a3 |
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
|
|
8192a3 |
---
|
|
|
8192a3 |
lib/B/Lint.pm | 4 ++++
|
|
|
8192a3 |
t/lint.t | 11 +++++++++--
|
|
|
8192a3 |
2 files changed, 13 insertions(+), 2 deletions(-)
|
|
|
8192a3 |
|
|
|
8192a3 |
diff --git a/lib/B/Lint.pm b/lib/B/Lint.pm
|
|
|
8192a3 |
index 1f5098f..7291b18 100644
|
|
|
8192a3 |
--- a/lib/B/Lint.pm
|
|
|
8192a3 |
+++ b/lib/B/Lint.pm
|
|
|
8192a3 |
@@ -85,6 +85,10 @@ trap are:
|
|
|
8192a3 |
|
|
|
8192a3 |
Neither of these will do what a naive user would expect.
|
|
|
8192a3 |
|
|
|
8192a3 |
+Notice: Perl 5.22.0 does not report C<foo> in C<$b{foo}> as BARE token
|
|
|
8192a3 |
+anymore. Therefore L<B::Lint> test is not reliable here. See
|
|
|
8192a3 |
+L<CPAN RT#101115|https://rt.cpan.org/Public/Bug/Display.html?id=101115>.
|
|
|
8192a3 |
+
|
|
|
8192a3 |
=item B<dollar-underscore>
|
|
|
8192a3 |
|
|
|
8192a3 |
This option warns whenever C<$_> is used either explicitly anywhere or
|
|
|
8192a3 |
diff --git a/t/lint.t b/t/lint.t
|
|
|
8192a3 |
index 7317b1d..93255d9 100644
|
|
|
8192a3 |
--- a/t/lint.t
|
|
|
8192a3 |
+++ b/t/lint.t
|
|
|
8192a3 |
@@ -14,7 +14,7 @@ BEGIN {
|
|
|
8192a3 |
use strict;
|
|
|
8192a3 |
use warnings;
|
|
|
8192a3 |
|
|
|
8192a3 |
-plan tests => 29;
|
|
|
8192a3 |
+plan tests => 30;
|
|
|
8192a3 |
|
|
|
8192a3 |
# Runs a separate perl interpreter with the appropriate lint options
|
|
|
8192a3 |
# turned on
|
|
|
8192a3 |
@@ -116,10 +116,17 @@ RESULT
|
|
|
8192a3 |
|
|
|
8192a3 |
runlint 'bare-subs', 'sub bare(){1};$x=bare', '';
|
|
|
8192a3 |
|
|
|
8192a3 |
-runlint 'bare-subs', 'sub bare(){1}; $x=[bare=>0]; $x=$y{bare}', <<'RESULT';
|
|
|
8192a3 |
+runlint 'bare-subs', 'sub bare(){1}; $x=[bare=>0]', <<'RESULT';
|
|
|
8192a3 |
Bare sub name 'bare' interpreted as string at -e line 1
|
|
|
8192a3 |
+RESULT
|
|
|
8192a3 |
+
|
|
|
8192a3 |
+SKIP: {
|
|
|
8192a3 |
+ skip 'Perl 5.22 stopped marking $hash{bare} as BARE word, CPAN RT#101115',
|
|
|
8192a3 |
+ 1, if $] >= 5.022;
|
|
|
8192a3 |
+ runlint 'bare-subs', 'sub bare(){1}; $x=$y{bare}', <<'RESULT';
|
|
|
8192a3 |
Bare sub name 'bare' interpreted as string at -e line 1
|
|
|
8192a3 |
RESULT
|
|
|
8192a3 |
+}
|
|
|
8192a3 |
|
|
|
8192a3 |
{
|
|
|
8192a3 |
|
|
|
8192a3 |
--
|
|
|
8192a3 |
2.1.0
|
|
|
8192a3 |
|