From 37679ee584e409088a2f083594e3c4ccba486e13 Mon Sep 17 00:00:00 2001 From: akr Date: Mon, 25 Jan 2010 23:12:50 +0000 Subject: supress warnings. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26418 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/erb/test_erb_m17n.rb | 36 ++++++++++++++++++------------------ test/openssl/test_ssl.rb | 2 +- test/ripper/test_parser_events.rb | 4 ++-- test/ruby/test_basicinstructions.rb | 6 +++--- test/ruby/test_beginendblock.rb | 6 +++--- test/ruby/test_enum.rb | 18 +++++++++--------- test/ruby/test_file.rb | 4 ++-- test/ruby/test_file_exhaustive.rb | 2 +- test/ruby/test_hash.rb | 6 +++--- test/ruby/test_integer.rb | 12 ++++++------ test/ruby/test_iterator.rb | 6 +++--- test/ruby/test_literal.rb | 10 +++++----- test/ruby/test_proc.rb | 2 +- test/ruby/test_sprintf_comb.rb | 2 +- test/test_open3.rb | 4 ++-- test/test_prime.rb | 10 +++++----- test/uri/test_ldap.rb | 4 ++-- test/webrick/test_httpproxy.rb | 14 +++++++------- test/xmlrpc/test_webrick_server.rb | 4 ++-- test/xmlrpc/webrick_testing.rb | 2 +- 20 files changed, 77 insertions(+), 77 deletions(-) (limited to 'test') diff --git a/test/erb/test_erb_m17n.rb b/test/erb/test_erb_m17n.rb index 640b1e6c51..ff49228c26 100644 --- a/test/erb/test_erb_m17n.rb +++ b/test/erb/test_erb_m17n.rb @@ -23,35 +23,35 @@ class TestERB < Test::Unit::TestCase def test_generate_magic_comment erb = ERB.new("hello") - assert_match /#coding:UTF-8/, erb.src + assert_match(/#coding:UTF-8/, erb.src) erb = ERB.new("hello".force_encoding("EUC-JP")) - assert_match /#coding:EUC-JP/, erb.src + assert_match(/#coding:EUC-JP/, erb.src) erb = ERB.new("hello".force_encoding("ISO-8859-9")) - assert_match /#coding:ISO-8859-9/, erb.src + assert_match(/#coding:ISO-8859-9/, erb.src) end def test_literal_encoding erb = ERB.new("literal encoding is <%= 'hello'.encoding %>") - assert_match /literal encoding is UTF-8/, erb.result + assert_match(/literal encoding is UTF-8/, erb.result) erb = ERB.new("literal encoding is <%= 'こんにちは'.encoding %>".encode("EUC-JP")) - assert_match /literal encoding is EUC-JP/, erb.result + assert_match(/literal encoding is EUC-JP/, erb.result) erb = ERB.new("literal encoding is <%= '\xC4\xE3\xBA\xC3'.encoding %>".force_encoding("EUC-CN")) - assert_match /literal encoding is GB2312/, erb.result + assert_match(/literal encoding is GB2312/, erb.result) end def test___ENCODING__ erb = ERB.new("__ENCODING__ is <%= __ENCODING__ %>") - assert_match /__ENCODING__ is UTF-8/, erb.result + assert_match(/__ENCODING__ is UTF-8/, erb.result) erb = ERB.new("__ENCODING__ is <%= __ENCODING__ %>".force_encoding("EUC-JP")) - assert_match /__ENCODING__ is EUC-JP/, erb.result + assert_match(/__ENCODING__ is EUC-JP/, erb.result) erb = ERB.new("__ENCODING__ is <%= __ENCODING__ %>".force_encoding("Big5")) - assert_match /__ENCODING__ is Big5/, erb.result + assert_match(/__ENCODING__ is Big5/, erb.result) end def test_recognize_magic_comment @@ -59,35 +59,35 @@ class TestERB < Test::Unit::TestCase <%# -*- coding: EUC-KR -*- %> 안녕하세요 EOS - assert_match /#coding:EUC-KR/, erb.src + assert_match(/#coding:EUC-KR/, erb.src) assert_equal Encoding::EUC_KR, erb.result.encoding erb = ERB.new(<<-EOS.encode("EUC-KR").force_encoding("ASCII-8BIT")) <%#-*- coding: EUC-KR -*-%> 안녕하세요 EOS - assert_match /#coding:EUC-KR/, erb.src + assert_match(/#coding:EUC-KR/, erb.src) assert_equal Encoding::EUC_KR, erb.result.encoding erb = ERB.new(<<-EOS.encode("EUC-KR").force_encoding("ASCII-8BIT")) <%# vim: tabsize=8 encoding=EUC-KR shiftwidth=2 expandtab %> 안녕하세요 EOS - assert_match /#coding:EUC-KR/, erb.src + assert_match(/#coding:EUC-KR/, erb.src) assert_equal Encoding::EUC_KR, erb.result.encoding erb = ERB.new(<<-EOS.encode("EUC-KR").force_encoding("ASCII-8BIT")) <%#coding:EUC-KR %> 안녕하세요 EOS - assert_match /#coding:EUC-KR/, erb.src + assert_match(/#coding:EUC-KR/, erb.src) assert_equal Encoding::EUC_KR, erb.result.encoding erb = ERB.new(<<-EOS.encode("EUC-KR").force_encoding("EUC-JP")) <%#coding:EUC-KR %> 안녕하세요 EOS - assert_match /#coding:EUC-KR/, erb.src + assert_match(/#coding:EUC-KR/, erb.src) assert_equal Encoding::EUC_KR, erb.result.encoding end @@ -105,8 +105,8 @@ __ENCODING__ is <%= __ENCODING__ %> result = obj.m_from_magic_comment assert_equal Encoding::EUC_JP, result.encoding - assert_match /literal encoding is EUC-JP/, result - assert_match /__ENCODING__ is EUC-JP/, result + assert_match(/literal encoding is EUC-JP/, result) + assert_match(/__ENCODING__ is EUC-JP/, result) erb = ERB.new(<<-EOS.encode("EUC-KR")) literal encoding is <%= '안녕하세요'.encoding %> @@ -115,8 +115,8 @@ EOS erb.def_method(M, :m_from_eval_encoding) result = obj.m_from_eval_encoding assert_equal Encoding::EUC_KR, result.encoding - assert_match /literal encoding is EUC-KR/, result - assert_match /__ENCODING__ is EUC-KR/, result + assert_match(/literal encoding is EUC-KR/, result) + assert_match(/__ENCODING__ is EUC-KR/, result) end end diff --git a/test/openssl/test_ssl.rb b/test/openssl/test_ssl.rb index e86b82110b..ef442d41d0 100644 --- a/test/openssl/test_ssl.rb +++ b/test/openssl/test_ssl.rb @@ -571,7 +571,7 @@ class OpenSSL::TestSSL < Test::Unit::TestCase ctx_proc = Proc.new do |ctx, ssl| foo_ctx = ctx.dup - ctx.servername_cb = Proc.new do |ssl, hostname| + ctx.servername_cb = Proc.new do |ssl2, hostname| case hostname when 'foo.example.com' foo_ctx diff --git a/test/ripper/test_parser_events.rb b/test/ripper/test_parser_events.rb index 47bcba03d2..d28328da9d 100644 --- a/test/ripper/test_parser_events.rb +++ b/test/ripper/test_parser_events.rb @@ -366,11 +366,11 @@ class TestRipper::ParserEvents < Test::Unit::TestCase thru_mlhs_add_star = false tree = parse("a, *b = 1, 2", :on_mlhs_add_star) {thru_mlhs_add_star = true} assert_equal true, thru_mlhs_add_star - assert_match /mlhs_add_star\(mlhs_add\(mlhs_new\(\),a\),b\)/, tree + assert_match(/mlhs_add_star\(mlhs_add\(mlhs_new\(\),a\),b\)/, tree) thru_mlhs_add_star = false tree = parse("a, *b, c = 1, 2", :on_mlhs_add_star) {thru_mlhs_add_star = true} assert_equal true, thru_mlhs_add_star - assert_match /mlhs_add\(mlhs_add_star\(mlhs_add\(mlhs_new\(\),a\),b\),mlhs_add\(mlhs_new\(\),c\)\)/, tree, bug2232 + assert_match(/mlhs_add\(mlhs_add_star\(mlhs_add\(mlhs_new\(\),a\),b\),mlhs_add\(mlhs_new\(\),c\)\)/, tree, bug2232) end def test_mlhs_new diff --git a/test/ruby/test_basicinstructions.rb b/test/ruby/test_basicinstructions.rb index 36a3b2b51d..ff14e4a7a6 100644 --- a/test/ruby/test_basicinstructions.rb +++ b/test/ruby/test_basicinstructions.rb @@ -64,7 +64,7 @@ class TestBasicInstructions < Test::Unit::TestCase end def test_regexp - assert_equal /test/, /test/ + assert_equal(/test/, /test/) assert_equal 'test', /test/.source assert_equal 'TEST', /TEST/.source assert_equal true, !!(/test/ =~ 'test') @@ -76,9 +76,9 @@ class TestBasicInstructions < Test::Unit::TestCase assert_equal true, !!(re =~ 'test') assert_equal false, !!(re =~ 'does not match') - assert_equal /x#{1+1}x/, /x#{1+1}x/ + assert_equal(/x#{1+1}x/, /x#{1+1}x/) s = "OK" - assert_equal /x#{s}x/, /x#{s}x/ + assert_equal(/x#{s}x/, /x#{s}x/) assert_equal true, !!(/x#{s}x/ =~ "xOKx") assert_equal false, !!(/x#{s}x/ =~ "does not match") diff --git a/test/ruby/test_beginendblock.rb b/test/ruby/test_beginendblock.rb index 4cfcbb01de..caed180613 100644 --- a/test/ruby/test_beginendblock.rb +++ b/test/ruby/test_beginendblock.rb @@ -80,8 +80,8 @@ EOW '-e', 'raise %[SomethingElse]']) {|f| f.read } - assert_match /SomethingBad/, out, "[ruby-core:9675]" - assert_match /SomethingElse/, out, "[ruby-core:9675]" + assert_match(/SomethingBad/, out, "[ruby-core:9675]") + assert_match(/SomethingElse/, out, "[ruby-core:9675]") end def test_should_propagate_exit_code @@ -99,7 +99,7 @@ EOW '-e', 'at_exit{Process.kill(:INT, $$); loop{}}']) {|f| f.read } - assert_match /Interrupt$/, out + assert_match(/Interrupt$/, out) Process.kill(0, 0) rescue return # check if signal works assert_nil $?.exitstatus assert_equal Signal.list["INT"], $?.termsig diff --git a/test/ruby/test_enum.rb b/test/ruby/test_enum.rb index 4a594545e3..d252cef426 100644 --- a/test/ruby/test_enum.rb +++ b/test/ruby/test_enum.rb @@ -143,27 +143,27 @@ class TestEnumerable < Test::Unit::TestCase def test_min assert_equal(1, @obj.min) assert_equal(3, @obj.min {|a,b| b <=> a }) - a = %w(albatross dog horse) - assert_equal("albatross", a.min) - assert_equal("dog", a.min {|a,b| a.length <=> b.length }) + ary = %w(albatross dog horse) + assert_equal("albatross", ary.min) + assert_equal("dog", ary.min {|a,b| a.length <=> b.length }) assert_equal(1, [3,2,1].min) end def test_max assert_equal(3, @obj.max) assert_equal(1, @obj.max {|a,b| b <=> a }) - a = %w(albatross dog horse) - assert_equal("horse", a.max) - assert_equal("albatross", a.max {|a,b| a.length <=> b.length }) + ary = %w(albatross dog horse) + assert_equal("horse", ary.max) + assert_equal("albatross", ary.max {|a,b| a.length <=> b.length }) assert_equal(1, [3,2,1].max{|a,b| b <=> a }) end def test_minmax assert_equal([1, 3], @obj.minmax) assert_equal([3, 1], @obj.minmax {|a,b| b <=> a }) - a = %w(albatross dog horse) - assert_equal(["albatross", "horse"], a.minmax) - assert_equal(["dog", "albatross"], a.minmax {|a,b| a.length <=> b.length }) + ary = %w(albatross dog horse) + assert_equal(["albatross", "horse"], ary.minmax) + assert_equal(["dog", "albatross"], ary.minmax {|a,b| a.length <=> b.length }) assert_equal([1, 3], [2,3,1].minmax) assert_equal([3, 1], [2,3,1].minmax {|a,b| b <=> a }) assert_equal([1, 3], [2,2,3,3,1,1].minmax) diff --git a/test/ruby/test_file.rb b/test/ruby/test_file.rb index b4666ad4a6..b8ba9a4b19 100644 --- a/test/ruby/test_file.rb +++ b/test/ruby/test_file.rb @@ -140,13 +140,13 @@ class TestFile < Test::Unit::TestCase end def test_s_chown - assert_nothing_raised { File.chown -1, -1 } + assert_nothing_raised { File.chown(-1, -1) } assert_nothing_raised { File.chown nil, nil } end def test_chown assert_nothing_raised { - File.open(__FILE__) {|f| f.chown -1, -1 } + File.open(__FILE__) {|f| f.chown(-1, -1) } } assert_nothing_raised("[ruby-dev:27140]") { File.open(__FILE__) {|f| f.chown nil, nil } diff --git a/test/ruby/test_file_exhaustive.rb b/test/ruby/test_file_exhaustive.rb index e7d60960b8..74b960c54f 100644 --- a/test/ruby/test_file_exhaustive.rb +++ b/test/ruby/test_file_exhaustive.rb @@ -492,7 +492,7 @@ class TestFileExhaustive < Test::Unit::TestCase f.close make_file("foo", @file) - assert_raise(IOError) { File.open(@file) {|f| f.truncate(0)} } + assert_raise(IOError) { File.open(@file) {|ff| ff.truncate(0)} } rescue NotImplementedError end diff --git a/test/ruby/test_hash.rb b/test/ruby/test_hash.rb index d03783129f..5c9b08b917 100644 --- a/test/ruby/test_hash.rb +++ b/test/ruby/test_hash.rb @@ -51,7 +51,7 @@ class TestHash < Test::Unit::TestCase assert_equal([], x[22]) assert_not_same(x[22], x[22]) - x = Hash.new{|h,k| z = k; h[k] = k*2} + x = Hash.new{|h,kk| z = kk; h[kk] = kk*2} z = 0 assert_equal(44, x[22]) assert_equal(22, z) @@ -703,14 +703,14 @@ class TestHash < Test::Unit::TestCase end def test_default_proc - h = Hash.new {|h, k| h + k + "baz" } + h = Hash.new {|hh, k| hh + k + "baz" } assert_equal("foobarbaz", h.default_proc.call("foo", "bar")) h = {} assert_nil(h.default_proc) end def test_shift2 - h = Hash.new {|h, k| :foo } + h = Hash.new {|hh, k| :foo } h[1] = 2 assert_equal([1, 2], h.shift) assert_equal(:foo, h.shift) diff --git a/test/ruby/test_integer.rb b/test/ruby/test_integer.rb index 840192c5ad..7f8212ebf0 100644 --- a/test/ruby/test_integer.rb +++ b/test/ruby/test_integer.rb @@ -150,10 +150,10 @@ class TestInteger < Test::Unit::TestCase 1.upto(0) {|x| a << x } assert_equal([], a) - x = 2**30 - 1 + y = 2**30 - 1 a = [] - x.upto(x+2) {|x| a << x } - assert_equal([x, x+1, x+2], a) + y.upto(y+2) {|x| a << x } + assert_equal([y, y+1, y+2], a) end def test_downto @@ -165,10 +165,10 @@ class TestInteger < Test::Unit::TestCase 1.downto(2) {|x| a << x } assert_equal([], a) - x = -(2**30) + y = -(2**30) a = [] - x.downto(x-2) {|x| a << x } - assert_equal([x, x-1, x-2], a) + y.downto(y-2) {|x| a << x } + assert_equal([y, y-1, y-2], a) end def test_times diff --git a/test/ruby/test_iterator.rb b/test/ruby/test_iterator.rb index ca6022a4fb..42e3960e72 100644 --- a/test/ruby/test_iterator.rb +++ b/test/ruby/test_iterator.rb @@ -5,8 +5,8 @@ class Array collect{|e| [e, yield(e)]}.sort{|a,b|a[1]<=>b[1]} end def iter_test2 - a = collect{|e| [e, yield(e)]} - a.sort{|a,b|a[1]<=>b[1]} + ary = collect{|e| [e, yield(e)]} + ary.sort{|a,b|a[1]<=>b[1]} end end @@ -51,7 +51,7 @@ class TestIterator < Test::Unit::TestCase def test_nested_iterator i = 0 - tt{|i| break if i == 5} + tt{|j| break if j == 5} assert_equal(0, i) assert_raise(ArgumentError) do diff --git a/test/ruby/test_literal.rb b/test/ruby/test_literal.rb index e251197c79..80c8af9312 100644 --- a/test/ruby/test_literal.rb +++ b/test/ruby/test_literal.rb @@ -77,16 +77,16 @@ class TestRubyLiteral < Test::Unit::TestCase def test_regexp assert_instance_of Regexp, // - assert_match //, 'a' - assert_match //, '' + assert_match(//, 'a') + assert_match(//, '') assert_instance_of Regexp, /a/ - assert_match /a/, 'a' - assert_no_match /test/, 'tes' + assert_match(/a/, 'a') + assert_no_match(/test/, 'tes') re = /test/ assert_match re, 'test' str = 'test' assert_match re, str - assert_match /test/, str + assert_match(/test/, str) assert_equal 0, (/test/ =~ 'test') assert_equal 0, (re =~ 'test') assert_equal 0, (/test/ =~ str) diff --git a/test/ruby/test_proc.rb b/test/ruby/test_proc.rb index 6b8fb974ee..213566903e 100644 --- a/test/ruby/test_proc.rb +++ b/test/ruby/test_proc.rb @@ -178,7 +178,7 @@ class TestProc < Test::Unit::TestCase b = proc { :foo } assert_equal(:foo, b.curry[]) - b = lambda {|x, y, &b| b.call(x + y) }.curry + b = lambda {|x, y, &blk| blk.call(x + y) }.curry b = b.call(2) { raise } b = b.call(3) {|x| x + 4 } assert_equal(9, b) diff --git a/test/ruby/test_sprintf_comb.rb b/test/ruby/test_sprintf_comb.rb index 5dee7305fb..261732bcbc 100644 --- a/test/ruby/test_sprintf_comb.rb +++ b/test/ruby/test_sprintf_comb.rb @@ -229,7 +229,7 @@ class TestSprintfComb < Test::Unit::TestCase digits.reverse! - str = digits.map {|d| digitmap[d] }.join + str = digits.map {|digit| digitmap[digit] }.join pad = '' nlen = prefix.length + sign.length + str.length diff --git a/test/test_open3.rb b/test/test_open3.rb index 8f355ccb76..406f39b50d 100644 --- a/test/test_open3.rb +++ b/test/test_open3.rb @@ -190,8 +190,8 @@ class TestOpen3 < Test::Unit::TestCase ts.each {|t| assert_kind_of(Thread, t) } i.print str i.close - ts.each_with_index {|t, i| - assert_equal(str[i] == ?t, t.value.success?) + ts.each_with_index {|t, ii| + assert_equal(str[ii] == ?t, t.value.success?) } } end diff --git a/test/test_prime.rb b/test/test_prime.rb index b4962bafcf..e095a29722 100644 --- a/test/test_prime.rb +++ b/test/test_prime.rb @@ -107,7 +107,7 @@ class TestPrime < Test::Unit::TestCase def test_from_prime_division assert_equal PRIMES.inject(&:*), Integer.from_prime_division(PRIMES.map{|p| [p,1]}) - assert_equal -PRIMES.inject(&:*), Integer.from_prime_division([[-1, 1]] + PRIMES.map{|p| [p,1]}) + assert_equal(-PRIMES.inject(&:*), Integer.from_prime_division([[-1, 1]] + PRIMES.map{|p| [p,1]})) end def test_prime? @@ -124,11 +124,11 @@ class TestPrime < Test::Unit::TestCase assert !9.prime? # mersenne numbers - assert (2**31-1).prime? + assert((2**31-1).prime?) assert !(2**32-1).prime? # fermat numbers - assert (2**(2**4)+1).prime? + assert((2**(2**4)+1).prime?) assert !(2**(2**5)+1).prime? # Euler! # large composite @@ -139,8 +139,8 @@ class TestPrime < Test::Unit::TestCase # negative assert !-1.prime? - assert -2.prime? - assert -3.prime? + assert(-2.prime?) + assert(-3.prime?) assert !-4.prime? end end diff --git a/test/uri/test_ldap.rb b/test/uri/test_ldap.rb index 14ef39242e..c96a067804 100644 --- a/test/uri/test_ldap.rb +++ b/test/uri/test_ldap.rb @@ -81,8 +81,8 @@ class TestLDAP < Test::Unit::TestCase ['ldap', nil, URI::LDAP::DEFAULT_PORT, '', nil, 'sub', nil, '!bindname=cn=Manager%2co=Foo'], - }.each do |url, ary| - u = URI.parse(url) + }.each do |url2, ary| + u = URI.parse(url2) assert_equal(ary, uri_to_ary(u)) end end diff --git a/test/webrick/test_httpproxy.rb b/test/webrick/test_httpproxy.rb index ab82ed8cd7..d37fd70a7a 100644 --- a/test/webrick/test_httpproxy.rb +++ b/test/webrick/test_httpproxy.rb @@ -254,8 +254,8 @@ class TestWEBrickHTTPProxy < Test::Unit::TestCase :SSLPrivateKey => key, } TestWEBrick.start_httpserver(s_config){|s_server, s_addr, s_port, s_log| - s_server.mount_proc("/"){|req, res| - res.body = "SSL #{req.request_method} #{req.path} #{req.body}" + s_server.mount_proc("/"){|req2, res| + res.body = "SSL #{req2.request_method} #{req2.path} #{req2.body}" } http = Net::HTTP.new("127.0.0.1", s_port, addr, port, up_log.call + log.call + s_log.call) http.use_ssl = true @@ -263,14 +263,14 @@ class TestWEBrickHTTPProxy < Test::Unit::TestCase store_ctx.current_cert.to_der == cert.to_der end - req = Net::HTTP::Get.new("/") - http.request(req){|res| + req2 = Net::HTTP::Get.new("/") + http.request(req2){|res| assert_equal("SSL GET / ", res.body, up_log.call + log.call + s_log.call) } - req = Net::HTTP::Post.new("/") - req.body = "post-data" - http.request(req){|res| + req2 = Net::HTTP::Post.new("/") + req2.body = "post-data" + http.request(req2){|res| assert_equal("SSL POST / post-data", res.body, up_log.call + log.call + s_log.call) } } diff --git a/test/xmlrpc/test_webrick_server.rb b/test/xmlrpc/test_webrick_server.rb index 47fa5487c3..192b5a7651 100644 --- a/test/xmlrpc/test_webrick_server.rb +++ b/test/xmlrpc/test_webrick_server.rb @@ -88,11 +88,11 @@ class Test_Webrick < Test::Unit::TestCase # default handler (missing handler) ok, param = @s.call2('test.nonexisting') assert_equal false, ok - assert_equal -99, param.faultCode + assert_equal(-99, param.faultCode) # default handler (wrong number of arguments) ok, param = @s.call2('test.add', 1, 2, 3) assert_equal false, ok - assert_equal -99, param.faultCode + assert_equal(-99, param.faultCode) end end diff --git a/test/xmlrpc/webrick_testing.rb b/test/xmlrpc/webrick_testing.rb index 05c334045e..4c0cf89f1a 100644 --- a/test/xmlrpc/webrick_testing.rb +++ b/test/xmlrpc/webrick_testing.rb @@ -7,7 +7,7 @@ module WEBrick_Testing end def start_server(config={}) - raise "already started" if @__server + raise "already started" if defined?(@__server) && @__server @__started = false @__server_thread = Thread.new { -- cgit v1.2.3