use Variable::Temp 'set_temp';
-use Test::More tests => (7 + 2 * 19) * 2 + 6 * 3;
+use Test::More tests => (9 + 2 * 19) * 2 + 6 * 3;
sub describe {
my $h = $_[0];
# Lexicals
-my $x = 1;
-is $x, 1;
{
- set_temp $x => 2;
- is $x, 2;
- $x = 3;
- is $x, 3;
+ my $x = 1;
+ is $x, 1;
+ {
+ set_temp $x => 2;
+ is $x, 2;
+ $x = 3;
+ is $x, 3;
+ }
+ is $x, 1;
{
set_temp $x => 4;
is $x, 4;
set_temp $x => 5;
is $x, 5;
}
- is $x, 3;
+ is $x, 1;
+ {
+ set_temp $x;
+ is $x, undef;
+ }
+ is $x, 1;
}
-is $x, 1;
{
my @y = (1, 2);
# Globals
-our $X = 1;
-is $X, 1;
{
- set_temp $X => 2;
- is $X, 2;
- $X = 3;
- is $X, 3;
+ our $X = 1;
+ is $X, 1;
+ {
+ set_temp $X => 2;
+ is $X, 2;
+ $X = 3;
+ is $X, 3;
+ }
+ is $X, 1;
{
set_temp $X => 4;
is $X, 4;
set_temp $X => 5;
is $X, 5;
}
- is $X, 3;
+ is $X, 1;
+ {
+ set_temp $X;
+ is $X, undef;
+ }
+ is $X, 1;
{
local $X = 6;
is $X, 6;
}
- is $X, 3;
+ is $X, 1;
{
local $X = 7;
set_temp $X => 8;
is $X, 8;
}
- is $X, 3;
+ is $X, 1;
{
set_temp $X => 9;
local $X = 10;
is $X, 10;
}
- is $X, 3;
+ is $X, 1;
}
-is $X, 1;
{
our @Y = (1, 2);