X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=t%2F20-hash.t;h=6438056f89dae2ea5cf53250540d8e86ed9ea824;hb=68e31f8ce73ddedf82977b4e05ec550c1cfe5688;hp=fa16a375d6cadae30f4499fcfbe3ceece2223dbf;hpb=167a7d1ceb42868217cdc88690f5d565527b3d6c;p=perl%2Fmodules%2Fautovivification.git diff --git a/t/20-hash.t b/t/20-hash.t index fa16a37..6438056 100644 --- a/t/20-hash.t +++ b/t/20-hash.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->{a} = 1 # my @a = %$x; () # '', undef, { a => 1 } # +exists $x->{a} = 1 # my @a = %$x; () # '', undef, { a => 1 } # +delete $x->{a} = 1 # my @a = %$x; () # '', undef, { a => 1 } # +store +--- slice --- + +$x # my @a = @$x{'a', 'b'}; \@a # '', [ undef, undef ], { } +$x # my @a = @$x{'a', 'b'}; \@a # '', [ undef, undef ], undef # +$x # my @a = @$x{'a', 'b'}; \@a # '', [ undef, undef ], undef # +fetch +$x # my @a = @$x{'a', 'b'}; \@a # '', [ undef, undef ], { } # +exists +$x # my @a = @$x{'a', 'b'}; \@a # '', [ undef, undef ], { } # +delete +$x # my @a = @$x{'a', 'b'}; \@a # '', [ undef, undef ], { } # +store + +$x->{b} = 0 # my @a = @$x{'a', 'b'}; \@a # '', [ undef, 0 ], { b => 0 } # +fetch + +$x # @$x{'a', 'b'} = (1, 2); () # '', undef, { a => 1, b => 2 } +$x # @$x{'a', 'b'} = (1, 2); () # '', undef, { a => 1, b => 2 } # +$x # @$x{'a', 'b'} = (1, 2); () # '', undef, { a => 1, b => 2 } # +fetch +$x # @$x{'a', 'b'} = (1, 2); () # '', undef, { a => 1, b => 2 } # +exists +$x # @$x{'a', 'b'} = (1, 2); () # '', undef, { a => 1, b => 2 } # +delete +$x # @$x{'a', 'b'} = (1, 2); () # qr/^Can't vivify reference/, undef, undef # +store + +$x->{a} = 0 # @$x{'a', 'b'} = (1, 2); () # '', undef, { a => 1, b => 2 } # +store +$x->{c} = 0 # @$x{'a', 'b'} = (1, 2); () # '', undef, { a => 1, b => 2, c => 0 } # +store +$x->{a} = 0, $x->{b} = 0 # @$x{'a', 'b'} = (1, 2); () # '', undef, { a => 1, b => 2 } # +store + --- exists --- $x # exists $x->{a} # '', '', { }