In perl.git, the branch ap/baseincguard-old has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/02210d932382bb8b215cd476c6229ed7e4ee7333?hp=ea93ae05d739d4297823c395d53fd8e650ff6dcc>

  discards  ea93ae05d739d4297823c395d53fd8e650ff6dcc (commit)
  discards  5dcc8aa65bd983e00492472fc5a2f3c606e72bb0 (commit)
- Log -----------------------------------------------------------------
commit 02210d932382bb8b215cd476c6229ed7e4ee7333
Author: Aristotle Pagaltzis <[email protected]>
Date:   Thu Oct 20 17:05:45 2016 +0200

    base: only hide $INC[-1] . from optional loads

M       dist/base/lib/base.pm
M       dist/base/t/incdot.t
M       dist/base/t/lib/BaseIncChecker.pm
M       dist/base/t/lib/BaseIncDoubleExtender.pm
M       dist/base/t/lib/BaseIncExtender.pm

commit 964dac3ec406cbd2ce12761db7742cf93ca105ff
Author: Aristotle Pagaltzis <[email protected]>
Date:   Sat Oct 29 02:53:53 2016 +0200

    base: make t/incdot.t failures more readable

M       dist/base/t/incdot.t

commit 5801a20c693f0771ebaaa252dd61cfc97c43f42a
Author: Aristotle Pagaltzis <[email protected]>
Date:   Sat Oct 29 03:42:37 2016 +0200

    base: test that @INC gets the dummy hook

M       dist/base/t/incdot.t
M       dist/base/t/lib/BaseIncChecker.pm
M       dist/base/t/lib/BaseIncDoubleExtender.pm
M       dist/base/t/lib/BaseIncExtender.pm
-----------------------------------------------------------------------

Summary of changes:
 dist/base/lib/base.pm                    | 4 ++--
 dist/base/t/incdot.t                     | 5 ++---
 dist/base/t/lib/BaseIncChecker.pm        | 5 ++++-
 dist/base/t/lib/BaseIncDoubleExtender.pm | 5 ++++-
 dist/base/t/lib/BaseIncExtender.pm       | 5 ++++-
 5 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/dist/base/lib/base.pm b/dist/base/lib/base.pm
index fa71800..0a6d282 100644
--- a/dist/base/lib/base.pm
+++ b/dist/base/lib/base.pm
@@ -8,8 +8,8 @@ $VERSION =~ tr/_//d;
 
 # simplest way to avoid indexing of the package: no package statement
 sub base::__inc_scope_guard::DESTROY {
-       my $noop = $_[0][0];
-       ref $_ and $_ == $noop and $_ = '.' for @INC;
+    my $hook = $_[0][0];
+    ref eq 'CODE' and $_ == $hook and $_ = '.' for @INC;
 }
 
 # constant.pm is slow
diff --git a/dist/base/t/incdot.t b/dist/base/t/incdot.t
index d58039f..df98f72 100644
--- a/dist/base/t/incdot.t
+++ b/dist/base/t/incdot.t
@@ -1,7 +1,7 @@
 #!/usr/bin/perl -w
 
 use strict;
-use Test::More tests => 8; # one test is in each BaseInc* itself
+use Test::More tests => 11; # two extra tests in each BaseInc*.pm
 
 sub rendered_comparison {
     my ( $got, $expected ) = @_;
@@ -10,8 +10,7 @@ sub rendered_comparison {
     join "\n", map +( "got  [$_] " . $got->[$_], 'expected'.(' ' x 
length).$expected->[$_] ), 0 .. $#$got;
 }
 
-my $hook;
-use lib 't/lib', $hook = sub {()};
+use lib 't/lib', sub {()};
 
 # make it look like an older perl
 BEGIN { push @INC, '.' if $INC[-1] ne '.' }
diff --git a/dist/base/t/lib/BaseIncChecker.pm 
b/dist/base/t/lib/BaseIncChecker.pm
index 2cbbbcc..82520ca 100644
--- a/dist/base/t/lib/BaseIncChecker.pm
+++ b/dist/base/t/lib/BaseIncChecker.pm
@@ -1,5 +1,8 @@
 package BaseIncChecker;
 
-BEGIN { ::ok( $INC[-1] eq '.', 'trailing dot remains in @INC during mandatory 
module load from base' ) }
+BEGIN {
+    ::is $INC[-1], '.', 'trailing dot remains in @INC during mandatory module 
load from base';
+    ::is 0+(grep ref eq 'CODE', @INC), 1, '... and no dummy hook is present';
+}
 
 1;
diff --git a/dist/base/t/lib/BaseIncDoubleExtender.pm 
b/dist/base/t/lib/BaseIncDoubleExtender.pm
index 86d88c3..fba4820 100644
--- a/dist/base/t/lib/BaseIncDoubleExtender.pm
+++ b/dist/base/t/lib/BaseIncDoubleExtender.pm
@@ -1,6 +1,9 @@
 package BaseIncDoubleExtender;
 
-BEGIN { ::ok( $INC[-1] ne '.', 'no trailing dot in @INC during optional module 
load from base' ) }
+BEGIN {
+    ::isnt $INC[-1], '.', 'no trailing dot in @INC during optional module load 
from base';
+    ::is 0+(grep ref eq 'CODE', @INC), 2, '... but the expected dummy hook';
+}
 
 use lib 't/lib/blahdeblah';
 
diff --git a/dist/base/t/lib/BaseIncExtender.pm 
b/dist/base/t/lib/BaseIncExtender.pm
index 2e4e97b..f0b1912 100644
--- a/dist/base/t/lib/BaseIncExtender.pm
+++ b/dist/base/t/lib/BaseIncExtender.pm
@@ -1,6 +1,9 @@
 package BaseIncExtender;
 
-BEGIN { ::ok( $INC[-1] ne '.', 'no trailing dot in @INC during optional module 
load from base' ) }
+BEGIN {
+    ::isnt $INC[-1], '.', 'no trailing dot in @INC during optional module load 
from base';
+    ::is 0+(grep ref eq 'CODE', @INC), 2, '... but the expected dummy hook';
+}
 
 use lib 't/lib/blahblah';
 

--
Perl5 Master Repository

Reply via email to