diff options
Diffstat (limited to 'test/socket/test_unix.rb')
-rw-r--r-- | test/socket/test_unix.rb | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/test/socket/test_unix.rb b/test/socket/test_unix.rb index 19efb32219..faf70f2e19 100644 --- a/test/socket/test_unix.rb +++ b/test/socket/test_unix.rb @@ -542,7 +542,11 @@ class TestSocket_UNIXSocket < Test::Unit::TestCase s0 = s UNIXSocket.open(name) {|c| sock = s.accept - assert_equal(name, c.remote_address.unix_path) + begin + assert_equal(name, c.remote_address.unix_path) + ensure + sock.close + end } } assert(s0.closed?) @@ -565,7 +569,30 @@ class TestSocket_UNIXSocket < Test::Unit::TestCase s0 = s Socket.unix(name) {|c| sock, = s.accept - assert_equal(name, c.remote_address.unix_path) + begin + assert_equal(name, c.remote_address.unix_path) + ensure + sock.close + end + } + } + assert(s0.closed?) + end + + def test_autobind + return if /linux/ !~ RUBY_PLATFORM + s0 = nil + Socket.unix_server_socket("") {|s| + name = s.local_address.unix_path + assert_match(/\A\0[0-9a-f]{5}\z/, name) + s0 = s + Socket.unix(name) {|c| + sock, = s.accept + begin + assert_equal(name, c.remote_address.unix_path) + ensure + sock.close + end } } assert(s0.closed?) |