From da5bd0047d6c961105da210c69d4c88421324b70 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Thu, 23 Apr 2020 09:43:30 +0900 Subject: [PATCH] Test for [Bug #16669] --- test/ruby/test_defined.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/ruby/test_defined.rb b/test/ruby/test_defined.rb index d254857dea..267744ef08 100644 --- a/test/ruby/test_defined.rb +++ b/test/ruby/test_defined.rb @@ -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