mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* vm_insnhelper.c (vm_call_method): protected singleton methods should
be visible from same real class methods. [ruby-core:33506] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30064 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
bfcd4e5453
commit
adc978adc3
3 changed files with 28 additions and 1 deletions
|
@ -411,4 +411,23 @@ class TestMethod < Test::Unit::TestCase
|
|||
assert_nothing_raised { v.instance_eval { mv2 } }
|
||||
assert_nothing_raised { v.instance_eval { mv3 } }
|
||||
end
|
||||
|
||||
def test_protected_singleton
|
||||
bug4106 = '[ruby-core:33506]'
|
||||
a = Class.new do
|
||||
def meth
|
||||
:called
|
||||
end
|
||||
def test
|
||||
a = dup
|
||||
class << a
|
||||
protected :meth
|
||||
end
|
||||
a.meth
|
||||
end
|
||||
end.new
|
||||
called = nil
|
||||
assert_nothing_raised(NoMethodError, bug4106) {called = a.test}
|
||||
assert_equal(:called, called, bug4106)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue