From: Vincent Pit Date: Mon, 1 Sep 2014 13:04:38 +0000 (+0200) Subject: Use run_perl() from VPIT::TestHelpers X-Git-Tag: rt92806 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=752a3c49b90f29667d944a5ddc5a4402252640b1;p=perl%2Fmodules%2Findirect.git Use run_perl() from VPIT::TestHelpers This updates VPIT::TestHelpers to 4fb18792. --- diff --git a/t/41-threads-teardown.t b/t/41-threads-teardown.t index 64c23dc..419ce9d 100644 --- a/t/41-threads-teardown.t +++ b/t/41-threads-teardown.t @@ -4,21 +4,11 @@ use strict; use warnings; use lib 't/lib'; +use VPIT::TestHelpers; use indirect::TestThreads; use Test::Leaner tests => 1; -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; -} - SKIP: { skip 'Fails on 5.8.2 and lower' => 1 if "$]" <= 5.008_002; diff --git a/t/50-external.t b/t/50-external.t index 52ff1b8..9e80f01 100644 --- a/t/50-external.t +++ b/t/50-external.t @@ -10,17 +10,6 @@ use VPIT::TestHelpers; BEGIN { delete $ENV{PERL_INDIRECT_PM_DISABLE} } -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 $status = run_perl 'no indirect; qq{a\x{100}b} =~ /\A[\x00-\x7f]*\z/;'; is $status, 0, 'RT #47866'; diff --git a/t/lib/VPIT/TestHelpers.pm b/t/lib/VPIT/TestHelpers.pm index 3d545e8..91de044 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{SystemRoot} = $SystemRoot if $^O eq 'MSWin32' and defined $SystemRoot; + $ENV{PATH} = $PATH if $^O eq 'cygwin' and defined $PATH; + $ENV{$ld_name} = $ldlibpth if $^O eq 'android' and defined $ldlibpth; + + system { $^X } $^X, '-T', map("-I$_", @INC), '-e', $code; +} + package VPIT::TestHelpers::Guard; sub new {