summaryrefslogtreecommitdiff
path: root/test/socket
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-02-18 12:05:09 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-02-18 12:05:09 +0000
commit93156392dd4a80e1ee61a52c6a227845043a8026 (patch)
tree068176611e7b068e08521ac6d625750759e98c29 /test/socket
parentda61291a25faae95f33de6756b2eaa4804d5ef2b (diff)
* test/socket/test_addrinfo.rb: remove unused variables.
* test/socket/test_nonblock.rb: ditto. * test/socket/test_socket.rb: ditto. * test/socket/test_unix.rb: ditto. * test/testunit/test_parallel.rb: ditto. * test/webrick/test_filehandler.rb: ditto. * test/xmlrpc/test_features.rb: ditto. * test/zlib/test_zlib.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45034 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/socket')
-rw-r--r--test/socket/test_addrinfo.rb4
-rw-r--r--test/socket/test_nonblock.rb13
-rw-r--r--test/socket/test_socket.rb9
-rw-r--r--test/socket/test_unix.rb13
4 files changed, 17 insertions, 22 deletions
diff --git a/test/socket/test_addrinfo.rb b/test/socket/test_addrinfo.rb
index 5bd7e2a..61b889e 100644
--- a/test/socket/test_addrinfo.rb
+++ b/test/socket/test_addrinfo.rb
@@ -140,7 +140,7 @@ class TestSocketAddrinfo < Test::Unit::TestCase
ai = Addrinfo.new(s1.getsockname)
s2 = Socket.new(:INET, :STREAM, 0)
s2.connect(ai)
- s3, sender_addr = s1.accept
+ s3, _ = s1.accept
s2.send("test-socket-connect", 0)
assert_equal("test-socket-connect", s3.recv(100))
ensure
@@ -166,7 +166,7 @@ class TestSocketAddrinfo < Test::Unit::TestCase
rescue Errno::EISCONN
end
end
- s3, sender_addr = s1.accept
+ s3, _ = s1.accept
s2.send("test-socket-connect-nonblock", 0)
assert_equal("test-socket-connect-nonblock", s3.recv(100))
ensure
diff --git a/test/socket/test_nonblock.rb b/test/socket/test_nonblock.rb
index e395a0a..882e438 100644
--- a/test/socket/test_nonblock.rb
+++ b/test/socket/test_nonblock.rb
@@ -64,8 +64,8 @@ class TestSocketNonblock < Test::Unit::TestCase
mesg, inet_addr = u1.recvfrom_nonblock(100)
assert_equal(4, inet_addr.length)
assert_equal("aaa", mesg)
- af, port, host, addr = inet_addr
- u2_port, u2_addr = Socket.unpack_sockaddr_in(u2.getsockname)
+ _, port, _, _ = inet_addr
+ u2_port, _ = Socket.unpack_sockaddr_in(u2.getsockname)
assert_equal(u2_port, port)
assert_raise(IO::WaitReadable) { u1.recvfrom_nonblock(100) }
u2.send("", 0, u1.getsockname)
@@ -111,8 +111,8 @@ class TestSocketNonblock < Test::Unit::TestCase
IO.select [s1]
mesg, sockaddr = s1.recvfrom_nonblock(100)
assert_equal("aaa", mesg)
- port, addr = Socket.unpack_sockaddr_in(sockaddr)
- s2_port, s2_addr = Socket.unpack_sockaddr_in(s2.getsockname)
+ port, _ = Socket.unpack_sockaddr_in(sockaddr)
+ s2_port, _ = Socket.unpack_sockaddr_in(s2.getsockname)
assert_equal(s2_port, port)
ensure
s1.close if s1
@@ -121,7 +121,7 @@ class TestSocketNonblock < Test::Unit::TestCase
def tcp_pair
serv = TCPServer.new("127.0.0.1", 0)
- af, port, host, addr = serv.addr
+ _, port, _, addr = serv.addr
c = TCPSocket.new(addr, port)
s = serv.accept
if block_given?
@@ -268,7 +268,7 @@ class TestSocketNonblock < Test::Unit::TestCase
def test_connect_nonblock_error
serv = TCPServer.new("127.0.0.1", 0)
- af, port, host, addr = serv.addr
+ _, port, _, _ = serv.addr
c = Socket.new(:INET, :STREAM)
begin
c.connect_nonblock(Socket.sockaddr_in(port, "127.0.0.1"))
@@ -284,7 +284,6 @@ class TestSocketNonblock < Test::Unit::TestCase
serv = Socket.new(:INET, :STREAM)
serv.bind(Socket.sockaddr_in(0, "127.0.0.1"))
serv.listen(5)
- port = serv.local_address.ip_port
begin
s, _ = serv.accept_nonblock
rescue Errno::EWOULDBLOCK
diff --git a/test/socket/test_socket.rb b/test/socket/test_socket.rb
index 5d2d0ae..7380181 100644
--- a/test/socket/test_socket.rb
+++ b/test/socket/test_socket.rb
@@ -359,7 +359,6 @@ class TestSocket < Test::Unit::TestCase
# Mac OS X may sets IFDISABLED as FreeBSD does
ulSIOCGIFFLAGS = 3223349521
ulSIOCGIFINFO_IN6 = 3224398156
- ulSIOCGIFAFLAG_IN6 = 3240126793
ulIFF_POINTOPOINT = 0x10
ulND6_IFF_IFDISABLED = 8
in6_ondireq = ifr_name
@@ -403,7 +402,7 @@ class TestSocket < Test::Unit::TestCase
raise "no response from #{ai.inspect} #{nd6options}ping=#{ping_p}"
end
msg2, addr = s.recvmsg
- msg2, remote_address, local_address = Marshal.load(msg2)
+ msg2, _, _ = Marshal.load(msg2)
assert_equal(msg1, msg2)
assert_equal(ai.ip_address, addr.ip_address)
}
@@ -454,7 +453,7 @@ class TestSocket < Test::Unit::TestCase
Addrinfo.udp("127.0.0.1", 0).bind {|s2|
s1.setsockopt(:SOCKET, :TIMESTAMP, true)
s2.send "a", 0, s1.local_address
- msg, addr, rflags, stamp = s1.recvmsg
+ msg, _, _, stamp = s1.recvmsg
assert_equal("a", msg)
assert(stamp.cmsg_is?(:SOCKET, :TIMESTAMP))
}
@@ -481,7 +480,7 @@ class TestSocket < Test::Unit::TestCase
return
end
s2.send "a", 0, s1.local_address
- msg, addr, rflags, stamp = s1.recvmsg
+ msg, _, _, stamp = s1.recvmsg
assert_equal("a", msg)
assert(stamp.cmsg_is?(:SOCKET, :TIMESTAMPNS))
}
@@ -503,7 +502,7 @@ class TestSocket < Test::Unit::TestCase
Addrinfo.udp("127.0.0.1", 0).bind {|s2|
s1.setsockopt(:SOCKET, :BINTIME, true)
s2.send "a", 0, s1.local_address
- msg, addr, rflags, stamp = s1.recvmsg
+ msg, _, _, stamp = s1.recvmsg
assert_equal("a", msg)
assert(stamp.cmsg_is?(:SOCKET, :BINTIME))
}
diff --git a/test/socket/test_unix.rb b/test/socket/test_unix.rb
index 38d8333..8b6b705 100644
--- a/test/socket/test_unix.rb
+++ b/test/socket/test_unix.rb
@@ -52,7 +52,7 @@ class TestSocket_UNIXSocket < Test::Unit::TestCase
end
assert_equal(1, ret)
ret = s2.recvmsg(:scm_rights=>true)
- data, srcaddr, flags, *ctls = ret
+ _, _, _, *ctls = ret
recv_io_ary = []
ctls.each {|ctl|
next if ctl.level != Socket::SOL_SOCKET || ctl.type != Socket::SCM_RIGHTS
@@ -89,7 +89,7 @@ class TestSocket_UNIXSocket < Test::Unit::TestCase
end
assert_equal(1, ret)
ret = s2.recvmsg(:scm_rights=>true)
- data, srcaddr, flags, *ctls = ret
+ _, _, _, *ctls = ret
recv_io_ary = []
ctls.each {|ctl|
next if ctl.level != Socket::SOL_SOCKET || ctl.type != Socket::SCM_RIGHTS
@@ -399,7 +399,6 @@ class TestSocket_UNIXSocket < Test::Unit::TestCase
end
def test_unix_socket_pair_close_on_exec
- pair = nil
UNIXSocket.pair {|s1, s2|
assert(s1.close_on_exec?)
assert(s2.close_on_exec?)
@@ -442,7 +441,6 @@ class TestSocket_UNIXSocket < Test::Unit::TestCase
Dir.mktmpdir {|d|
sockpath = "#{d}/sock"
serv = Socket.unix_server_socket(sockpath)
- c = Socket.unix(sockpath)
s, = serv.accept
cred = s.getsockopt(:SOCKET, :PEERCRED)
inspect = cred.inspect
@@ -458,7 +456,6 @@ class TestSocket_UNIXSocket < Test::Unit::TestCase
Dir.mktmpdir {|d|
sockpath = "#{d}/sock"
serv = Socket.unix_server_socket(sockpath)
- c = Socket.unix(sockpath)
s, = serv.accept
cred = s.getsockopt(0, Socket::LOCAL_PEERCRED)
inspect = cred.inspect
@@ -476,7 +473,7 @@ class TestSocket_UNIXSocket < Test::Unit::TestCase
s, = serv.accept
s.setsockopt(:SOCKET, :PASSCRED, 1)
c.print "a"
- msg, cliend_ai, rflags, cred = s.recvmsg
+ msg, _, _, cred = s.recvmsg
inspect = cred.inspect
assert_equal("a", msg)
assert_match(/ pid=#{$$} /, inspect)
@@ -495,7 +492,7 @@ class TestSocket_UNIXSocket < Test::Unit::TestCase
s, = serv.accept
s.setsockopt(0, Socket::LOCAL_CREDS, 1)
c.print "a"
- msg, cliend_ai, rflags, cred = s.recvmsg
+ msg, _, _, cred = s.recvmsg
assert_equal("a", msg)
inspect = cred.inspect
assert_match(/ uid=#{Process.uid} /, inspect)
@@ -514,7 +511,7 @@ class TestSocket_UNIXSocket < Test::Unit::TestCase
c = Socket.unix(sockpath)
s, = serv.accept
c.sendmsg("a", 0, nil, [:SOCKET, Socket::SCM_CREDS, ""])
- msg, cliend_ai, rflags, cred = s.recvmsg
+ msg, _, _, cred = s.recvmsg
assert_equal("a", msg)
inspect = cred.inspect
assert_match(/ pid=#{$$} /, inspect)