Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Flesh out tests for run/shell a bit.
We had not tests that checked the return type of run and shell at all.
This codifies that they return Proc and along the way covers the final
design that RT #117039 was complaining about.
  • Loading branch information
jnthn committed Nov 5, 2015
1 parent dd6a85f commit 55d2cae
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions S29-os/system.t
Expand Up @@ -4,19 +4,34 @@ use Test;
# L<S29/"OS"/"=item run">
# system is renamed to run, so link there.

plan 8;
plan 18;

my $res;

$res = run($*EXECUTABLE,'-e1');
$res = run($*EXECUTABLE,'-e', '');
ok($res,"run() to an existing program does not die (and returns something true)");
isa-ok($res, Proc, 'run() returns a Proc');
is($res.exitcode, 0, 'run() exit code when successful is zero');

$res = shell("$*EXECUTABLE -e \"\"");
ok($res, "shell() to an existing program does not die (and returns something true)");
isa-ok($res, Proc, 'shell() returns a Proc');
is($res.exitcode, 0, 'shell() exit code when successful is zero');

# RT #117039
$res = run("program_that_does_not_exist_ignore_this_error_please.exe");
ok(!$res, "run() to a nonexisting program does not die (and returns something false)");
isa-ok($res, Proc, 'run() returns a Proc even when not successful');
ok($res.exitcode != 0, 'run() exit code is not zero on failure');

$res = run("program_that_does_not_exist_ignore_errors_please.exe","a","b");
ok(!$res, "run() to a nonexisting program with an argument list does not die (and returns something false)");

$res = shell("program_that_does_not_exist_ignore_this_error_please.exe");
ok(!$res, "shell() to a nonexisting program does not die (and returns something false)");
isa-ok($res, Proc, 'shell() returns a Proc even when not successful');
ok($res.exitcode != 0, 'shell() exit code is not zero on failure');

# RT #104794
{
use lib 't/spec/packages';
Expand Down

0 comments on commit 55d2cae

Please sign in to comment.