diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-04-14 10:03:43 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-04-14 10:03:43 +0000 |
commit | 437437e3408802381f07e137ba87c0842cc2f06f (patch) | |
tree | d36a7df343b59eee17a9980f067013e25661ff26 /test | |
parent | 0f14367e970c153b5f250f4fee964e3feae3b3ca (diff) | |
download | ruby-437437e3408802381f07e137ba87c0842cc2f06f.tar.gz |
IPSocket#inspect
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58351 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/socket/test_tcp.rb | 9 | ||||
-rw-r--r-- | test/socket/test_udp.rb | 11 |
2 files changed, 20 insertions, 0 deletions
diff --git a/test/socket/test_tcp.rb b/test/socket/test_tcp.rb index 450d1b35b5..11325fdedb 100644 --- a/test/socket/test_tcp.rb +++ b/test/socket/test_tcp.rb @@ -8,6 +8,15 @@ end class TestSocket_TCPSocket < Test::Unit::TestCase + def test_inspect + TCPServer.open("localhost", 0) {|server| + assert_match(/AF_INET/, server.inspect) + TCPSocket.open("localhost", server.addr[1]) {|client| + assert_match(/AF_INET/, client.inspect) + } + } + end + def test_initialize_failure # These addresses are chosen from TEST-NET-1, TEST-NET-2, and TEST-NET-3. # [RFC 5737] diff --git a/test/socket/test_udp.rb b/test/socket/test_udp.rb index 5b23cce288..bec2181918 100644 --- a/test/socket/test_udp.rb +++ b/test/socket/test_udp.rb @@ -15,6 +15,17 @@ class TestSocket_UDPSocket < Test::Unit::TestCase assert_nothing_raised { UDPSocket.open(:AF_INET) {} } end + def test_inspect + UDPSocket.open() {|sock| + assert_match(/AF_INET\b/, sock.inspect) + } + if Socket.const_defined?(:AF_INET6) + UDPSocket.open(Socket::AF_INET6) {|sock| + assert_match(/AF_INET6\b/, sock.inspect) + } + end + end + def test_connect s = UDPSocket.new host = Object.new |