aboutsummaryrefslogtreecommitdiffstats
path: root/test/socket
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-04-14 10:03:43 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-04-14 10:03:43 +0000
commit437437e3408802381f07e137ba87c0842cc2f06f (patch)
treed36a7df343b59eee17a9980f067013e25661ff26 /test/socket
parent0f14367e970c153b5f250f4fee964e3feae3b3ca (diff)
downloadruby-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/socket')
-rw-r--r--test/socket/test_tcp.rb9
-rw-r--r--test/socket/test_udp.rb11
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