Skip to content

Instantly share code, notes, and snippets.

@zoffixznet

zoffixznet/p6.p6 Secret

Created October 24, 2017 21:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zoffixznet/62f1f45c6afb32a83721a52b745466f4 to your computer and use it in GitHub Desktop.
Save zoffixznet/62f1f45c6afb32a83721a52b745466f4 to your computer and use it in GitHub Desktop.
subtest $desc => {
$path.IO.spurt: $code;
if shell :in, :out, :err, $script -> $_ {
plan 3;
# on MacOS, `script` really wants the ending newline...
.in.spurt: "$in\n", :close;
cmp-ok .out.slurp(:close), '~~', $out, 'STDOUT';
cmp-ok .err.slurp(:close), '~~', $err, 'STDERR';
cmp-ok .exitcode, '~~', $status, 'exit code';
}
else {
plan 1;
flunk "Failed to run command; exitcode: $^proc.exitcode()";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment