aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_method.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-12-03 03:17:22 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-12-03 03:17:22 +0000
commitadc978adc3932e5fdeb0bdc0622d2f52bf846dba (patch)
treea905fb5a5803c4cf0a4982ef19f92829ce0c8ee5 /test/ruby/test_method.rb
parentbfcd4e54538b1dd415ed1f3bebe482df11b383c2 (diff)
downloadruby-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.rb19
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