Skip to content

Commit 4f5589b

Browse files
committed
[io grant] Add test for handle leak in IO::Path.lines
1 parent f3d1f67 commit 4f5589b

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

S16-io/lines.t

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ my @endings =
1414
## adjusted plan to allow fine grained fudging for rakudo.jvm
1515
#plan @endings * (1 + 3 * ( (3 * 5) + 6));
1616
my $extra_tests_jvm_fudging = 2 * 3 * ( 3 * ( 6 + 2 ) );
17-
plan 7 + @endings * (1 + 3 * ( 5 + 6)) + $extra_tests_jvm_fudging;
17+
plan 8 + @endings * (1 + 3 * ( 5 + 6)) + $extra_tests_jvm_fudging;
1818

1919
my $filename = 't/spec/S16-io/lines.testing';
2020
my @text = <zero one two three four>;
@@ -317,4 +317,21 @@ subtest '$limit works right with any combination of args' => {
317317
}
318318
}
319319
}
320+
321+
{
322+
my $file = make-temp-file :content("foo\nbar\nber\nmeow\nPerl 6");
323+
# we spin up another perl6 and do 1500 x 2 .lines calls; if the handle
324+
# isn't closed; we can expect some errors to show up in the output
325+
is_run my $i = 0; my @lines; with ~ $file.perl ~ {
326+
use fatal;
327+
loop {
328+
last if ++$i > 1500;
329+
@lines.append: .lines;
330+
@lines.append: .lines(2);
331+
}
332+
}; print "all ok $i",
333+
{:err(''), :out('all ok 1501'), :0status},
334+
'heuristic for testing whether handle is closed';
335+
}
336+
320337
# vim: ft=perl6

0 commit comments

Comments
 (0)