From 0a954e9117168f0221b7cfd833b1e2ea6243ba16 Mon Sep 17 00:00:00 2001 From: akr Date: Wed, 11 Feb 2009 07:51:53 +0000 Subject: * 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@22233 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/socket/test_unix.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test/socket') diff --git a/test/socket/test_unix.rb b/test/socket/test_unix.rb index d3b17450f1..2b1f4deb33 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| -- cgit v1.2.3