X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=t%2F31-array-fast.t;h=d3ee347a9be23ce15af5ee52506c1ae397391392;hb=HEAD;hp=1adab77b6c6bdcbf88f799b1812f863d19d6c8ce;hpb=942e958277b7cb1bc8044adb2c193a1f31757588;p=perl%2Fmodules%2Fautovivification.git diff --git a/t/31-array-fast.t b/t/31-array-fast.t index 1adab77..d3ee347 100644 --- a/t/31-array-fast.t +++ b/t/31-array-fast.t @@ -3,9 +3,9 @@ use strict; use warnings; -use Test::More tests => 9 * 3 * 274; - use lib 't/lib'; +use Test::Leaner tests => 9 * 3 * 302; + use autovivification::TestCases; while () { @@ -116,6 +116,20 @@ $x->[0] = 1 # 1 for $x->[1]; () # '', undef, [ 1, undef ] # +delete $x->[0] = 1 # 1 for $x->[0]; () # '', undef, [ 1 ] # +store $x->[0] = 1 # 1 for $x->[1]; () # '', undef, [ 1, undef ] # +store +$x # do_nothing($x->[0]); () # '', undef, [ ] +$x # do_nothing($x->[0]); () # '', undef, [ ] # +$x # do_nothing($x->[0]); () # '', undef, [ ] # +fetch +$x # do_nothing($x->[0]); () # '', undef, [ ] # +exists +$x # do_nothing($x->[0]); () # '', undef, [ ] # +delete +$x # do_nothing($x->[0]); () # qr/^Can't vivify reference/, undef, undef # +store + +$x # set_arg($x->[0]); () # '', undef, [ 1 ] +$x # set_arg($x->[0]); () # '', undef, [ 1 ] # +$x # set_arg($x->[0]); () # '', undef, [ 1 ] # +fetch +$x # set_arg($x->[0]); () # '', undef, [ 1 ] # +exists +$x # set_arg($x->[0]); () # '', undef, [ 1 ] # +delete +$x # set_arg($x->[0]); () # qr/^Can't vivify reference/, undef, undef # +store + --- dereferencing --- $x # no warnings 'uninitialized'; my @a = @$x; () # ($strict ? qr/^Can't use an undefined value as an ARRAY reference/ : ''), undef, undef @@ -130,6 +144,28 @@ $x->[0] = 1 # my @a = @$x; () # '', undef, [ 1 ] # +exists $x->[0] = 1 # my @a = @$x; () # '', undef, [ 1 ] # +delete $x->[0] = 1 # my @a = @$x; () # '', undef, [ 1 ] # +store +--- slice --- + +$x # my @a = @$x[0, 1]; \@a # '', [ undef, undef ], [ ] +$x # my @a = @$x[0, 1]; \@a # '', [ undef, undef ], undef # +$x # my @a = @$x[0, 1]; \@a # '', [ undef, undef ], undef # +fetch +$x # my @a = @$x[0, 1]; \@a # '', [ undef, undef ], [ ] # +exists +$x # my @a = @$x[0, 1]; \@a # '', [ undef, undef ], [ ] # +delete +$x # my @a = @$x[0, 1]; \@a # '', [ undef, undef ], [ ] # +store + +$x->[1] = 0 # my @a = @$x[0, 1]; \@a # '', [ undef, 0 ], [ undef, 0 ] # +fetch + +$x # @$x[0, 1] = (1, 2); () # '', undef, [ 1, 2 ] +$x # @$x[0, 1] = (1, 2); () # '', undef, [ 1, 2 ] # +$x # @$x[0, 1] = (1, 2); () # '', undef, [ 1, 2 ] # +fetch +$x # @$x[0, 1] = (1, 2); () # '', undef, [ 1, 2 ] # +exists +$x # @$x[0, 1] = (1, 2); () # '', undef, [ 1, 2 ] # +delete +$x # @$x[0, 1] = (1, 2); () # qr/^Can't vivify reference/, undef, undef # +store + +$x->[0] = 0 # @$x[0, 1] = (1, 2); () # '', undef, [ 1, 2 ] # +store +$x->[2] = 0 # @$x[0, 1] = (1, 2); () # '', undef, [ 1, 2, 0 ] # +store +$x->[0] = 0, $x->[1] = 0 # @$x[0, 1] = (1, 2); () # '', undef, [ 1, 2 ] # +store + --- exists --- $x # exists $x->[0] # '', '', [ ]