mirror of
https://github.com/ruby/ruby.git
synced 2025-09-15 16:44:01 +02:00
Add category to rb_warn_deprecated
PR https://github.com/ruby/ruby/pull/3418 added a category to `rb_warn_deprecated_to_remove` but not to `rb_warn_deprecated`. This adds the same code to `rb_warn_deprecated` so that those warnings also get a category. This change also adds tests for `rb_warn_deprecated` and updates the tests for `rb_warn_deprecated_to_remove` to have clearer names. I've fixed the call to `rb_method_entry` as we need to be using the instance method, not singleton. Feature: https://bugs.ruby-lang.org/issues/17122
This commit is contained in:
parent
54fb8fb62a
commit
eada635033
Notes:
git
2020-09-03 04:44:56 +09:00
2 changed files with 31 additions and 4 deletions
|
@ -960,13 +960,25 @@ $stderr = $stdout; raise "\x82\xa0"') do |outs, errs, status|
|
|||
assert_equal(["\n"], capture_warning_warn {warn ""})
|
||||
end
|
||||
|
||||
def test_warn_backwards_compatibility
|
||||
def test_warn_deprecated_backwards_compatibility_category
|
||||
warning = capture_warning_warn { Dir.exists?("non-existent") }
|
||||
|
||||
assert_match(/deprecated/, warning[0])
|
||||
end
|
||||
|
||||
def test_warn_deprecated_category
|
||||
warning = capture_warning_warn(category: true) { Dir.exists?("non-existent") }
|
||||
|
||||
assert_equal :deprecated, warning[0][1]
|
||||
end
|
||||
|
||||
def test_warn_deprecated_to_remove_backwards_compatibility_category
|
||||
warning = capture_warning_warn { Object.new.tainted? }
|
||||
|
||||
assert_match(/deprecated/, warning[0])
|
||||
end
|
||||
|
||||
def test_warn_category
|
||||
def test_warn_deprecated_to_remove_category
|
||||
warning = capture_warning_warn(category: true) { Object.new.tainted? }
|
||||
|
||||
assert_equal :deprecated, warning[0][1]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue