diff options
author | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-03-25 06:11:14 +0000 |
---|---|---|
committer | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-03-25 06:11:14 +0000 |
commit | 31d6b6f7d6ed97423b15bd21ae98cc21c9a78fc5 (patch) | |
tree | 6c09f8be36c80652678842803c5ff07a624bdda4 /test | |
parent | e59be153682d6240b2dd571c2272fb31f905d84c (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_4@62918 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 d1c5d53822..d749be4361 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) |