my %default_exports = (
load_or_skip => \&load_or_skip,
load_or_skip_all => \&load_or_skip_all,
- run_perl => \&run_perl,
skip_all => \&skip_all,
);
my %features = (
- threads => \&init_threads,
- usleep => \&init_usleep,
- capture => \&init_capture,
+ threads => \&init_threads,
+ usleep => \&init_usleep,
+ run_perl => \&init_run_perl,
+ capture => \&init_capture,
);
sub import {
return $handler->($perl, '-T', map("-I$_", @INC));
}
+sub init_run_perl {
+ my $prefix = shift;
+
+ if (defined $prefix) {
+ if (length $prefix and $prefix !~ /_$/) {
+ $prefix .= '_';
+ }
+ } else {
+ $prefix = '';
+ }
+
+ my $p = $prefix;
+
+ return (
+ run_perl => \&run_perl,
+ "${p}RUN_PERL_FAILED" => sub () { 'Could not execute perl subprocess' },
+ );
+}
+
sub run_perl {
my $code = shift;
use strict;
use warnings;
-use VPIT::TestHelpers;
+use VPIT::TestHelpers 'run_perl' => [ 'VTH' ];
-use Test::More tests => 5 + 1;
+use Test::More tests => 5 + 2;
use Config;
use File::Temp;
like $@, qr/^Double quotes in evaluated code are not portable/,
'croak on double quotes';
}
+
+{
+ my $msg = VTH_RUN_PERL_FAILED;
+ like $msg, qr/^Could not execute/, 'RUN_PERL_FAILED error message';
+}