Skip to content

Commit

Permalink
[v6.d REVIEW] Actually test slurp content in bin pipes
Browse files Browse the repository at this point in the history
Orig: 29582e15c
  • Loading branch information
zoffixznet committed Sep 16, 2018
1 parent a767b1c commit f477dbf
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions S32-io/pipe.t
@@ -1,5 +1,7 @@
use v6;
use lib $?FILE.IO.parent(2).add: 'packages';
use Test;
use Test::Util;

plan 20;

Expand Down Expand Up @@ -67,16 +69,19 @@ with run(:out, $*EXECUTABLE, '-e', '') -> $proc {
}
}

{
lives-ok {
my $p = run :bin, :out, :err, :in, $*EXECUTABLE, '-e',
'my $v = $*IN.get; note $v; say $v';
$p.in.write: "42\n".encode;
$p.in.flush;
$p.in.close;
$p.out.slurp(:close);
$p.err.slurp(:close);
}, 'bin pipes in Proc do not crash on open';
group-of 3 => 'bin pipes in Proc do not crash on open' => {
my ($stdout, $stderr);
lives-ok {
my $p = run :bin, :out, :err, :in, $*EXECUTABLE, '-e',
'my $v = $*IN.get; note $v.flip; say $v';
$p.in.write: "42\n".encode;
$p.in.flush;
$p.in.close;
$stdout = $p.out.slurp(:close).decode;
$stderr = $p.err.slurp(:close).decode;
}, 'no crashes';
is $stdout, "42\n", 'STDOUT is right';
is $stderr, "24\n", 'STDERR is right';
}

# RT #129882
Expand Down

0 comments on commit f477dbf

Please sign in to comment.