diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2021-02-28 14:53:21 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2021-02-28 14:53:21 +0000 |
commit | 4be089c0dd720324730230c1abfe0c200d125359 (patch) | |
tree | 543ebfd021b28ab90d7f3204b96f9574128048ea /test/ruby | |
parent | e31ab1a240add146943eb0492d9929c6c92174b6 (diff) |
merge revision(s) e02bd0e7: [Backport #15608]
Don't display singleton class in Method#inspect unless method defined there
Previously, if an object has a singleton class, and you call
Object#method on the object, the resulting string would include
the object's singleton class, even though the method was not
defined in the singleton class.
Change this so the we only show the singleton class if the method
is defined in the singleton class.
Fixes [Bug #15608]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_6@67902 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_method.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/ruby/test_method.rb b/test/ruby/test_method.rb index 3a7186584a..2d615ca53f 100644 --- a/test/ruby/test_method.rb +++ b/test/ruby/test_method.rb @@ -458,6 +458,14 @@ class TestMethod < Test::Unit::TestCase m.taint assert_predicate(m.inspect, :tainted?, "inspect result should be infected") + + bug15608 = '[ruby-core:91570] [Bug #15608]' + c4 = Class.new(c) + c4.class_eval { alias bar foo } + o = c4.new + o.singleton_class + m4 = o.method(:bar) + assert_equal("#<Method: #{c4.inspect}(#{c.inspect})#bar(foo)>", m4.inspect, bug15608) end def test_callee_top_level |