1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103
|
#!perl -T
use strict;
use warnings;
use Test::More;
BEGIN {
if ($] >= 5.011) { plan tests => 9 * 3 * 64 } else { plan skip_all => 'perl 5.11 required for keys/values @array' }
}
use lib 't/lib';
use autovivification::TestCases;
while (<DATA>) {
1 while chomp;
next unless /#/;
testcase_ok($_, '@');
}
__DATA__
--- keys ---
$x # keys @$x # '', 0, [ ]
$x # keys @$x # '', 0, undef #
$x # keys @$x # '', 0, undef # +fetch
$x # keys @$x # '', 0, [ ] # +exists
$x # keys @$x # '', 0, [ ] # +delete
$x # keys @$x # '', 0, [ ] # +store
$x # keys @$x # qr/^Reference vivification forbidden/, undef, undef # +strict +fetch
$x # keys @$x # '', 0, [ ] # +strict +exists
$x # keys @$x # '', 0, [ ] # +strict +delete
$x # keys @$x # '', 0, [ ] # +strict +store
$x # [ keys @$x ] # '', [ ], [ ]
$x # [ keys @$x ] # '', [ ], undef #
$x # [ keys @$x ] # '', [ ], undef # +fetch
$x # [ keys @$x ] # '', [ ], [ ] # +exists +delete +store
$x->[0] = 1 # [ keys @$x ] # '', [0], [ 1 ]
$x->[0] = 1 # [ keys @$x ] # '', [0], [ 1 ] #
$x->[0] = 1 # [ keys @$x ] # '', [0], [ 1 ] # +fetch
$x->[0] = 1 # [ keys @$x ] # '', [0], [ 1 ] # +exists +delete +store
$x # keys @{$x->[0]} # '', 0, [ [ ] ]
$x # keys @{$x->[0]} # '', 0, undef #
$x # keys @{$x->[0]} # '', 0, undef # +fetch
$x # keys @{$x->[0]} # '', 0, [ [ ] ] # +exists
$x # keys @{$x->[0]} # '', 0, [ [ ] ] # +delete
$x # keys @{$x->[0]} # '', 0, [ [ ] ] # +store
$x # keys @{$x->[0]} # qr/^Reference vivification forbidden/, undef, undef # +strict +fetch
$x # keys @{$x->[0]} # '', 0, [ [ ] ] # +strict +exists
$x # keys @{$x->[0]} # '', 0, [ [ ] ] # +strict +delete
$x # keys @{$x->[0]} # '', 0, [ [ ] ] # +strict +store
$x # [ keys @{$x->[0]} ] # '', [ ], [ [ ] ]
$x # [ keys @{$x->[0]} ] # '', [ ], undef #
$x # [ keys @{$x->[0]} ] # '', [ ], undef # +fetch
$x # [ keys @{$x->[0]} ] # '', [ ], [ [ ] ] # +exists +delete +store
--- values ---
$x # values @$x # '', 0, [ ]
$x # values @$x # '', 0, undef #
$x # values @$x # '', 0, undef # +fetch
$x # values @$x # '', 0, [ ] # +exists
$x # values @$x # '', 0, [ ] # +delete
$x # values @$x # '', 0, [ ] # +store
$x # values @$x # qr/^Reference vivification forbidden/, undef, undef # +strict +fetch
$x # values @$x # '', 0, [ ] # +strict +exists
$x # values @$x # '', 0, [ ] # +strict +delete
$x # values @$x # '', 0, [ ] # +strict +store
$x # [ values @$x ] # '', [ ], [ ]
$x # [ values @$x ] # '', [ ], undef #
$x # [ values @$x ] # '', [ ], undef # +fetch
$x # [ values @$x ] # '', [ ], [ ] # +exists +delete +store
$x->[0] = 1 # [ values @$x ] # '', [ 1 ], [ 1 ]
$x->[0] = 1 # [ values @$x ] # '', [ 1 ], [ 1 ] #
$x->[0] = 1 # [ values @$x ] # '', [ 1 ], [ 1 ] # +fetch
$x->[0] = 1 # [ values @$x ] # '', [ 1 ], [ 1 ] # +exists +delete +store
$x # values @{$x->[0]} # '', 0, [ [ ] ]
$x # values @{$x->[0]} # '', 0, undef #
$x # values @{$x->[0]} # '', 0, undef # +fetch
$x # values @{$x->[0]} # '', 0, [ [ ] ] # +exists
$x # values @{$x->[0]} # '', 0, [ [ ] ] # +delete
$x # values @{$x->[0]} # '', 0, [ [ ] ] # +store
$x # values @{$x->[0]} # qr/^Reference vivification forbidden/, undef, undef # +strict +fetch
$x # values @{$x->[0]} # '', 0, [ [ ] ] # +strict +exists
$x # values @{$x->[0]} # '', 0, [ [ ] ] # +strict +delete
$x # values @{$x->[0]} # '', 0, [ [ ] ] # +strict +store
$x # [ values @{$x->[0]} ] # '', [ ], [ [ ] ]
$x # [ values @{$x->[0]} ] # '', [ ], undef #
$x # [ values @{$x->[0]} ] # '', [ ], undef # +fetch
$x # [ values @{$x->[0]} ] # '', [ ], [ [ ] ] # +exists +delete +store
|