summaryrefslogtreecommitdiff
path: root/test/ruby/test_method.rb
diff options
context:
space:
mode:
authorBenoit Daloze <eregontp@gmail.com>2022-08-15 16:01:33 +0200
committerBenoit Daloze <eregontp@gmail.com>2022-08-20 13:44:00 +0200
commit209631a45f9682dedf718f4b4a140efe7d21a6fc (patch)
tree4fe16e820f45b927f6d5b11637d9dff79ab53e4a /test/ruby/test_method.rb
parent8212aab81a77a2a91fb7c1681b4968171193b48f (diff)
Consider resolved-through-zsuper methods equal for compatibility
* Fixes https://bugs.ruby-lang.org/issues/18751
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/6242
Diffstat (limited to 'test/ruby/test_method.rb')
-rw-r--r--test/ruby/test_method.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/ruby/test_method.rb b/test/ruby/test_method.rb
index 5f689c3d4f..7e440095c8 100644
--- a/test/ruby/test_method.rb
+++ b/test/ruby/test_method.rb
@@ -1241,6 +1241,24 @@ class TestMethod < Test::Unit::TestCase
assert_raise_with_message(NoMethodError, /super: no superclass method `foo'/) { unbound.bind_call(obj) }
end
+ # Bug #18751
+ def method_equality_visbility_alias
+ c = Class.new do
+ class << self
+ alias_method :n, :new
+ private :new
+ end
+ end
+
+ assert_equal c.method(:n), c.method(:new)
+
+ assert_not_equal c.method(:n), Class.method(:new)
+ assert_equal c.method(:n) == Class.instance_method(:new).bind(c)
+
+ assert_not_equal c.method(:new), Class.method(:new)
+ assert_equal c.method(:new), Class.instance_method(:new).bind(c)
+ end
+
def rest_parameter(*rest)
rest
end