diff options
author | Kazuki Yamaguchi <[email protected]> | 2021-12-20 23:59:34 +0900 |
---|---|---|
committer | Kazuki Yamaguchi <[email protected]> | 2021-12-21 00:05:24 +0900 |
commit | 6b67f0631284b1be8e56e20ec133a1b3386fc090 (patch) | |
tree | af242a6473c2e9b95c93d5b03c2a9f837822a766 /test/fiber/test_io_buffer.rb | |
parent | ac757b218c66569be6789144b149d6d798c72d98 (diff) |
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
Diffstat (limited to 'test/fiber/test_io_buffer.rb')
-rw-r--r-- | test/fiber/test_io_buffer.rb | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/test/fiber/test_io_buffer.rb b/test/fiber/test_io_buffer.rb index e48764242f..5b34a37331 100644 --- a/test/fiber/test_io_buffer.rb +++ b/test/fiber/test_io_buffer.rb @@ -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 |