summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-02-13 14:02:26 +0000
committerknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-02-13 14:02:26 +0000
commit23473d1f9fc33151f0d5804e0cca824794a0bfe6 (patch)
treed18f506bf0d26b9a3847b3f9064456773274eb20 /test
parent261400e7a9b4e8774a058e9a6f53fc885329c5f8 (diff)
* 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
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_method.rb4
1 files changed, 2 insertions, 2 deletions
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))