summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-04-03 06:57:43 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-04-03 06:57:43 +0000
commitc7770f90bdcac04dad43ab38bef9c415433597cb (patch)
treee219c38b67012575b2be9836908471a2054bdc5b /test/ruby
parent5bcb76ebbdd17bad25c81a3261a00d15f752ad9a (diff)
Fix Kernel#singleton_method with Module#Prepend
* proc.c (rb_obj_singleton_method): search the method entry from the origin class, for fix prepended modules. [Bug #14658] From: Vasiliy Ermolovich <younash@gmail.com> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63067 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_method.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/ruby/test_method.rb b/test/ruby/test_method.rb
index 0ef913fd78..67c24a8fd8 100644
--- a/test/ruby/test_method.rb
+++ b/test/ruby/test_method.rb
@@ -782,6 +782,16 @@ class TestMethod < Test::Unit::TestCase
assert_equal(:bar, m.call, feature8391)
end
+ def test_singleton_method_prepend
+ bug14658 = '[Bug #14658]'
+ c1 = Class.new
+ o = c1.new
+ def o.bar; :bar; end
+ class << o; prepend Module.new; end
+ m = assert_nothing_raised(NameError, bug14658) {o.singleton_method(:bar)}
+ assert_equal(:bar, m.call, bug14658)
+ end
+
Feature9783 = '[ruby-core:62212] [Feature #9783]'
def assert_curry_three_args(m)