summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-03-20 09:52:52 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-03-20 09:52:52 +0000
commitf4aea9108d19b304e8a7f9d2ec4763eadf4a64ba (patch)
treed4e36f6ac9b50372a7651575543f2cd091fa7aea /test
parent42fdd9407d420f80c7c664ae22615986959b9c5b (diff)
merge revision(s) 62725: [Backport #14604]
Fix setting method visibility on method wrapped with prepend Ignore prepended modules when looking for already defined methods on a class to set the visibility on. [Fix GH-1834] From: Dylan Thacker-Smith <Dylan.Smith@shopify.com> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_5@62860 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_module.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb
index 9980844eb4..94a2b5d4e6 100644
--- a/test/ruby/test_module.rb
+++ b/test/ruby/test_module.rb
@@ -1876,6 +1876,25 @@ class TestModule < Test::Unit::TestCase
assert_raise(ArgumentError) { Module.new { prepend } }
end
+ def test_prepend_private_super
+ wrapper = Module.new do
+ def wrapped
+ super + 1
+ end
+ end
+
+ klass = Class.new do
+ prepend wrapper
+
+ def wrapped
+ 1
+ end
+ private :wrapped
+ end
+
+ assert_equal(2, klass.new.wrapped)
+ end
+
def test_class_variables
m = Module.new
m.class_variable_set(:@@foo, 1)