]> git.vpit.fr Git - perl/modules/Scope-Upper.git/blobdiff - t/07-context_info.t
Update Test::Leaner to f53f8d6
[perl/modules/Scope-Upper.git] / t / 07-context_info.t
index 58ea97b6d579d7c6735178170fa22e73963f0029..657285f7d7f7ac5d717b0e6124635a4acbaf09f3 100644 (file)
@@ -12,7 +12,7 @@ use Config qw<%Config>;
 # change ; and that doesn't fit well with how we're testing things.
 
 use lib 't/lib';
-use Test::Leaner tests => 19 + 6;
+use Test::Leaner tests => 18 + 6;
 
 use Scope::Upper qw<context_info UP HERE CALLER>;
 
@@ -45,8 +45,14 @@ sub expected {
  }
 
  if ($top) {
-  $want   = "$]" < 5.015_001 ? '' : undef;
-  $hints &= ~HINT_BLOCK_SCOPE if $Config{usesitecustomize};
+  $want      = "$]" < 5.015_001 ? '' : undef;
+  $hints    &= ~HINT_BLOCK_SCOPE if $Config{usesitecustomize};
+  $hints    |=  HINT_BLOCK_SCOPE if "$]" >= 5.019003;
+  $warnings  = sub { use warnings; (caller 0)[9] }->() if  "$]" < 5.007
+                                                       and not $^W;
+ }
+ if (defined $warnings and $warnings =~ m/^\x55*$/) {
+     $warnings = $warnings::Bits{all};
  }
 
  my @exp = (
@@ -77,7 +83,6 @@ sub setup () {
 
 is_deeply [ context_info       ], $exp0, 'main : context_info';
 is_deeply [ context_info(HERE) ], $exp0, 'main : context_info HERE';
-is_deeply [ context_info(UP)   ], $exp0, 'main : context_info UP';
 is_deeply [ context_info(-1)   ], $exp0, 'main : context_info -1';
 
 package Scope::Upper::TestPkg::A; BEGIN { ::setup }
@@ -154,6 +159,9 @@ sub call {
   my @got = context_info(CALLER $depth);
   my @exp = caller $depth;
   defined and not $_ and $_ = '' for $exp[5];
+  if (defined $exp[9] and $exp[9] =~ m/^\x55*$/) {
+     $exp[9] = $warnings::Bits{all};
+  }
   is_deeply \@got, \@exp, "context_info vs caller $depth";
  }
 }