]> git.vpit.fr Git - perl/modules/Scope-Upper.git/blobdiff - t/13-reap-ctl.t
fixup t/13-reap-ctl.t for 5.23.8
[perl/modules/Scope-Upper.git] / t / 13-reap-ctl.t
index 39a0bb4e3f74162cb1cae2079031cd6e70125457..085cc050baacdca23e8643b9ab15866916363716 100644 (file)
@@ -5,7 +5,7 @@ use warnings;
 
 use Test::More tests => 41 + 30 + 4 * 7;
 
-use Scope::Upper qw/reap UP HERE/;
+use Scope::Upper qw<reap UP HERE>;
 
 our ($x, $y);
 
@@ -137,9 +137,15 @@ $y = undef;
 
 SKIP:
 {
- skip 'Perl 5.10 required to test given/when' => 30 if $] < 5.010;
+ skip 'Perl 5.10 required to test given/when' => 30 if "$]" < 5.010;
 
  eval <<' GIVEN_TEST_1';
+  BEGIN {
+   if ("$]" >= 5.017_011) {
+    require warnings;
+    warnings->unimport('experimental::smartmatch');
+   }
+  }
   use feature 'switch';
   local $y;
   {
@@ -161,6 +167,12 @@ SKIP:
  fail $@ if $@;
 
  eval <<' GIVEN_TEST_2';
+  BEGIN {
+   if ("$]" >= 5.017_011) {
+    require warnings;
+    warnings->unimport('experimental::smartmatch');
+   }
+  }
   use feature 'switch';
   local $y;
   {
@@ -184,6 +196,12 @@ SKIP:
  fail $@ if $@;
 
  eval <<' GIVEN_TEST_3';
+  BEGIN {
+   if ("$]" >= 5.017_011) {
+    require warnings;
+    warnings->unimport('experimental::smartmatch');
+   }
+  }
   use feature 'switch';
   local $y;
   {
@@ -205,6 +223,12 @@ SKIP:
  fail $@ if $@;
 
  eval <<' GIVEN_TEST_4';
+  BEGIN {
+   if ("$]" >= 5.017_011) {
+    require warnings;
+    warnings->unimport('experimental::smartmatch');
+   }
+  }
   use feature 'switch';
   local $y;
   {
@@ -228,6 +252,12 @@ SKIP:
  fail $@ if $@;
 
  eval <<' GIVEN_TEST_5';
+  BEGIN {
+   if ("$]" >= 5.017_011) {
+    require warnings;
+    warnings->unimport('experimental::smartmatch');
+   }
+  }
   use feature 'switch';
   local $y;
   {
@@ -272,10 +302,12 @@ $y = undef;
    reap { ++$y; die "reaped\n" } => HERE;
    is $x, 3,     'die in reap at eval [not yet - x]';
    is $y, undef, 'die in reap at eval [not yet - y]';
-  }; # should trigger here, but the die isn't catched by this eval
-  die "failed\n";
+  }; # should trigger here, but the die isn't catched by this eval in
+     # ealier perls
+  die "inner\n";
  };
- is $@, "reaped\n", 'die in reap at eval [ok - $@]';
+ is $@, ($] >= 5.023008 ? "inner\n" : "reaped\n"),
+        'die in reap at eval [ok - $@]';
  is $x, 1, 'die in reap at eval [ok - x]';
  is $y, 1, 'die in reap at eval [ok - y]';
 }