]> git.vpit.fr Git - perl/modules/autovivification.git/blobdiff - t/21-array.t
Really test non-ref arrays and hashes
[perl/modules/autovivification.git] / t / 21-array.t
index bf843d6e3f02b645bafa2b7c13b429b99354d8ad..744c4927549ff2bb3a2399d3bda5af4a3cc078d8 100644 (file)
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 6 * 3 * 270;
+use Test::More tests => 6 * 3 * 274;
 
 use lib 't/lib';
 use autovivification::TestCases;
@@ -25,6 +25,11 @@ $x # $x->[0] # '', undef, [ ] # +exists
 $x # $x->[0] # '', undef, [ ] # +delete
 $x # $x->[0] # '', undef, [ ] # +store
 
+$x # $x->[0] # '', undef, [ ] # -fetch
+$x # $x->[0] # '', undef, [ ] # +fetch -fetch
+$x # $x->[0] # '', undef, undef # -fetch +fetch
+$x # $x->[0] # '', undef, undef # +fetch -exists
+
 $x # $x->[0] # qr/^Reference vivification forbidden/, undef, undef # +strict +fetch
 $x # $x->[0] # '', undef, [ ] # +strict +exists
 $x # $x->[0] # '', undef, [ ] # +strict +delete
@@ -113,12 +118,12 @@ $x->[0] = 1 # 1 for $x->[1]; () # '', undef, [ 1, undef ] # +store
 
 --- dereferencing ---
 
-$x # no warnings 'uninitialized'; my @a = @$x; () # ($strict ? qr/Can't use an undefined value as an ARRAY reference/ : ''), undef, undef
-$x # no warnings 'uninitialized'; my @a = @$x; () # ($strict ? qr/Can't use an undefined value as an ARRAY reference/ : ''), undef, undef #
-$x # no warnings 'uninitialized'; my @a = @$x; () # ($strict ? qr/Can't use an undefined value as an ARRAY reference/ : ''), undef, undef # +fetch
-$x # no warnings 'uninitialized'; my @a = @$x; () # ($strict ? qr/Can't use an undefined value as an ARRAY reference/ : ''), undef, undef # +exists
-$x # no warnings 'uninitialized'; my @a = @$x; () # ($strict ? qr/Can't use an undefined value as an ARRAY reference/ : ''), undef, undef # +delete
-$x # no warnings 'uninitialized'; my @a = @$x; () # ($strict ? qr/Can't use an undefined value as an ARRAY reference/ : ''), undef, undef # +store
+$x # no warnings 'uninitialized'; my @a = @$x; () # ($strict ? qr/^Can't use an undefined value as an ARRAY reference/ : ''), undef, undef
+$x # no warnings 'uninitialized'; my @a = @$x; () # ($strict ? qr/^Can't use an undefined value as an ARRAY reference/ : ''), undef, undef #
+$x # no warnings 'uninitialized'; my @a = @$x; () # ($strict ? qr/^Can't use an undefined value as an ARRAY reference/ : ''), undef, undef # +fetch
+$x # no warnings 'uninitialized'; my @a = @$x; () # ($strict ? qr/^Can't use an undefined value as an ARRAY reference/ : ''), undef, undef # +exists
+$x # no warnings 'uninitialized'; my @a = @$x; () # ($strict ? qr/^Can't use an undefined value as an ARRAY reference/ : ''), undef, undef # +delete
+$x # no warnings 'uninitialized'; my @a = @$x; () # ($strict ? qr/^Can't use an undefined value as an ARRAY reference/ : ''), undef, undef # +store
 
 $x->[0] = 1 # my @a = @$x; () # '', undef, [ 1 ] # +fetch
 $x->[0] = 1 # my @a = @$x; () # '', undef, [ 1 ] # +exists