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

ruby-changes:59832

From: Koichi <ko1@a...>
Date: Tue, 28 Jan 2020 15:24:39 +0900 (JST)
Subject: [ruby-changes:59832] 56b0300f24 (master): support multi-run for test/ruby/test_proc.rb

https://git.ruby-lang.org/ruby.git/commit/?id=56b0300f24

From 56b0300f24bc2bce6309279e2c07e8a1f08044e4 Mon Sep 17 00:00:00 2001
From: Koichi Sasada <ko1@a...>
Date: Tue, 28 Jan 2020 14:21:44 +0900
Subject: support multi-run for test/ruby/test_proc.rb

Mysterious error:
`remove_method(:foo) if method_defined?(:foo)` raise an exception
`method `foo' not defined in #<Class:#<TestProc:0x000055d12ff154e0>>`
This patch rename the method name foo to foo_arity to solve it.

diff --git a/test/ruby/test_proc.rb b/test/ruby/test_proc.rb
index 4177707..b00f42d 100644
--- a/test/ruby/test_proc.rb
+++ b/test/ruby/test_proc.rb
@@ -59,10 +59,10 @@ class TestProc < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_proc.rb#L59
       Proc.new
     end
     meta.class_eval {
-      remove_method(:foo) if method_defined?(:foo)
-      define_method(:foo, b)
+      remove_method(:foo_arity) if method_defined?(:foo_arity)
+      define_method(:foo_arity, b)
     }
-    assert_equal(n, method(:foo).arity)
+    assert_equal(n, method(:foo_arity).arity)
   end
 
   def test_arity
-- 
cgit v0.10.2


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

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