From 03e7b266a7be342e22c00725040266c1abbcba59 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Fri, 15 Mar 2024 18:31:59 +0900 Subject: [PATCH] Test deprecation warning with `$;` --- test/ruby/test_exception.rb | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/test/ruby/test_exception.rb b/test/ruby/test_exception.rb index aa94968699..19b12ace70 100644 --- a/test/ruby/test_exception.rb +++ b/test/ruby/test_exception.rb @@ -1111,19 +1111,13 @@ $stderr = $stdout; raise "\x82\xa0"') do |outs, errs, status| end def test_warn_deprecated_backwards_compatibility_category - omit "no method to test" + (message, category), = capture_warning_warn(category: true) do + $; = "www" + $; = nil + end - warning = capture_warning_warn { } - - assert_match(/deprecated/, warning[0]) - end - - def test_warn_deprecated_category - omit "no method to test" - - warning = capture_warning_warn(category: true) { } - - assert_equal :deprecated, warning[0][1] + assert_include message, 'deprecated' + assert_equal :deprecated, category end def test_kernel_warn_uplevel