diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-12-03 03:17:22 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-12-03 03:17:22 +0000 |
commit | adc978adc3932e5fdeb0bdc0622d2f52bf846dba (patch) | |
tree | a905fb5a5803c4cf0a4982ef19f92829ce0c8ee5 /test/ruby/test_method.rb | |
parent | bfcd4e54538b1dd415ed1f3bebe482df11b383c2 (diff) | |
download | ruby-adc978adc3932e5fdeb0bdc0622d2f52bf846dba.tar.gz |
* 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
Diffstat (limited to 'test/ruby/test_method.rb')
-rw-r--r-- | test/ruby/test_method.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/ruby/test_method.rb b/test/ruby/test_method.rb index da17ef5e9c..2f3ba3ebd6 100644 --- a/test/ruby/test_method.rb +++ b/test/ruby/test_method.rb @@ -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 |