summaryrefslogtreecommitdiff
path: root/test/socket
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-01-09 11:11:24 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-01-09 11:11:24 +0000
commit268d1a2244b0179848a10a2841b4c037db52d3bd (patch)
treee07df7172bab944345a549c23a463a98ef885755 /test/socket
parent98ddbafb265324e9f89b2546dc85d2b54dac4c43 (diff)
* ext/socket/lib/socket.rb (family_addrinfo): return the given
addrinfo object. Patch by Ippei Obayashi. [ruby-dev:45095] [Bug #5845] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34244 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/socket')
-rw-r--r--test/socket/test_addrinfo.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/socket/test_addrinfo.rb b/test/socket/test_addrinfo.rb
index c0aeba6..3240b9d 100644
--- a/test/socket/test_addrinfo.rb
+++ b/test/socket/test_addrinfo.rb
@@ -352,6 +352,24 @@ class TestSocketAddrinfo < Test::Unit::TestCase
# not test failure
end
}
+
+ TCPServer.open("0.0.0.0", 0) {|serv|
+ serv_ai = Addrinfo.new(serv.getsockname, :INET, :STREAM)
+ serv_ai = tcp_unspecified_to_loopback(serv_ai)
+ port = random_port
+ begin
+ serv_ai.connect_from(Addrinfo.tcp("0.0.0.0", port)) {|s1|
+ s2 = serv.accept
+ begin
+ assert_equal(port, s2.remote_address.ip_port)
+ ensure
+ s2.close
+ end
+ }
+ rescue *errors_addrinuse
+ # not test failure
+ end
+ }
end
def test_connect_to