summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authorNobuyoshi Nakada <[email protected]>2021-01-23 19:57:07 +0900
committerNobuyoshi Nakada <[email protected]>2021-01-23 19:58:39 +0900
commit8dfae85adb96cf3da84bf38f2103969d4a7aed3f (patch)
tree8340fd057bce7a8db057d8bf3fc9795539b9fb92 /test/ruby
parent62283f7a7a87fa2f353814a3ef6a3b1cab2a32b8 (diff)
Warn the defined location as deprecation as well as the main message
[Bug #17575]
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_defined.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/ruby/test_defined.rb b/test/ruby/test_defined.rb
index b22db700da..73c192a0ae 100644
--- a/test/ruby/test_defined.rb
+++ b/test/ruby/test_defined.rb
@@ -258,6 +258,23 @@ class TestDefined < Test::Unit::TestCase
assert_separately([], "assert_nil(defined?(super))")
end
+ def test_respond_to
+ obj = "#{self.class.name}##{__method__}"
+ class << obj
+ def respond_to?(mid)
+ true
+ end
+ end
+ assert_warn(/deprecated method signature.*\n.*respond_to\? is defined here/) do
+ Warning[:deprecated] = true
+ defined?(obj.foo)
+ end
+ assert_warn('') do
+ Warning[:deprecated] = false
+ defined?(obj.foo)
+ end
+ end
+
class ExampleRespondToMissing
attr_reader :called