aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authornagachika <nagachika@ruby-lang.org>2020-08-01 17:33:56 +0900
committernagachika <nagachika@ruby-lang.org>2020-08-01 17:33:56 +0900
commit23d130a9ddcaf766d6ce309f8518b434a2537fc1 (patch)
tree55c67e3ca38c6145be68346701c8a56d71ab78ac /test
parent315f1ee8a80680fd7aff5fa27abfd965d1906809 (diff)
downloadruby-23d130a9ddcaf766d6ce309f8518b434a2537fc1.tar.gz
merge revision(s) d05f04d27dd86c67e4a8dfff4392f806cf577bdf: [Backport #16931]
Fixed `defined?` against protected method call Protected methods are restricted to be called according to the class/module in where it is defined, not the actual receiver's class. [Bug #16931]
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_defined.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/test/ruby/test_defined.rb b/test/ruby/test_defined.rb
index 387472a62d..e1571d5714 100644
--- a/test/ruby/test_defined.rb
+++ b/test/ruby/test_defined.rb
@@ -59,6 +59,7 @@ class TestDefined < Test::Unit::TestCase
f = Foo.new
assert_nil(defined?(f.foo)) # protected method
f.bar(f) { |v| assert(v) }
+ f.bar(Class.new(Foo).new) { |v| assert(v, "inherited protected method") }
end
def test_defined_undefined_method