synthetic_scope.t revision 1.1
1#!perl 2 3use strict; 4use warnings; 5 6use Test::More tests => 18; 7 8use XS::APItest qw(with_vars); 9 10my $foo = "A"; my $rfoo = \$foo; 11my $bar = "B"; my $rbar = \$bar; 12my $baz = "C"; my $rbaz = \$baz; 13 14with_vars foo bar baz { 15 is $foo, 1; 16 is $$rfoo, "A"; 17 isnt \$foo, $rfoo; 18 19 is $bar, 2; 20 is $$rbar, "B"; 21 isnt \$bar, $rbar; 22 23 is $baz, 3; 24 is $$rbaz, "C"; 25 isnt \$baz, $rbaz; 26} 27 28is $foo, "A"; 29is \$foo, $rfoo; 30 31is $bar, "B"; 32is \$bar, $rbar; 33 34is $baz, "C"; 35is \$baz, $rbaz; 36 37with_vars x { 38 is $x, 1; 39} 40 41is eval('$x++'), undef; 42like $@, qr/explicit package name/; 43