From: Vincent Pit Date: Tue, 17 Mar 2015 13:49:24 +0000 (-0300) Subject: Update VPIT::TestHelpers to 3c878c7c X-Git-Tag: v0.03~4 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=0aa7e9215b880762d03074ac637304eaa2eeeecf;p=perl%2Fmodules%2FScope-Context.git Update VPIT::TestHelpers to 3c878c7c --- diff --git a/t/lib/VPIT/TestHelpers.pm b/t/lib/VPIT/TestHelpers.pm index 3d545e8..c147f80 100644 --- a/t/lib/VPIT/TestHelpers.pm +++ b/t/lib/VPIT/TestHelpers.pm @@ -3,9 +3,12 @@ package VPIT::TestHelpers; use strict; use warnings; +use Config (); + my %exports = ( load_or_skip => \&load_or_skip, load_or_skip_all => \&load_or_skip_all, + run_perl => \&run_perl, skip_all => \&skip_all, ); @@ -102,6 +105,21 @@ sub load_or_skip_all { return $loaded; } +sub run_perl { + my $code = shift; + + my ($SystemRoot, $PATH) = @ENV{qw}; + my $ld_name = $Config::Config{ldlibpthname}; + my $ldlibpth = $ENV{$ld_name}; + + local %ENV; + $ENV{$ld_name} = $ldlibpth if defined $ldlibpth; + $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; +} + package VPIT::TestHelpers::Guard; sub new {