mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Fix {Method,UnboundMethod}#super_method for zsuper methods
* We need to resolve the zsuper method first, and then look the super method of that.
This commit is contained in:
parent
892f350a7d
commit
94cea3e4d0
Notes:
git
2022-09-29 22:49:00 +09:00
3 changed files with 22 additions and 34 deletions
|
@ -29,18 +29,14 @@ describe "UnboundMethod#super_method" do
|
|||
|
||||
# https://github.com/jruby/jruby/issues/7240
|
||||
context "after changing an inherited methods visibility" do
|
||||
ruby_version_is ""..."3.2" do
|
||||
it "returns the expected super_method" do
|
||||
method = MethodSpecs::InheritedMethods::C.instance_method(:derp)
|
||||
method.super_method.owner.should == MethodSpecs::InheritedMethods::A
|
||||
end
|
||||
it "calls the proper super method" do
|
||||
method = MethodSpecs::InheritedMethods::C.instance_method(:derp)
|
||||
method.bind(MethodSpecs::InheritedMethods::C.new).call.should == 'BA'
|
||||
end
|
||||
|
||||
ruby_version_is "3.2" do
|
||||
it "returns the expected super_method" do
|
||||
method = MethodSpecs::InheritedMethods::C.instance_method(:derp)
|
||||
method.super_method.owner.should == MethodSpecs::InheritedMethods::B
|
||||
end
|
||||
it "returns the expected super_method" do
|
||||
method = MethodSpecs::InheritedMethods::C.instance_method(:derp)
|
||||
method.super_method.owner.should == MethodSpecs::InheritedMethods::A
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue