X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=t%2F35-stash.t;h=a9600bc44d3f6b1a73e6ec5282fb706fcb5166ec;hb=HEAD;hp=d1fc7a480f177145555f10327634a64ca5cf837a;hpb=3bc98bdbdb230943e7fb3135e325f10013acac2d;p=perl%2Fmodules%2FVariable-Magic.git diff --git a/t/35-stash.t b/t/35-stash.t index d1fc7a4..a9600bc 100644 --- a/t/35-stash.t +++ b/t/35-stash.t @@ -92,11 +92,19 @@ cast %Hlagh::, $wiz; }; my @calls = qw; + my (@fetch, @store); + if ("$]" >= 5.011_002 && "$]" < 5.021_004) { + @fetch = @calls; + @store = map { ($_) x 2 } @calls; + } else { + @fetch = @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'; } @@ -106,9 +114,12 @@ cast %Hlagh::, $wiz; eval q{ Hlagh->shoot() }; is $@, '', 'stash: valid method call ran fine'; - is_deeply \%mg, { - fetch => [ qw ], - }, 'stash: valid method call'; + my %expected = ( fetch => [ qw ] ); + # Typeglob reification may cause a store in 5.28+ + if ("$]" >= 5.027 && %mg == 2) { + $expected{store} = $expected{fetch}; + } + is_deeply \%mg, \%expected, 'stash: valid method call'; } { @@ -215,6 +226,10 @@ cast %Hlagh::, $wiz; { local %mg; + my @expected_stores = qw; + @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 - ], - }, 'stash: delete'; + is_deeply \%mg, { store => \@expected_stores }, 'stash: delete'; } END { @@ -296,7 +307,7 @@ $_ => sub { CB } qw); -my $uo_exp = $] < 5.011002 ? 2 : 3; +my $uo_exp = "$]" >= 5.011_002 && "$]" < 5.021_004 ? 3 : 2; $code .= ', data => sub { +{ guard => 0 } }';