ruby-changes:73797
From: Benoit <ko1@a...>
Date: Thu, 29 Sep 2022 22:48:54 +0900 (JST)
Subject: [ruby-changes:73797] aa53d69aa2 (master): Add specs for {Method, UnboundMethod}#owner of a zsuper method
https://git.ruby-lang.org/ruby.git/commit/?id=aa53d69aa2 From aa53d69aa21c4dfa2a78a1cec5cb34e9697b3d30 Mon Sep 17 00:00:00 2001 From: Benoit Daloze <eregontp@g...> Date: Wed, 28 Sep 2022 19:04:06 +0200 Subject: Add specs for {Method,UnboundMethod}#owner of a zsuper method --- spec/ruby/core/method/owner_spec.rb | 6 ++++++ spec/ruby/core/unboundmethod/owner_spec.rb | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/spec/ruby/core/method/owner_spec.rb b/spec/ruby/core/method/owner_spec.rb index ca5dff7295..05422f1697 100644 --- a/spec/ruby/core/method/owner_spec.rb +++ b/spec/ruby/core/method/owner_spec.rb @@ -23,4 +23,10 @@ describe "Method#owner" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/method/owner_spec.rb#L23 @m.method(:handled_via_method_missing).owner.should == MethodSpecs::Methods end end + + ruby_version_is "3.2" do + it "returns the class on which public was called for a private method in ancestor" do + MethodSpecs::InheritedMethods::C.new.method(:derp).owner.should == MethodSpecs::InheritedMethods::C + end + end end diff --git a/spec/ruby/core/unboundmethod/owner_spec.rb b/spec/ruby/core/unboundmethod/owner_spec.rb index 5f1f4646b3..e8a734dac4 100644 --- a/spec/ruby/core/unboundmethod/owner_spec.rb +++ b/spec/ruby/core/unboundmethod/owner_spec.rb @@ -1,5 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/unboundmethod/owner_spec.rb#L1 require_relative '../../spec_helper' require_relative 'fixtures/classes' +require_relative '../method/fixtures/classes' describe "UnboundMethod#owner" do it "returns the owner of the method" do @@ -23,4 +24,10 @@ describe "UnboundMethod#owner" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/unboundmethod/owner_spec.rb#L24 child_singleton_class.instance_method(:class_method).owner.should == parent_singleton_class child_singleton_class.instance_method(:another_class_method).owner.should == child_singleton_class end + + ruby_version_is "3.2" do + it "returns the class on which public was called for a private method in ancestor" do + MethodSpecs::InheritedMethods::C.instance_method(:derp).owner.should == MethodSpecs::InheritedMethods::C + end + end end -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/