diff options
| author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-12-31 15:05:16 +0000 |
|---|---|---|
| committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-12-31 15:05:16 +0000 |
| commit | 46d690d89133e89fe7505095e4d0f97f6aebd02c (patch) | |
| tree | 61f7846d781aa023205dc33d3c8af5f68ae3d717 /test/socket | |
| parent | 81ddb2bbc5c1857d76ce1ed28db9ec3997d0abbb (diff) | |
| download | ruby-46d690d89133e89fe7505095e4d0f97f6aebd02c.tar.gz ruby-46d690d89133e89fe7505095e4d0f97f6aebd02c.tar.xz ruby-46d690d89133e89fe7505095e4d0f97f6aebd02c.zip | |
* ext/socket/socket.c (sock_s_socketpair): yield if a block is given.
(io_call_close): defined.
(io_close): defined.
(pair_yield): defined.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@21216 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/socket')
| -rw-r--r-- | test/socket/test_unix.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/socket/test_unix.rb b/test/socket/test_unix.rb index 58350c448..5b041f173 100644 --- a/test/socket/test_unix.rb +++ b/test/socket/test_unix.rb @@ -146,4 +146,24 @@ class TestUNIXSocket < Test::Unit::TestCase assert_equal("a", s1.read(1)) end + def test_socket_pair_with_block + pair = nil + ret = Socket.pair(Socket::AF_UNIX, Socket::SOCK_STREAM, 0) {|s1, s2| + pair = [s1, s2] + :return_value + } + assert_equal(:return_value, ret) + assert_kind_of(Socket, pair[0]) + assert_kind_of(Socket, pair[1]) + end + + def test_unix_socket_pair_with_block + pair = nil + UNIXSocket.pair {|s1, s2| + pair = [s1, s2] + } + assert_kind_of(UNIXSocket, pair[0]) + assert_kind_of(UNIXSocket, pair[1]) + end + end if defined?(UNIXSocket) && /cygwin/ !~ RUBY_PLATFORM |
