mirror of
https://github.com/ruby/ruby.git
synced 2025-09-23 20:44:00 +02:00
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/trunk@62725 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
f2b094a522
commit
ae36cf62b7
3 changed files with 61 additions and 2 deletions
|
@ -1887,6 +1887,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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue