summaryrefslogtreecommitdiff
path: root/test/socket
diff options
context:
space:
mode:
Diffstat (limited to 'test/socket')
-rw-r--r--test/socket/test_unix.rb30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/socket/test_unix.rb b/test/socket/test_unix.rb
index 1c5395e380..a44ef2de38 100644
--- a/test/socket/test_unix.rb
+++ b/test/socket/test_unix.rb
@@ -531,4 +531,34 @@ class TestSocket_UNIXSocket < Test::Unit::TestCase
}
end
+ def test_abstract_unix_server
+ return if /linux/ !~ RUBY_PLATFORM
+ name = "\0ruby-test_unix"
+ s0 = nil
+ UNIXServer.open(name) {|s|
+ assert_equal(name, s.local_address.unix_path)
+ s0 = s
+ UNIXSocket.open(name) {|c|
+ sock = s.accept
+ assert_equal(name, c.remote_address.unix_path)
+ }
+ }
+ assert(s0.closed?)
+ end
+
+ def test_abstract_unix_server_socket
+ return if /linux/ !~ RUBY_PLATFORM
+ name = "\0ruby-test_unix"
+ s0 = nil
+ Socket.unix_server_socket(name) {|s|
+ assert_equal(name, s.local_address.unix_path)
+ s0 = s
+ Socket.unix(name) {|c|
+ sock, = s.accept
+ assert_equal(name, c.remote_address.unix_path)
+ }
+ }
+ assert(s0.closed?)
+ end
+
end if defined?(UNIXSocket) && /cygwin/ !~ RUBY_PLATFORM