X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=t%2F17-ctl.t;h=c9dd4ca6426c7149d400e3550689c5156756fcd8;hb=c248088d736c15d3d88ed92a3e7d475f80a9d415;hp=f781a67902d14eac1a12372c2588f65a110c615e;hpb=7f3b1ec01ca3856b1d5670ab9795cf0e91ba8928;p=perl%2Fmodules%2FVariable-Magic.git diff --git a/t/17-ctl.t b/t/17-ctl.t index f781a67..c9dd4ca 100644 --- a/t/17-ctl.t +++ b/t/17-ctl.t @@ -3,7 +3,10 @@ use strict; use warnings; -use Test::More tests => 4 * 8 + 4 * (2 * 4 + 1) + 10 + 1 + 1; +use Test::More tests => 4 * 8 + 4 * (2 * 6 + 1) + 10 + 1 + 1; + +use lib 't/lib'; +use VPIT::TestHelpers; use Variable::Magic qw; @@ -152,7 +155,7 @@ for my $t (@scalar_tests) { my $x; cast $x, $wiz; }; - $check->("$desc at eval BLOCK 1"); + $check->("$desc at eval BLOCK 1a"); local $@ = $local_out ? 'xxx' : undef; eval q{ @@ -160,7 +163,23 @@ for my $t (@scalar_tests) { my $x; cast $x, $wiz; }; - $check->("$desc at eval STRING 1"); + $check->("$desc at eval STRING 1a"); + + local $@ = $local_out ? 'xxx' : undef; + eval { + my $x; + local $@ = 'yyy' if $local_in; + cast $x, $wiz; + }; + $check->("$desc at eval BLOCK 1b"); + + local $@ = $local_out ? 'xxx' : undef; + eval q{ + my $x; + local $@ = 'yyy' if $local_in; + cast $x, $wiz; + }; + $check->("$desc at eval STRING 1b"); local $@ = $local_out ? 'xxx' : undef; eval { @@ -169,7 +188,7 @@ for my $t (@scalar_tests) { my $y = \$x; &cast($y, $wiz); }; - $check->("$desc at eval BLOCK 2"); + $check->("$desc at eval BLOCK 2a"); local $@ = $local_out ? 'xxx' : undef; eval q{ @@ -178,7 +197,25 @@ for my $t (@scalar_tests) { my $y = \$x; &cast($y, $wiz); }; - $check->("$desc at eval STRING 2"); + $check->("$desc at eval STRING 2a"); + + local $@ = $local_out ? 'xxx' : undef; + eval { + my $x; + my $y = \$x; + local $@ = 'yyy' if $local_in; + &cast($y, $wiz); + }; + $check->("$desc at eval BLOCK 2b"); + + local $@ = $local_out ? 'xxx' : undef; + eval q{ + my $x; + my $y = \$x; + local $@ = 'yyy' if $local_in; + &cast($y, $wiz); + }; + $check->("$desc at eval STRING 2b"); local $@ = $local_out ? 'xxx' : undef; eval { @@ -308,17 +345,6 @@ eval q{BEGIN { like $@, expect('tomato', undef, "\nBEGIN.*"), 'die in BEGIN in eval triggers hints hash destructor'; -sub run_perl { - my $code = shift; - - my ($SystemRoot, $PATH) = @ENV{qw}; - local %ENV; - $ENV{SystemRoot} = $SystemRoot if $^O eq 'MSWin32' and defined $SystemRoot; - $ENV{PATH} = $PATH if $^O eq 'cygwin' and defined $PATH; - - system { $^X } $^X, '-T', map("-I$_", @INC), '-e', $code; -} - my $has_capture_tiny = do { local $@; eval {