summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorKoichi Sasada <ko1@atdot.net>2022-12-03 05:55:33 +0900
committerKoichi Sasada <ko1@atdot.net>2022-12-03 08:53:12 +0900
commit59e389af2893c0fcf8b2cfa008c9a16825bf56ff (patch)
tree31224e3498843912e2fc8734710e03224aaca21c /test
parent7161bf34e161979b97dbc0c1f7450c195faffcfe (diff)
UnboundMethod only refer defined_class
UnboundMethod records caller's class, like `D` or `E` on the following case: ```ruby class C def foo = :foo end class D < C end class E < C end d = D.instance_method(:foo) e = E.instance_method(:foo) ``` But `d` and `e` only refers `C#foo` so that UnboundMethod doesn't record `D` or `E`. This behavior changes the following methods: * `UnboundMethod#inspect` (doesn't show caller's class) * `UnboundMethod#==` (`d == e` for example) fix https://bugs.ruby-lang.org/issues/18798
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/6855
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_method.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/test/ruby/test_method.rb b/test/ruby/test_method.rb
index d2c7b6e1dd..a04666890e 100644
--- a/test/ruby/test_method.rb
+++ b/test/ruby/test_method.rb
@@ -1236,12 +1236,12 @@ class TestMethod < Test::Unit::TestCase
unbound = b.instance_method(:foo)
assert_equal unbound, b.public_instance_method(:foo)
- assert_equal "#<UnboundMethod: B(A)#foo(arg=...) #{__FILE__}:#{line}>", unbound.inspect
+ assert_equal "#<UnboundMethod: A#foo(arg=...) #{__FILE__}:#{line}>", unbound.inspect
assert_equal [[:opt, :arg]], unbound.parameters
a.remove_method(:foo)
- assert_equal "#<UnboundMethod: B(A)#foo(arg=...) #{__FILE__}:#{line}>", unbound.inspect
+ assert_equal "#<UnboundMethod: A#foo(arg=...) #{__FILE__}:#{line}>", unbound.inspect
assert_equal [[:opt, :arg]], unbound.parameters
obj = b.new
@@ -1281,7 +1281,7 @@ class TestMethod < Test::Unit::TestCase
a.remove_method(:foo)
- assert_equal "#<UnboundMethod: B(A)#foo(arg=...) #{__FILE__}:#{line}>", unbound.inspect
+ assert_equal "#<UnboundMethod: A#foo(arg=...) #{__FILE__}:#{line}>", unbound.inspect
assert_equal [[:opt, :arg]], unbound.parameters
assert_equal a0_foo, unbound.super_method
@@ -1289,7 +1289,7 @@ class TestMethod < Test::Unit::TestCase
assert_equal 1, unbound.bind_call(obj)
assert_include b.instance_methods(false), :foo
- assert_equal "#<UnboundMethod: B(A0)#foo(arg1=..., arg2=...) #{__FILE__}:#{line0}>", b.instance_method(:foo).inspect
+ assert_equal "#<UnboundMethod: A0#foo(arg1=..., arg2=...) #{__FILE__}:#{line0}>", b.instance_method(:foo).inspect
end
def test_zsuper_method_redefined_bind_call