From 824cb6905896131031c4f712e6cb55f76fc9ad1f Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 29 Mar 2013 07:51:43 +0000 Subject: io.c: get rid of IOError when skipped while iteration * io.c (argf_next_argv): set init flag if succeeded to forward, after skipping. * io.c (argf_block_call_i, argf_block_call): no more forwarding if forwarded after skipping. [ruby-list:49185] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39997 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_argf.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'test/ruby/test_argf.rb') diff --git a/test/ruby/test_argf.rb b/test/ruby/test_argf.rb index 979b66765b..1abcd604fd 100644 --- a/test/ruby/test_argf.rb +++ b/test/ruby/test_argf.rb @@ -689,6 +689,11 @@ class TestArgf < Test::Unit::TestCase SRC assert_equal("1\n3\n5\n", f.read, '[ruby-list:49185]') end + ruby('-e', <<-SRC, @t1.path, @t2.path, @t3.path) do |f| + ARGF.each_line {|l| ARGF.skip; puts [l, ARGF.gets].map {|s| s ? s.chomp : s.inspect}.join("+")} + SRC + assert_equal("1+3\n4+5\n6+nil\n", f.read, '[ruby-list:49185]') + end end def test_skip_in_each_byte -- cgit v1.2.3