From: Vincent Pit Date: Fri, 21 Sep 2012 14:02:02 +0000 (+0200) Subject: Make t/07-context_info.t pass with perls that have usesitecustomize set X-Git-Tag: v0.21~3 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=d3500bc9b8882716ee933336bb903e20735e54ed;p=perl%2Fmodules%2FScope-Upper.git Make t/07-context_info.t pass with perls that have usesitecustomize set sitecustomize.pl adds a "BEGIN { do { my $x; 1 } }" at the beginning of the test code, which causes HINT_BLOCK_SCOPE to leak to the main program. --- diff --git a/t/07-context_info.t b/t/07-context_info.t index aab24fb..58ea97b 100644 --- a/t/07-context_info.t +++ b/t/07-context_info.t @@ -5,6 +5,8 @@ my $exp0 = ::expected('block', 0, undef); use strict; use warnings; +use Config qw<%Config>; + # We're using Test::Leaner here because Test::More loads overload, which itself # uses warning::register, which may cause the "all warnings on" bitmask to # change ; and that doesn't fit well with how we're testing things. @@ -14,6 +16,8 @@ use Test::Leaner tests => 19 + 6; use Scope::Upper qw; +sub HINT_BLOCK_SCOPE () { 0x100 } + sub expected { my ($type, $line, $want) = @_; @@ -40,7 +44,10 @@ sub expected { $want = '' if defined $want and not $want; } - $want = "$]" < 5.015_001 ? '' : undef if $top; + if ($top) { + $want = "$]" < 5.015_001 ? '' : undef; + $hints &= ~HINT_BLOCK_SCOPE if $Config{usesitecustomize}; + } my @exp = ( $pkg,