From 23473d1f9fc33151f0d5804e0cca824794a0bfe6 Mon Sep 17 00:00:00 2001 From: knu Date: Mon, 13 Feb 2012 14:02:26 +0000 Subject: * vm_method.c (rb_method_boundp): obj.respond_to?(:a_protected_method) should return false because calling a protected method may cause NoMethodError if called from outside the class inheritance tree. Kernel#respond_to? is mostly used to test if it is safe to call a method, so the false positive should be avoided. [ruby-dev:40461] [ruby-dev:41739] [ruby-dev:41837] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34582 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_method.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test/ruby/test_method.rb') diff --git a/test/ruby/test_method.rb b/test/ruby/test_method.rb index 2cc0de5409..8dbca7dd3c 100644 --- a/test/ruby/test_method.rb +++ b/test/ruby/test_method.rb @@ -420,7 +420,7 @@ class TestMethod < Test::Unit::TestCase assert_equal(true, respond_to?(:mv1)) assert_equal(false, respond_to?(:mv2)) - assert_equal(true, respond_to?(:mv3)) + assert_equal(false, respond_to?(:mv3)) assert_equal(true, respond_to?(:mv1, true)) assert_equal(true, respond_to?(:mv2, true)) @@ -442,7 +442,7 @@ class TestMethod < Test::Unit::TestCase assert_equal(true, v.respond_to?(:mv1)) assert_equal(false, v.respond_to?(:mv2)) - assert_equal(true, v.respond_to?(:mv3)) + assert_equal(false, v.respond_to?(:mv3)) assert_equal(true, v.respond_to?(:mv1, true)) assert_equal(true, v.respond_to?(:mv2, true)) -- cgit v1.2.3