mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
test/fiber/test_io_buffer.rb: fix file descriptor leaks
I got the warning while running "make test-all": Leaked file descriptor: TestFiberIOBuffer#test_write_nonblock: 9 : #<UNIXSocket:fd 9> Closed file descriptor: TestFiberIOBuffer#test_read_write_blocking: 9 Leaked file descriptor: TestFiberIOBuffer#test_timeout_after: 10 : #<UNIXSocket:fd 10> Closed file descriptor: TestFiberIOBuffer#test_read_nonblock: 10
This commit is contained in:
parent
ac757b218c
commit
6b67f06312
1 changed files with 12 additions and 1 deletions
|
@ -36,6 +36,9 @@ class TestFiberIOBuffer < Test::Unit::TestCase
|
|||
assert_equal MESSAGE, message
|
||||
assert_predicate(i, :closed?)
|
||||
assert_predicate(o, :closed?)
|
||||
ensure
|
||||
i&.close
|
||||
o&.close
|
||||
end
|
||||
|
||||
def test_timeout_after
|
||||
|
@ -67,6 +70,9 @@ class TestFiberIOBuffer < Test::Unit::TestCase
|
|||
|
||||
assert_nil message
|
||||
assert_kind_of Timeout::Error, error
|
||||
ensure
|
||||
i&.close
|
||||
o&.close
|
||||
end
|
||||
|
||||
def test_read_nonblock
|
||||
|
@ -89,7 +95,9 @@ class TestFiberIOBuffer < Test::Unit::TestCase
|
|||
thread.join
|
||||
|
||||
assert_equal :wait_readable, message
|
||||
o.close
|
||||
ensure
|
||||
i&.close
|
||||
o&.close
|
||||
end
|
||||
|
||||
def test_write_nonblock
|
||||
|
@ -110,5 +118,8 @@ class TestFiberIOBuffer < Test::Unit::TestCase
|
|||
thread.join
|
||||
|
||||
assert_equal MESSAGE, i.read
|
||||
ensure
|
||||
i&.close
|
||||
o&.close
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue