summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-02-11 07:51:53 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-02-11 07:51:53 +0000
commit239763b34265b28057748c120db030bc3576cb8e (patch)
treec4fca19ab1a781f28f36c12c02c018fece547b3f /test
parenta5a3502e7537f495a007de32c527b3b0f1fbbf4e (diff)
downloadruby-239763b34265b28057748c120db030bc3576cb8e.tar.gz
ruby-239763b34265b28057748c120db030bc3576cb8e.tar.xz
ruby-239763b34265b28057748c120db030bc3576cb8e.zip
* ext/socket/lib/socket.rb (Socket.unix_server_socket): call the block
if given. remove the socket file when the block exits. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@22233 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/socket/test_unix.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/socket/test_unix.rb b/test/socket/test_unix.rb
index d3b17450f..2b1f4deb3 100644
--- a/test/socket/test_unix.rb
+++ b/test/socket/test_unix.rb
@@ -296,6 +296,17 @@ class TestSocket_UNIXSocket < Test::Unit::TestCase
}
end
+ def test_unix_server_socket
+ Dir.mktmpdir {|d|
+ path = "#{d}/sock"
+ Socket.unix_server_socket(path) {|s|
+ assert_equal(path, s.local_address.unix_path)
+ assert(File.socket?(path))
+ }
+ assert_raise(Errno::ENOENT) { File.stat path }
+ }
+ end
+
def test_getcred_ucred
return if /linux/ !~ RUBY_PLATFORM
Dir.mktmpdir {|d|