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