mirror of
https://github.com/ruby/ruby.git
synced 2026-01-26 20:19:19 +00:00
This commit is contained in:
parent
946165bd48
commit
015d874133
@ -690,17 +690,15 @@ eom
|
||||
assert_warning(*args) {$VERBOSE = false; yield}
|
||||
end
|
||||
|
||||
def assert_deprecated_warning(mesg = /deprecated/)
|
||||
def assert_deprecated_warning(mesg = /deprecated/, &block)
|
||||
assert_warning(mesg) do
|
||||
Warning[:deprecated] = true if Warning.respond_to?(:[]=)
|
||||
yield
|
||||
EnvUtil.deprecation_warning(&block)
|
||||
end
|
||||
end
|
||||
|
||||
def assert_deprecated_warn(mesg = /deprecated/)
|
||||
assert_warn(mesg) do
|
||||
Warning[:deprecated] = true if Warning.respond_to?(:[]=)
|
||||
yield
|
||||
EnvUtil.deprecation_warning(&block)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -297,6 +297,21 @@ module EnvUtil
|
||||
end
|
||||
module_function :verbose_warning
|
||||
|
||||
if defined?(Warning.[]=)
|
||||
def deprecation_warning
|
||||
previous_deprecated = Warning[:deprecated]
|
||||
Warning[:deprecated] = true
|
||||
yield
|
||||
ensure
|
||||
Warning[:deprecated] = previous_deprecated
|
||||
end
|
||||
else
|
||||
def deprecation_warning
|
||||
yield
|
||||
end
|
||||
end
|
||||
module_function :deprecation_warning
|
||||
|
||||
def default_warning
|
||||
$VERBOSE = false
|
||||
yield
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user