ruby-changes:60875
From: Nobuyoshi <ko1@a...>
Date: Thu, 23 Apr 2020 09:48:12 +0900 (JST)
Subject: [ruby-changes:60875] da5bd0047d (master): Test for [Bug #16669]
https://git.ruby-lang.org/ruby.git/commit/?id=da5bd0047d From da5bd0047d6c961105da210c69d4c88421324b70 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/