ruby-changes:62500
From: Nobuyoshi <ko1@a...>
Date: Sat, 1 Aug 2020 17:34:12 +0900 (JST)
Subject: [ruby-changes:62500] b222ae4101 (ruby_2_7): Test for [Bug #16669]
https://git.ruby-lang.org/ruby.git/commit/?id=b222ae4101 From b222ae41015646e238e1d2f6710da02f38578388 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Thu, 23 Apr 2020 09:43:30 +0900 Subject: Test for [Bug #16669] diff --git a/test/ruby/test_defined.rb b/test/ruby/test_defined.rb index d254857..267744e 100644 --- a/test/ruby/test_defined.rb +++ b/test/ruby/test_defined.rb @@ -61,6 +61,14 @@ class TestDefined < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_defined.rb#L61 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 -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/