]> git.vpit.fr Git - perl/modules/Variable-Magic.git/blobdiff - t/35-stash.t
Make t/35-stash.t pass on 5.21.4
[perl/modules/Variable-Magic.git] / t / 35-stash.t
index d8b8168ac6e79e1b8036896dbcd71b242eb4fe2a..9d094ea57d3e2cbbcc3096e89d97675160c2b19c 100644 (file)
@@ -92,11 +92,22 @@ cast %Hlagh::, $wiz;
  };
 
  my @calls = qw<eat shoot leave roam yawn roam>;
+ my (@fetch, @store);
+ if ("$]" < 5.011_002) {
+  @fetch = @calls;
+  @store = @calls;
+ } elsif ("$]" < 5.021_004) {
+  @fetch = @calls;
+  @store = map { ($_) x 2 } @calls;
+ } else {
+  @fetch = map { ($_) x 2 } @calls;
+  @store = @calls;
+ }
 
  is $@, "ok\n", 'stash: function calls compiled fine';
  is_deeply \%mg, {
-  fetch => \@calls,
-  store => ("$]" < 5.011002 ? \@calls : [ map { ($_) x 2 } @calls ]),
+  fetch => \@fetch,
+  store => \@store,
  }, 'stash: function calls';
 }
 
@@ -215,6 +226,10 @@ cast %Hlagh::, $wiz;
 {
  local %mg;
 
+ my @expected_stores = qw<nevermentioned eat shoot>;
+ @expected_stores    = map { ($_) x 2 } @expected_stores if "$]" < 5.017_004;
+ push @expected_stores, 'nevermentioned'                 if "$]" < 5.017_001;
+
  eval q{
   package Hlagh;
   undef &nevermentioned;
@@ -223,11 +238,7 @@ cast %Hlagh::, $wiz;
  };
 
  is $@, '', 'stash: delete executed fine';
- is_deeply \%mg, {
-  store => [
-   qw<nevermentioned nevermentioned eat eat shoot shoot nevermentioned>
-  ],
- }, 'stash: delete';
+ is_deeply \%mg, { store => \@expected_stores }, 'stash: delete';
 }
 
 END {
@@ -296,7 +307,7 @@ $_ => sub {
 CB
 } qw<fetch store exists delete>);
 
-my $uo_exp = "$]" < 5.011002 ? 2 : 3;
+my $uo_exp = "$]" < 5.011_002 ? 2 : 3;
 
 $code .= ', data => sub { +{ guard => 0 } }';