summaryrefslogtreecommitdiff
path: root/test/ruby/test_argf.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-12-27 07:18:27 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-12-27 07:18:27 +0000
commit2fbc63b8a8a7a72bd986a37ab423d4d87f54ae12 (patch)
treeb534ecbe690c705d909f65b9ee7648eab634f063 /test/ruby/test_argf.rb
parentbc855ef1391bb79ca3554f67ae2d3aad19178d94 (diff)
io.c: ARGF fd leak
* io.c (argf_next_argv): fix leak of fd after breaking in #each method. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57203 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_argf.rb')
-rw-r--r--test/ruby/test_argf.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/test/ruby/test_argf.rb b/test/ruby/test_argf.rb
index fdd31c630a..d6aa8f7295 100644
--- a/test/ruby/test_argf.rb
+++ b/test/ruby/test_argf.rb
@@ -137,7 +137,7 @@ class TestArgf < Test::Unit::TestCase
INPUT
end
- def test_new_lineno
+ def test_new_lineno_each
f = ARGF.class.new(@t1.path, @t2.path, @t3.path)
result = []
f.each {|line| result << [f.lineno, line]; break if result.size == 3}
@@ -146,10 +146,16 @@ class TestArgf < Test::Unit::TestCase
f.rewind
assert_equal(2, f.lineno)
+ ensure
+ f.close
+ end
+ def test_new_lineno_each_char
f = ARGF.class.new(@t1.path, @t2.path, @t3.path)
f.each_char.to_a
assert_equal(0, f.lineno)
+ ensure
+ f.close
end
def test_inplace