]> git.vpit.fr Git - perl/modules/VPIT-TestHelpers.git/blobdiff - t/30-run_perl.t
Turn run_perl() into a feature
[perl/modules/VPIT-TestHelpers.git] / t / 30-run_perl.t
index cd040e133c8938e70fce9f21bbcbc77ea01f0ab5..2238fb76838cf0f79e8d87d7f35237a16e7a5071 100644 (file)
@@ -3,15 +3,17 @@
 use strict;
 use warnings;
 
-use VPIT::TestHelpers;
+use VPIT::TestHelpers 'run_perl' => [ 'VTH' ];
 
-use Test::More tests => 5;
+use Test::More tests => 5 + 2;
 
 use Config;
 use File::Temp;
 
 my $filename = '/tmp/run_perl_test';
 
+my $guard = VPIT::TestHelpers::Guard->new(sub { unlink $filename });
+
 my $code = "open my \$fh, q[>], q[$filename] or die \$!; for my \$key (sort keys %ENV) { print \$fh qq[\$key:\$ENV{\$key}\n] } close \$fh";
 
 my $ld_path = $Config::Config{ldlibpthname};
@@ -64,3 +66,17 @@ for my $os (qw<MSWin32 android darwin cygwin linux>) {
 
  is $got, $exp, "run_perl preserving $os ENV vars";
 }
+
+{
+ local $@;
+ eval {
+  run_perl 'print "hello\n"';
+ };
+ 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';
+}