mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* insns.def: search up the cf stack for an object that is an instance
of the recipient class. Fixes [ruby-core:47186] * test/ruby/test_super.rb: related test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
c069246931
commit
51a41dd056
3 changed files with 27 additions and 9 deletions
|
@ -322,4 +322,16 @@ class TestSuper < Test::Unit::TestCase
|
|||
obj.foo.call
|
||||
end
|
||||
end
|
||||
|
||||
def test_yielding_super
|
||||
a = Class.new { def yielder; yield; end }
|
||||
x = Class.new { define_singleton_method(:hello) { 'hi' } }
|
||||
y = Class.new(x) {
|
||||
define_singleton_method(:hello) {
|
||||
m = a.new
|
||||
m.yielder { super() }
|
||||
}
|
||||
}
|
||||
assert_equal 'hi', y.hello
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue