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

ruby-changes:58787

From: Yusuke <ko1@a...>
Date: Thu, 14 Nov 2019 13:15:39 +0900 (JST)
Subject: [ruby-changes:58787] 48edaf8b8a (master): test/ruby/test_proc.rb: suppress "method redefined" warnings

https://git.ruby-lang.org/ruby.git/commit/?id=48edaf8b8a

From 48edaf8b8a03ef7a1c4f936c8c92e9dcf4271872 Mon Sep 17 00:00:00 2001
From: Yusuke Endoh <mame@r...>
Date: Thu, 14 Nov 2019 13:00:25 +0900
Subject: test/ruby/test_proc.rb: suppress "method redefined" warnings


diff --git a/test/ruby/test_proc.rb b/test/ruby/test_proc.rb
index f09e58e..5c12043 100644
--- a/test/ruby/test_proc.rb
+++ b/test/ruby/test_proc.rb
@@ -58,7 +58,10 @@ class TestProc < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_proc.rb#L58
     b = assert_warn(/Capturing the given block using Proc\.new is deprecated/) do
       Proc.new
     end
-    meta.class_eval {define_method(:foo, b)}
+    meta.class_eval {
+      remove_method(:foo) if method_defined?(:foo)
+      define_method(:foo, b)
+    }
     assert_equal(n, method(:foo).arity)
   end
 
-- 
cgit v0.10.2


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

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