Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
added tests for RT #122963 IO::Handle.lines doesn't properly count .ins
  • Loading branch information
labster committed Apr 24, 2015
1 parent cce24c2 commit 33fc3d4
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion S16-filehandles/io_in_for_loops.t
Expand Up @@ -5,7 +5,7 @@ use Test;
# old: L<S16/"Filehandles, files, and directories"/"open">
# old: L<S16/"Filehandles, files, and directories"/"close">

plan 29;
plan 33;

my $filename = 'tempfile_io_in_for_loop';

Expand Down Expand Up @@ -93,6 +93,20 @@ my $filename = 'tempfile_io_in_for_loop';
$fh.close();
}

# RT #122963
{ # now read it without using the value, just using as loop control
my $fh = open($filename);
for $fh.lines() {
is $fh.ins, 1, "\$fh.lines loop sets .ins";
is $fh.tell, 2, "\$fh.lines loop sets .tell";
last;
}
is $fh.ins, 1, "last in loop leaves .ins at the same place";
is $fh.tell, 2, "last in loop leaves .tell at the same place";
$fh.close();
}


# old: L<S16/"Filehandles, files, and directories"/"unlink">
# L<S29/IO/unlink>

Expand Down

0 comments on commit 33fc3d4

Please sign in to comment.