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

ruby-changes:33194

From: usa <ko1@a...>
Date: Wed, 5 Mar 2014 22:27:30 +0900 (JST)
Subject: [ruby-changes:33194] usa:r45273 (trunk): * test/ruby: get rid of warnings.

usa	2014-03-05 22:27:22 +0900 (Wed, 05 Mar 2014)

  New Revision: 45273

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

  Log:
    * test/ruby: get rid of warnings.

  Modified files:
    trunk/test/ruby/test_lambda.rb
    trunk/test/ruby/test_lazy_enumerator.rb
    trunk/test/ruby/test_module.rb
    trunk/test/ruby/test_object.rb
    trunk/test/ruby/test_optimization.rb
    trunk/test/ruby/test_parse.rb
    trunk/test/ruby/test_rand.rb
    trunk/test/ruby/test_refinement.rb
    trunk/test/ruby/test_super.rb
    trunk/test/ruby/test_system.rb
    trunk/test/ruby/test_thread.rb
    trunk/test/ruby/test_time.rb
    trunk/test/ruby/test_time_tz.rb
Index: test/ruby/test_lambda.rb
===================================================================
--- test/ruby/test_lambda.rb	(revision 45272)
+++ test/ruby/test_lambda.rb	(revision 45273)
@@ -91,7 +91,7 @@ class TestLambdaParameters < Test::Unit: https://github.com/ruby/ruby/blob/trunk/test/ruby/test_lambda.rb#L91
   end
 
   def return_in_current(val)
-    1.tap &->(*) {return 0}
+    1.tap(&->(*) {return 0})
     val
   end
 
@@ -100,7 +100,7 @@ class TestLambdaParameters < Test::Unit: https://github.com/ruby/ruby/blob/trunk/test/ruby/test_lambda.rb#L100
   end
 
   def return_in_callee(val)
-    yield_block &->(*) {return 0}
+    yield_block(&->(*) {return 0})
     val
   end
 
Index: test/ruby/test_system.rb
===================================================================
--- test/ruby/test_system.rb	(revision 45272)
+++ test/ruby/test_system.rb	(revision 45273)
@@ -86,7 +86,7 @@ class TestSystem < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_system.rb#L86
         File.unlink tmpfilename
 
         testname = '[ruby-core:44505]'
-        assert_match /Windows/, `ver`, testname
+        assert_match(/Windows/, `ver`, testname)
         assert_equal 0, $?.to_i, testname
       end
     }
Index: test/ruby/test_module.rb
===================================================================
--- test/ruby/test_module.rb	(revision 45272)
+++ test/ruby/test_module.rb	(revision 45273)
@@ -1258,7 +1258,7 @@ class TestModule < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_module.rb#L1258
     c = Class.new do
       attr_writer :foo
     end
-    assert_raise(ArgumentError) { c.new.send :foo= }
+    assert_raise(ArgumentError, bug8540) { c.new.send :foo= }
   end
 
   def test_private_constant
Index: test/ruby/test_optimization.rb
===================================================================
--- test/ruby/test_optimization.rb	(revision 45272)
+++ test/ruby/test_optimization.rb	(revision 45273)
@@ -163,7 +163,7 @@ class TestRubyOptimization < Test::Unit: https://github.com/ruby/ruby/blob/trunk/test/ruby/test_optimization.rb#L163
       tailcall_optimization: true,
       trace_instruction: false,
     }
-    iseq = RubyVM::InstructionSequence.new(<<-EOF, "Bug#4082", bug4082, nil, option).eval
+    RubyVM::InstructionSequence.new(<<-EOF, "Bug#4082", bug4082, nil, option).eval
       class #{self.class}::Tailcall
         def fact_helper(n, res)
           if n == 1
@@ -187,7 +187,7 @@ class TestRubyOptimization < Test::Unit: https://github.com/ruby/ruby/blob/trunk/test/ruby/test_optimization.rb#L187
       tailcall_optimization: true,
       trace_instruction: false,
     }
-    iseq = RubyVM::InstructionSequence.new(<<-EOF, "Bug#6901", bug6901, nil, option).eval
+    RubyVM::InstructionSequence.new(<<-EOF, "Bug#6901", bug6901, nil, option).eval
   def identity(val)
     val
   end
Index: test/ruby/test_object.rb
===================================================================
--- test/ruby/test_object.rb	(revision 45272)
+++ test/ruby/test_object.rb	(revision 45273)
@@ -801,7 +801,7 @@ class TestObject < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_object.rb#L801
   end
 
   def test_type_error_message
-    issue = "Bug #7539"
+    _issue = "Bug #7539"
     assert_raise_with_message(TypeError, "can't convert Array into Integer") {Integer([42])}
     assert_raise_with_message(TypeError, 'no implicit conversion of Array into Integer') {[].first([42])}
   end
Index: test/ruby/test_refinement.rb
===================================================================
--- test/ruby/test_refinement.rb	(revision 45272)
+++ test/ruby/test_refinement.rb	(revision 45273)
@@ -259,7 +259,7 @@ class TestRefinement < Test::Unit::TestC https://github.com/ruby/ruby/blob/trunk/test/ruby/test_refinement.rb#L259
   def test_return_value_of_refine
     mod = nil
     result = nil
-    m = Module.new {
+    Module.new {
       result = refine(Object) {
         mod = self
       }
@@ -433,7 +433,6 @@ class TestRefinement < Test::Unit::TestC https://github.com/ruby/ruby/blob/trunk/test/ruby/test_refinement.rb#L433
   end
 
   def test_module_using_class
-    c = Class.new
     assert_raise(TypeError) do
       eval("using TestRefinement::UsingClass", TOPLEVEL_BINDING)
     end
Index: test/ruby/test_super.rb
===================================================================
--- test/ruby/test_super.rb	(revision 45272)
+++ test/ruby/test_super.rb	(revision 45273)
@@ -194,7 +194,7 @@ class TestSuper < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_super.rb#L194
         end
       end
       overlaid.call(str = "123")
-      overlaid.call(ary = [1,2,3])
+      overlaid.call([1,2,3])
       str.reverse
     end
 
@@ -318,7 +318,6 @@ class TestSuper < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_super.rb#L318
     }
     sub_class = Class.new(super_class) {
       def foo
-        x = Object.new
         lambda { super() }
       end
     }
Index: test/ruby/test_time.rb
===================================================================
--- test/ruby/test_time.rb	(revision 45272)
+++ test/ruby/test_time.rb	(revision 45273)
@@ -1,5 +1,4 @@ https://github.com/ruby/ruby/blob/trunk/test/ruby/test_time.rb#L1
 require 'test/unit'
-require 'rational'
 require 'delegate'
 require 'timeout'
 require 'delegate'
Index: test/ruby/test_lazy_enumerator.rb
===================================================================
--- test/ruby/test_lazy_enumerator.rb	(revision 45272)
+++ test/ruby/test_lazy_enumerator.rb	(revision 45273)
@@ -313,11 +313,11 @@ class TestLazyEnumerator < Test::Unit::T https://github.com/ruby/ruby/blob/trunk/test/ruby/test_lazy_enumerator.rb#L313
   def test_take_rewound
     bug7696 = '[ruby-core:51470]'
     e=(1..42).lazy.take(2)
-    assert_equal 1, e.next
-    assert_equal 2, e.next
+    assert_equal 1, e.next, bug7696
+    assert_equal 2, e.next, bug7696
     e.rewind
-    assert_equal 1, e.next
-    assert_equal 2, e.next
+    assert_equal 1, e.next, bug7696
+    assert_equal 2, e.next, bug7696
   end
 
   def test_take_while
Index: test/ruby/test_rand.rb
===================================================================
--- test/ruby/test_rand.rb	(revision 45272)
+++ test/ruby/test_rand.rb	(revision 45273)
@@ -210,7 +210,8 @@ class TestRand < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_rand.rb#L210
     assert_raise(ArgumentError, '[ruby-dev:39166]') { r.rand(0..-1) }
     assert_raise(ArgumentError, '[ruby-dev:39166]') { r.rand(0.0...0.0) }
     assert_raise(ArgumentError, '[ruby-dev:39166]') { r.rand(0.0...-0.1) }
-    assert_raise(ArgumentError, bug3027 = '[ruby-core:29075]') { r.rand(nil) }
+    bug3027 = '[ruby-core:29075]'
+    assert_raise(ArgumentError, bug3027) { r.rand(nil) }
   end
 
   def test_random_seed
@@ -420,7 +421,7 @@ END https://github.com/ruby/ruby/blob/trunk/test/ruby/test_rand.rb#L421
       (1..10).to_a.shuffle
       raise 'default seed is not set' if srand == 0
     end
-    p2, st = Process.waitpid2(pid)
+    _, st = Process.waitpid2(pid)
     assert_predicate(st, :success?, "#{st.inspect}")
   rescue NotImplementedError, ArgumentError
   end
Index: test/ruby/test_thread.rb
===================================================================
--- test/ruby/test_thread.rb	(revision 45272)
+++ test/ruby/test_thread.rb	(revision 45273)
@@ -511,8 +511,8 @@ class TestThread < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_thread.rb#L511
   def test_no_valid_cfp
     skip 'with win32ole, cannot run this testcase because win32ole redefines Thread#intialize' if defined?(WIN32OLE)
     bug5083 = '[ruby-dev:44208]'
-    assert_equal([], Thread.new(&Module.method(:nesting)).value)
-    assert_instance_of(Thread, Thread.new(:to_s, &Class.new.method(:undef_method)).join)
+    assert_equal([], Thread.new(&Module.method(:nesting)).value, bug5083)
+    assert_instance_of(Thread, Thread.new(:to_s, &Class.new.method(:undef_method)).join, bug5083)
   end
 
   def make_handle_interrupt_test_thread1 flag
Index: test/ruby/test_parse.rb
===================================================================
--- test/ruby/test_parse.rb	(revision 45272)
+++ test/ruby/test_parse.rb	(revision 45273)
@@ -218,7 +218,6 @@ class TestParse < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_parse.rb#L218
     def o.>(x); x; end
     def o./(x); x; end
 
-    a = nil
     assert_nothing_raised do
       o.instance_eval <<-END, __FILE__, __LINE__+1
         undef >, /
Index: test/ruby/test_time_tz.rb
===================================================================
--- test/ruby/test_time_tz.rb	(revision 45272)
+++ test/ruby/test_time_tz.rb	(revision 45273)
@@ -150,7 +150,7 @@ class TestTimeTZ < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_time_tz.rb#L150
   end
 
   def test_europe_lisbon
-    with_tz(tz="Europe/Lisbon") {
+    with_tz("Europe/Lisbon") {
       assert_equal("LMT", Time.new(-0x1_0000_0000_0000_0000).zone)
     }
   end if has_right_tz
@@ -250,7 +250,7 @@ class TestTimeTZ < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_time_tz.rb#L250
       }
     }
     group_by(sample) {|tz, _, _, _| tz }.each {|tz, a|
-      a.each_with_index {|(_, u, l, gmtoff), i|
+      a.each_with_index {|(_, _, l, gmtoff), i|
         expected = "%04d-%02d-%02d %02d:%02d:%02d %s" % (l+[format_gmtoff(gmtoff)])
         monotonic_to_past = i == 0 || (a[i-1][2] <=> l) < 0
         monotonic_to_future = i == a.length-1 || (l <=> a[i+1][2]) < 0

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

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