summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorNAKAMURA Usaku <usa@ruby-lang.org>2021-05-31 23:01:45 +0900
committerNAKAMURA Usaku <usa@ruby-lang.org>2021-05-31 23:01:45 +0900
commitfd95a1805922d9fbe65e6f4c08609c7eac10b723 (patch)
tree89f22049bc3d7747d944d38855860c90b8db4ede /test
parent67f1cd20bfb97ff6e5a15d27c8ef06cdb97ed37a (diff)
merge revision(s) d8a13e504992a45d52063f7c925408d7aad3595a: [Backport #17780]
[Bug #17780] Fix Method#super_method for module alias Method#super_method crashes for aliased module methods because they are not defined on a class. This bug was introduced in c60aaed1856b2b6f90de0992c34771830019e021 as part of bug #17130. --- proc.c | 2 +- test/ruby/test_method.rb | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-)
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_method.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/ruby/test_method.rb b/test/ruby/test_method.rb
index 0f0807af9d..03a6c560e6 100644
--- a/test/ruby/test_method.rb
+++ b/test/ruby/test_method.rb
@@ -1144,6 +1144,19 @@ class TestMethod < Test::Unit::TestCase
assert_nil(m.super_method)
end
+ # Bug 17780
+ def test_super_method_module_alias
+ m = Module.new do
+ def foo
+ end
+ alias :f :foo
+ end
+
+ method = m.instance_method(:f)
+ super_method = method.super_method
+ assert_nil(super_method)
+ end
+
def rest_parameter(*rest)
rest
end