use Test::More tests => 44;
-use Scope::Upper qw/localize/;
+use Scope::Upper qw/localize UP HERE/;
our ($x, $y);
local $x = 1;
{
local $x = 2;
- localize '$y' => 1 => 0;
+ localize '$y' => 1 => HERE;
is $x, 2, 'last 0 [ok - x]';
is $y, 1, 'last 0 [ok - y]';
last;
local $y = 0;
{
local $x = 3;
- localize '$y' => 1 => 1;
+ localize '$y' => 1 => UP;
is $x, 3, 'last 1 [ok - x]';
is $y, 0, 'last 1 [ok - y]';
last LOOP;
local $x = 1;
{
local $x = 2;
- localize '$y' => 1 => 0;
+ localize '$y' => 1 => HERE;
is $x, 2, 'next 0 [ok - x]';
is $y, 1, 'next 0 [ok - y]';
next;
local $y = 0;
{
local $x = 3;
- localize '$y' => 1 => 1;
+ localize '$y' => 1 => UP;
is $x, 3, 'next 1 [ok - x]';
is $y, 0, 'next 1 [ok - y]';
next LOOP;
{
local $x = 2;
{
- localize '$y' => 1 => 2;
+ localize '$y' => 1 => UP UP;
}
is $x, 2, 'goto 1 [not yet - x]';
is $y, undef, 'goto 1 [not yet - y]';
{
local $x = 3;
{
- localize '$y' => 1 => 3;
+ localize '$y' => 1 => UP UP UP;
}
is $x, 3, 'goto 2 [not yet - x]';
is $y, undef, 'goto 2 [not yet - y]';
{
{
local $x = 3;
- localize '$y' => 1 => 4;
+ localize '$y' => 1 => UP UP UP UP;
is $x, 3, 'die - reap outside eval [not yet 1 - x]';
is $y, undef, 'die - reap outside eval [not yet 1 - y]';
}
{
{
local $x = 3;
- localize '$y' => 1 => 3;
+ localize '$y' => 1 => UP UP UP;
is $x, 3, 'die - reap at eval [not yet 1 - x]';
is $y, undef, 'die - reap at eval [not yet 1 - y]';
}
{
{
local $x = 3;
- localize '$y' => 1 => 2;
+ localize '$y' => 1 => UP UP;
is $x, 3, 'die - reap inside eval [not yet 1 - x]';
is $y, undef, 'die - reap inside eval [not yet 1 - y]';
}