Skip to content

Commit cf93c5a

Browse files
committed
[v6.d REVIEW] Fix up fh-close-on-exit tests
The first write to a handle is unbuffered, so the original test likely doesn't cover the bug. Orig: 08ac054de
1 parent 2b3f279 commit cf93c5a

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

S32-io/io-handle.t

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,10 +215,13 @@ given make-temp-file() {
215215
subtest 'opened filehandles get closed on exit automatically' => {
216216
plan 2;
217217
my $path = make-temp-file;
218-
is_run $path.perl ~ .open(:w, :5000out-buffer).print: 'pass'; print 'pass',
219-
{:out<pass>, :err(''), :0status}, 'written into a file without closing';
218+
is_run my $fh := ~ $path.perl ~ .open: :w, :5000out-buffer;
219+
$fh.print: 'pass'; $fh.print: '-pass2';
220+
print 'pass'
221+
, {:out<pass>, :err(''), :0status}, 'written into a file without closing';
220222

221-
is-deeply $path.slurp, 'pass', 'file has all the content we wrote into it';
223+
is-deeply $path.slurp, 'pass-pass2',
224+
'file has all the content we wrote into it';
222225
}
223226

224227
{ # RT #131858

0 commit comments

Comments
 (0)