From: Vincent Pit Date: Thu, 26 Feb 2009 23:43:25 +0000 (+0100) Subject: Test localize on magical scalar variables X-Git-Tag: rt44204~6 X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FScope-Upper.git;a=commitdiff_plain;h=fe721e2fd6e919d3abaa66a7e7bcc5578bc38672 Test localize on magical scalar variables --- diff --git a/MANIFEST b/MANIFEST index 0a41007..c8b3975 100644 --- a/MANIFEST +++ b/MANIFEST @@ -18,6 +18,7 @@ t/20-localize-target.t t/21-localize-level.t t/22-localize-block.t t/23-localize-ctl.t +t/24-localize-magic.t t/25-localize-multi.t t/30-localize_elem-target.t t/31-localize_elem-level.t diff --git a/t/24-localize-magic.t b/t/24-localize-magic.t new file mode 100644 index 0000000..3bcb423 --- /dev/null +++ b/t/24-localize-magic.t @@ -0,0 +1,32 @@ +#!perl -T + +use strict; +use warnings; + +use Scope::Upper qw/localize UP HERE/; + +use Test::More tests => 5; + +my @a = qw/a b c/; + +{ + local $" = ''; + { + localize '$"', '_' => HERE; + is "@a", 'a_b_c', 'localize $" => HERE [ok]'; + } + is "@a", 'abc', 'localize $" => HERE [end]'; +} + +{ + local $" = ''; + { + local $" = '-'; + { + localize '$"', '_' => UP; + is "@a", 'a-b-c', 'localize $" => UP [not yet]'; + } + is "@a", 'a_b_c', 'localize $" => UP [ok]'; + } + is "@a", 'abc', 'localize $" => UP [end]'; +}