diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2020-04-23 09:43:30 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2020-04-23 09:43:30 +0900 |
commit | da5bd0047d6c961105da210c69d4c88421324b70 (patch) | |
tree | 9cae90477b91872058107abecd94eb219c3435dc | |
parent | de9d6a7a8cb0929e0b4cf0a3120971c7b8ee8927 (diff) | |
download | ruby-da5bd0047d6c961105da210c69d4c88421324b70.tar.gz |
Test for [Bug #16669]
-rw-r--r-- | test/ruby/test_defined.rb | 8 |
1 files changed, 8 insertions, 0 deletions
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 |