summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2021-07-03 16:53:29 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2021-07-03 16:53:29 +0000
commit67b324529b378c34fcc0fd910fa4139fc6cc5478 (patch)
tree0328dab8315a45892f9c4ee3ee0a02d5fbd5daab /test
parent263f9662442a31f723aa9513c84349552e9d2ba7 (diff)
merge revision(s) d8a13e50: [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(-) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_6@67945 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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 1df09c21b7..3bf25928c9 100644
--- a/test/ruby/test_method.rb
+++ b/test/ruby/test_method.rb
@@ -1038,6 +1038,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