6 use Variable::Temp 'set_temp';
8 use Test::More tests => (9 + 2 * 19) * 2 + 6 * 3;
12 return join ', ', map "$_:$h->{$_}", sort keys %$h;
54 set_temp @y => [ 8, 9, 10 ];
61 set_temp @y => [ 12, 13, 14 ];
63 set_temp @y => [ 15, 16];
73 set_temp @y => [ qw<a b c> ];
79 local @y[2, 3] = qw<e f>;
91 is describe(\%z), 'a:1';
93 set_temp %z => { b => 2 };
94 is describe(\%z), 'b:2';
96 is describe(\%z), 'c:3';
98 is describe(\%z), 'c:3, d:4';
100 is describe(\%z), 'a:1';
102 set_temp %z => { a => 5 };
103 is describe(\%z), 'a:5';
105 is describe(\%z), 'a:6';
107 is describe(\%z), 'a:1';
109 set_temp %z => { a => 7, d => 8 };
110 is describe(\%z), 'a:7, d:8';
111 set_temp %z => { d => 9, e => 10 };
112 is describe(\%z), 'd:9, e:10';
114 is describe(\%z), 'a:1';
117 is describe(\%z), '';
119 is describe(\%z), 'a:1';
121 set_temp %z => { a => 11, f => 12 };
122 is describe(\%z), 'a:11, f:12';
125 is describe(\%z), 'a:13, f:12';
127 local @z{qw<f g>} = (14, 15);
128 is describe(\%z), 'a:13, f:14, g:15';
130 is describe(\%z), 'a:13, f:12';
132 is describe(\%z), 'a:11, f:12';
134 is describe(\%z), 'a:1';
184 set_temp @Y => [ 3 ];
193 set_temp @Y => [ 8, 9, 10 ];
200 set_temp @Y => [ 12, 13, 14 ];
202 set_temp @Y => [ 15, 16];
212 set_temp @Y => [ qw<a b c> ];
218 local @Y[2, 3] = qw<e f>;
232 local @Y = qw<C D E>;
233 set_temp @Y => [ qw<F> ];
238 set_temp @Y => [ qw<G H I> ];
247 is describe(\%Z), 'a:1';
249 set_temp %Z => { b => 2 };
250 is describe(\%Z), 'b:2';
252 is describe(\%Z), 'c:3';
254 is describe(\%Z), 'c:3, d:4';
256 is describe(\%Z), 'a:1';
258 set_temp %Z => { a => 5 };
259 is describe(\%Z), 'a:5';
261 is describe(\%Z), 'a:6';
263 is describe(\%Z), 'a:1';
265 set_temp %Z => { a => 7, d => 8 };
266 is describe(\%Z), 'a:7, d:8';
267 set_temp %Z => { d => 9, e => 10 };
268 is describe(\%Z), 'd:9, e:10';
270 is describe(\%Z), 'a:1';
273 is describe(\%Z), '';
275 is describe(\%Z), 'a:1';
277 set_temp %Z => { a => 11, f => 12 };
278 is describe(\%Z), 'a:11, f:12';
281 is describe(\%Z), 'a:13, f:12';
283 local @Z{qw<f g>} = (14, 15);
284 is describe(\%Z), 'a:13, f:14, g:15';
286 is describe(\%Z), 'a:13, f:12';
288 is describe(\%Z), 'a:11, f:12';
290 is describe(\%Z), 'a:1';
292 local %Z = (A => 1, B => 2);
293 is describe(\%Z), 'A:1, B:2';
295 is describe(\%Z), 'a:1';
297 local %Z = (A => 3, C => 4);
298 set_temp %Z => { A => 5, D => 6 };
299 is describe(\%Z), 'A:5, D:6';
301 is describe(\%Z), 'a:1';
303 set_temp %Z => { A => 7, E => 8 };
304 local %Z = (A => 9, F => 10);
305 is describe(\%Z), 'A:9, F:10';
307 is describe(\%Z), 'a:1';