X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=t%2F30-localize_elem-target.t;h=273eb0d632df4a6af806fc7cc8a48f33605eab6d;hb=refs%2Ftags%2Frt55593;hp=79ce8eec59c6bc9c70ed010b4ca47d14f18f5caa;hpb=3ccbf65d886255fab86d078e7807d78c576290f3;p=perl%2Fmodules%2FScope-Upper.git diff --git a/t/30-localize_elem-target.t b/t/30-localize_elem-target.t index 79ce8ee..273eb0d 100644 --- a/t/30-localize_elem-target.t +++ b/t/30-localize_elem-target.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => 21; +use Test::More tests => 25; use Scope::Upper qw/localize_elem UP HERE/; @@ -73,6 +73,16 @@ our @a; is_deeply \@a, [ 4 .. 6 ], 'localize_elem "@a", 4, 12 => UP [end]'; } +{ + { + localize_elem '@nonexistent', 2, 7; + is_deeply eval('*nonexistent{ARRAY}'), [ undef, undef, 7 ], + 'localize_elem "@nonexistent", 2, 7 => HERE [ok]'; + } + is_deeply eval('*nonexistent{ARRAY}'), [ ], + 'localize_elem "@nonexistent", 2, 7 => HERE [end]'; +} + # Hashes our %h; @@ -108,3 +118,12 @@ our %h; is_deeply \%h, { a => 1, b => 2 }, 'localize_elem "%h", "a", 5 => UP [end]'; } +{ + { + localize_elem '%nonexistent', 'a', 13; + is_deeply eval('*nonexistent{HASH}'), { a => 13 }, + 'localize_elem "%nonexistent", "a", 13 => HERE [ok]'; + } + is_deeply eval('*nonexistent{HASH}'), { }, + 'localize_elem "%nonexistent", "a", 13 => HERE [end]'; +}