Blame SOURCES/B-Lint-1.20-Skip-a-bare-sub-test.patch

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