From: Vincent Pit Date: Wed, 29 Apr 2015 14:07:07 +0000 (-0300) Subject: Also test stores in t/44-multideref.t X-Git-Tag: v0.15~12 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=f272f375c8bc23ea4a0ba73742bb878af622b9a6;p=perl%2Fmodules%2Fautovivification.git Also test stores in t/44-multideref.t --- diff --git a/t/44-multideref.t b/t/44-multideref.t index 954b069..b19b8ce 100644 --- a/t/44-multideref.t +++ b/t/44-multideref.t @@ -4,14 +4,17 @@ use strict; use warnings; use lib 't/lib'; -use Test::Leaner tests => 3 * 4 * (8 ** 3) * 2; +use Test::Leaner tests => 4 * 4 * (8 ** 3) * 2; my $depth = 3; +my $magic_val = 123; + my @prefixes = ( - '', - 'exists ', - 'delete ', + sub { $_[0] }, + sub { "$_[0] = $magic_val" }, + sub { "exists $_[0]" }, + sub { "delete $_[0]" }, ); my (@vlex, %vlex, $vrlex); @@ -87,11 +90,14 @@ sub reset_vars { } } -my $iterator = autovivification::TestIterator->new(3, 4, (8) x $depth); +my $iterator = autovivification::TestIterator->new(4, 4, (8) x $depth); do { - my @elems = $iterator->pick(\@prefixes, \@heads, (\@derefs) x $depth); - my $code = join '', @elems; - my $exp = $elems[0] eq 'exists ' ? !1 : undef; + my ($prefix, @elems) + = $iterator->pick(\@prefixes, \@heads, (\@derefs) x $depth); + my $code = $prefix->(join '', @elems); + my $exp = ($code =~ /^\s*exists/) ? !1 + : (($code =~ /=\s*$magic_val/) ? $magic_val + : undef); reset_vars(); my ($res, $err) = do { local $SIG{__WARN__} = sub { die @_ };