X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=t%2F30-array.t;h=d8497f3f9a371291f49888be5082ed4e017b75be;hb=68e31f8ce73ddedf82977b4e05ec550c1cfe5688;hp=feea9ebfee9b7218481784004ae4b5b7cff08cca;hpb=167a7d1ceb42868217cdc88690f5d565527b3d6c;p=perl%2Fmodules%2Fautovivification.git diff --git a/t/30-array.t b/t/30-array.t index feea9eb..d8497f3 100644 --- a/t/30-array.t +++ b/t/30-array.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => 9 * 3 * 274; +use Test::More tests => 9 * 3 * 290; use lib 't/lib'; use autovivification::TestCases; @@ -130,6 +130,28 @@ $x->[$N[0]] = 1 # my @a = @$x; () # '', undef, [ 1 ] # +exists $x->[$N[0]] = 1 # my @a = @$x; () # '', undef, [ 1 ] # +delete $x->[$N[0]] = 1 # my @a = @$x; () # '', undef, [ 1 ] # +store +--- slice --- + +$x # my @a = @$x[$N[0], $N[1]]; \@a # '', [ undef, undef ], [ ] +$x # my @a = @$x[$N[0], $N[1]]; \@a # '', [ undef, undef ], undef # +$x # my @a = @$x[$N[0], $N[1]]; \@a # '', [ undef, undef ], undef # +fetch +$x # my @a = @$x[$N[0], $N[1]]; \@a # '', [ undef, undef ], [ ] # +exists +$x # my @a = @$x[$N[0], $N[1]]; \@a # '', [ undef, undef ], [ ] # +delete +$x # my @a = @$x[$N[0], $N[1]]; \@a # '', [ undef, undef ], [ ] # +store + +$x->[$N[1]] = 0 # my @a = @$x[$N[0], $N[1]]; \@a # '', [ undef, 0 ], [ undef, 0 ] # +fetch + +$x # @$x[$N[0], $N[1]] = (1, 2); () # '', undef, [ 1, 2 ] +$x # @$x[$N[0], $N[1]] = (1, 2); () # '', undef, [ 1, 2 ] # +$x # @$x[$N[0], $N[1]] = (1, 2); () # '', undef, [ 1, 2 ] # +fetch +$x # @$x[$N[0], $N[1]] = (1, 2); () # '', undef, [ 1, 2 ] # +exists +$x # @$x[$N[0], $N[1]] = (1, 2); () # '', undef, [ 1, 2 ] # +delete +$x # @$x[$N[0], $N[1]] = (1, 2); () # qr/^Can't vivify reference/, undef, undef # +store + +$x->[$N[0]] = 0 # @$x[$N[0], $N[1]] = (1, 2); () # '', undef, [ 1, 2 ] # +store +$x->[$N[2]] = 0 # @$x[$N[0], $N[1]] = (1, 2); () # '', undef, [ 1, 2, 0 ] # +store +$x->[$N[0]] = 0, $x->[$N[1]] = 0 # @$x[$N[0], $N[1]] = (1, 2); () # '', undef, [ 1, 2 ] # +store + --- exists --- $x # exists $x->[$N[0]] # '', '', [ ]