Test for [Bug #16669]

This commit is contained in:
Nobuyoshi Nakada 2020-04-23 09:43:30 +09:00
parent de9d6a7a8c
commit da5bd0047d
No known key found for this signature in database
GPG Key ID: 7CD2805BFA3770C6

View File

@ -61,6 +61,14 @@ class TestDefined < Test::Unit::TestCase
f.attrasgn_test { |v| assert(v) }
end
def test_defined_undef
x = Object.new
def x.foo; end
assert(defined?(x.foo))
x.instance_eval {undef :foo}
assert(!defined?(x.foo), "undefed method should not be defined?")
end
def test_defined_yield
assert(defined_test) # not iterator
assert(!defined_test{}) # called as iterator