diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-03-28 06:24:25 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-03-28 06:24:25 +0000 |
commit | 134967e5b1f29d4dbb4f0c35f582d328f3eaf9e7 (patch) | |
tree | 65773626ec4f09261c7d16938392b4e084d44efd /test | |
parent | 84ec88a2319cfe716212d62f70bc10e855c2d2aa (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_3@62950 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_module.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb index b155ad7206..df40be3db0 100644 --- a/test/ruby/test_module.rb +++ b/test/ruby/test_module.rb @@ -1864,6 +1864,25 @@ class TestModule < Test::Unit::TestCase end; 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) |