diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-04-11 06:05:28 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-04-11 06:05:28 +0000 |
commit | 46f578d806df70c4cae43b614e56558977a4cc44 (patch) | |
tree | 41ecd67b39c9a6b3ab6e2530f2b485048744078c /test/ruby/test_super.rb | |
parent | 2329a1a88dbbb5b1c9323d485cc95e30f7acbdf8 (diff) |
proc.c: fix super in bound UnboundMethod
* proc.c (rb_method_call_with_block, umethod_bind): call with
IClass including the module for a module instance method.
[ruby-core:61936] [Bug #9721]
* vm_insnhelper.c (vm_search_super_method): allow bound
UnboundMethod case.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45565 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_super.rb')
-rw-r--r-- | test/ruby/test_super.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/ruby/test_super.rb b/test/ruby/test_super.rb index fcf5773501..e7825560ac 100644 --- a/test/ruby/test_super.rb +++ b/test/ruby/test_super.rb @@ -452,4 +452,28 @@ class TestSuper < Test::Unit::TestCase m.call end end + + def test_super_in_module_unbound_method + bug9721 = '[ruby-core:61936] [Bug #9721]' + + a = Module.new do + def foo(result) + result << "A" + end + end + + b = Module.new do + def foo(result) + result << "B" + super + end + end + + m = b.instance_method(:foo).bind(Object.new.extend(a)) + result = [] + assert_nothing_raised(NoMethodError, bug9721) do + m.call(result) + end + assert_equal(%w[B A], result, bug9721) + end end |