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