[前][次][番号順一覧][スレッド一覧]

ruby-changes:32955

From: hsbt <ko1@a...>
Date: Tue, 18 Feb 2014 21:05:16 +0900 (JST)
Subject: [ruby-changes:32955] hsbt:r45034 (trunk): * test/socket/test_addrinfo.rb: remove unused variables.

hsbt	2014-02-18 21:05:09 +0900 (Tue, 18 Feb 2014)

  New Revision: 45034

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=45034

  Log:
    * 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.

  Modified files:
    trunk/ChangeLog
    trunk/test/socket/test_addrinfo.rb
    trunk/test/socket/test_nonblock.rb
    trunk/test/socket/test_socket.rb
    trunk/test/socket/test_unix.rb
    trunk/test/testunit/test_parallel.rb
    trunk/test/webrick/test_filehandler.rb
    trunk/test/xmlrpc/test_features.rb
    trunk/test/zlib/test_zlib.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 45033)
+++ ChangeLog	(revision 45034)
@@ -1,3 +1,14 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue Feb 18 20:48:38 2014  SHIBATA Hiroshi  <shibata.hiroshi@g...>
+
+	* 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@s...>
 
 	* lib/test/unit.rb: Requires minitest < 5.0.0 if Gem is available.
Index: test/zlib/test_zlib.rb
===================================================================
--- test/zlib/test_zlib.rb	(revision 45033)
+++ test/zlib/test_zlib.rb	(revision 45034)
@@ -162,7 +162,7 @@ if defined? Zlib https://github.com/ruby/ruby/blob/trunk/test/zlib/test_zlib.rb#L162
       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 https://github.com/ruby/ruby/blob/trunk/test/zlib/test_zlib.rb#L309
     def test_inflate_partial_input
       deflated = Zlib::Deflate.deflate "\0"
 
-      a = deflated[0...2]
-      b = deflated[2..-1]
-
       z = Zlib::Inflate.new
 
       inflated = ""
Index: test/xmlrpc/test_features.rb
===================================================================
--- test/xmlrpc/test_features.rb	(revision 45033)
+++ test/xmlrpc/test_features.rb	(revision 45034)
@@ -16,11 +16,11 @@ class Test_Features < Test::Unit::TestCa https://github.com/ruby/ruby/blob/trunk/test/xmlrpc/test_features.rb#L16
 
       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
 
Index: test/testunit/test_parallel.rb
===================================================================
--- test/testunit/test_parallel.rb	(revision 45033)
+++ test/testunit/test_parallel.rb	(revision 45034)
@@ -90,7 +90,6 @@ module TestParallel https://github.com/ruby/ruby/blob/trunk/test/testunit/test_parallel.rb#L90
     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)
Index: test/webrick/test_filehandler.rb
===================================================================
--- test/webrick/test_filehandler.rb	(revision 45033)
+++ test/webrick/test_filehandler.rb	(revision 45034)
@@ -184,7 +184,6 @@ class WEBrick::TestFileHandler < Test::U https://github.com/ruby/ruby/blob/trunk/test/webrick/test_filehandler.rb#L184
 
   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::U https://github.com/ruby/ruby/blob/trunk/test/webrick/test_filehandler.rb#L198
   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..")
Index: test/socket/test_unix.rb
===================================================================
--- test/socket/test_unix.rb	(revision 45033)
+++ test/socket/test_unix.rb	(revision 45034)
@@ -52,7 +52,7 @@ class TestSocket_UNIXSocket < Test::Unit https://github.com/ruby/ruby/blob/trunk/test/socket/test_unix.rb#L52
         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 https://github.com/ruby/ruby/blob/trunk/test/socket/test_unix.rb#L89
         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 https://github.com/ruby/ruby/blob/trunk/test/socket/test_unix.rb#L399
   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 https://github.com/ruby/ruby/blob/trunk/test/socket/test_unix.rb#L441
     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 https://github.com/ruby/ruby/blob/trunk/test/socket/test_unix.rb#L456
     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 https://github.com/ruby/ruby/blob/trunk/test/socket/test_unix.rb#L473
       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 https://github.com/ruby/ruby/blob/trunk/test/socket/test_unix.rb#L492
       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 https://github.com/ruby/ruby/blob/trunk/test/socket/test_unix.rb#L511
       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)
Index: test/socket/test_nonblock.rb
===================================================================
--- test/socket/test_nonblock.rb	(revision 45033)
+++ test/socket/test_nonblock.rb	(revision 45034)
@@ -64,8 +64,8 @@ class TestSocketNonblock < Test::Unit::T https://github.com/ruby/ruby/blob/trunk/test/socket/test_nonblock.rb#L64
     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::T https://github.com/ruby/ruby/blob/trunk/test/socket/test_nonblock.rb#L111
     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::T https://github.com/ruby/ruby/blob/trunk/test/socket/test_nonblock.rb#L121
 
   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::T https://github.com/ruby/ruby/blob/trunk/test/socket/test_nonblock.rb#L268
 
   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::T https://github.com/ruby/ruby/blob/trunk/test/socket/test_nonblock.rb#L284
     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
Index: test/socket/test_addrinfo.rb
===================================================================
--- test/socket/test_addrinfo.rb	(revision 45033)
+++ test/socket/test_addrinfo.rb	(revision 45034)
@@ -140,7 +140,7 @@ class TestSocketAddrinfo < Test::Unit::T https://github.com/ruby/ruby/blob/trunk/test/socket/test_addrinfo.rb#L140
     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::T https://github.com/ruby/ruby/blob/trunk/test/socket/test_addrinfo.rb#L166
       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
Index: test/socket/test_socket.rb
===================================================================
--- test/socket/test_socket.rb	(revision 45033)
+++ test/socket/test_socket.rb	(revision 45034)
@@ -359,7 +359,6 @@ class TestSocket < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/socket/test_socket.rb#L359
             # 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 https://github.com/ruby/ruby/blob/trunk/test/socket/test_socket.rb#L402
               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 https://github.com/ruby/ruby/blob/trunk/test/socket/test_socket.rb#L453
       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 https://github.com/ruby/ruby/blob/trunk/test/socket/test_socket.rb#L480
           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 https://github.com/ruby/ruby/blob/trunk/test/socket/test_socket.rb#L502
       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))
       }

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]