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
@ -36,6 +36,9 @@ class TestFiberIOBuffer < Test::Unit::TestCase
|
|||||||
assert_equal MESSAGE, message
|
assert_equal MESSAGE, message
|
||||||
assert_predicate(i, :closed?)
|
assert_predicate(i, :closed?)
|
||||||
assert_predicate(o, :closed?)
|
assert_predicate(o, :closed?)
|
||||||
|
ensure
|
||||||
|
i&.close
|
||||||
|
o&.close
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_timeout_after
|
def test_timeout_after
|
||||||
@ -67,6 +70,9 @@ class TestFiberIOBuffer < Test::Unit::TestCase
|
|||||||
|
|
||||||
assert_nil message
|
assert_nil message
|
||||||
assert_kind_of Timeout::Error, error
|
assert_kind_of Timeout::Error, error
|
||||||
|
ensure
|
||||||
|
i&.close
|
||||||
|
o&.close
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_read_nonblock
|
def test_read_nonblock
|
||||||
@ -89,7 +95,9 @@ class TestFiberIOBuffer < Test::Unit::TestCase
|
|||||||
thread.join
|
thread.join
|
||||||
|
|
||||||
assert_equal :wait_readable, message
|
assert_equal :wait_readable, message
|
||||||
o.close
|
ensure
|
||||||
|
i&.close
|
||||||
|
o&.close
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_write_nonblock
|
def test_write_nonblock
|
||||||
@ -110,5 +118,8 @@ class TestFiberIOBuffer < Test::Unit::TestCase
|
|||||||
thread.join
|
thread.join
|
||||||
|
|
||||||
assert_equal MESSAGE, i.read
|
assert_equal MESSAGE, i.read
|
||||||
|
ensure
|
||||||
|
i&.close
|
||||||
|
o&.close
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user