1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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
This commit is contained in:
hsbt 2014-02-18 12:05:09 +00:00
parent da61291a25
commit 93156392dd
9 changed files with 31 additions and 31 deletions

View file

@ -1,3 +1,14 @@
Tue Feb 18 20:48:38 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
* 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.
Tue Feb 18 14:27:18 2014 Shota Fukumori <her@sorah.jp>
* lib/test/unit.rb: Requires minitest < 5.0.0 if Gem is available.

View file

@ -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

View file

@ -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

View file

@ -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))
}

View file

@ -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)

View file

@ -90,7 +90,6 @@ module TestParallel
def test_done
timeout(10) do
@worker_in.puts "run #{TESTS}/ptest_forth.rb test"
i = 0
6.times { @worker_out.gets }
buf = @worker_out.gets
assert_match(/^done (.+?)$/, buf)

View file

@ -184,7 +184,6 @@ class WEBrick::TestFileHandler < Test::Unit::TestCase
def test_directory_traversal
config = { :DocumentRoot => File.dirname(__FILE__), }
this_file = File.basename(__FILE__)
TestWEBrick.start_httpserver(config) do |server, addr, port, log|
http = Net::HTTP.new(addr, port)
req = Net::HTTP::Get.new("/../../")
@ -199,7 +198,6 @@ class WEBrick::TestFileHandler < Test::Unit::TestCase
def test_unwise_in_path
if windows?
config = { :DocumentRoot => File.dirname(__FILE__), }
this_file = File.basename(__FILE__)
TestWEBrick.start_httpserver(config) do |server, addr, port, log|
http = Net::HTTP.new(addr, port)
req = Net::HTTP::Get.new("/..%5c..")

View file

@ -16,11 +16,11 @@ class Test_Features < Test::Unit::TestCase
XMLRPC::Config.module_eval {remove_const(:ENABLE_NIL_CREATE)}
XMLRPC::Config.const_set(:ENABLE_NIL_CREATE, false)
assert_raise(RuntimeError) { str = c.methodCall("test", *@params) }
assert_raise(RuntimeError) { c.methodCall("test", *@params) }
XMLRPC::Config.module_eval {remove_const(:ENABLE_NIL_CREATE)}
XMLRPC::Config.const_set(:ENABLE_NIL_CREATE, true)
assert_nothing_raised { str = c.methodCall("test", *@params) }
assert_nothing_raised { c.methodCall("test", *@params) }
end
end

View file

@ -162,7 +162,7 @@ if defined? Zlib
assert_equal(false, z.closed?)
z << "foo"
assert_equal(false, z.closed?)
s = z.finish
z.finish
assert_equal(false, z.closed?)
z.close
assert_equal(true, z.closed?)
@ -309,9 +309,6 @@ if defined? Zlib
def test_inflate_partial_input
deflated = Zlib::Deflate.deflate "\0"
a = deflated[0...2]
b = deflated[2..-1]
z = Zlib::Inflate.new
inflated = ""