1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Enable deprecation warnings for test-all

* So deprecated methods/constants/functions are dealt with early,
  instead of many tests breaking suddenly when removing a deprecated
  method/constant/function.
* Follows https://bugs.ruby-lang.org/issues/17591
This commit is contained in:
Benoit Daloze 2022-09-03 15:47:49 +02:00
parent 5e39b3b844
commit 92b907d12d
Notes: git 2022-09-10 20:14:40 +09:00
2 changed files with 16 additions and 1 deletions

View file

@ -1053,7 +1053,7 @@ $stderr = $stdout; raise "\x82\xa0"') do |outs, errs, status|
warning << [str, category]
end
else
define_method(:warn) do |str|
define_method(:warn) do |str, category: nil|
warning << str
end
end

View file

@ -1,5 +1,20 @@
# frozen_string_literal: true
# Enable deprecation warnings for test-all, so deprecated methods/constants/functions are dealt with early.
Warning[:deprecated] = true
if ENV['BACKTRACE_FOR_DEPRECATION_WARNINGS']
Warning.extend Module.new {
def warn(message, category: nil, **kwargs)
if category == :deprecated and $stderr.respond_to?(:puts)
$stderr.puts nil, message, caller, nil
else
super
end
end
}
end
require_relative '../envutil'
require_relative '../colorize'
require_relative '../leakchecker'