From: Vincent Pit Date: Sun, 28 Dec 2008 17:26:33 +0000 (+0100) Subject: More tests for localized nonexistent array elements X-Git-Tag: v0.02~3 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=1a52b3489cc6cdf5c139fc68828e7e0d6ae128fd;p=perl%2Fmodules%2FScope-Upper.git More tests for localized nonexistent array elements --- diff --git a/t/39-localize_elem-target.t b/t/39-localize_elem-target.t index 786ce55..ecff42b 100644 --- a/t/39-localize_elem-target.t +++ b/t/39-localize_elem-target.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => 14; +use Test::More tests => 17; use Scope::Upper qw/localize_elem/; @@ -42,6 +42,19 @@ our @a; is_deeply \@a, [ 4 .. 6 ], 'localize_elem "@a", 1, 12, 1 [end]'; } +{ + local @a = (4 .. 6); + { + local @a = (5 .. 7); + { + localize_elem '@main::a', 4, 12, 1; + is_deeply \@a, [ 5 .. 7 ], 'localize_elem "@a", 4, 12, 1 [not yet]'; + } + is_deeply \@a, [ 5 .. 7, undef, 12 ], 'localize_elem "@a", 4, 12, 1 [ok]'; + } + is_deeply \@a, [ 4 .. 6 ], 'localize_elem "@a", 4, 12, 1 [end]'; +} + # Hashes our %h;