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 aa94968699f0c8..19b12ace700e76 100644 --- a/test/ruby/test_exception.rb +++ b/test/ruby/test_exception.rb @@ -1111,19 +1111,13 @@ def test_warning_warn end def test_warn_deprecated_backwards_compatibility_category - omit "no method to test" - - 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) { } + (message, category), = capture_warning_warn(category: true) do + $; = "www" + $; = nil + end - assert_equal :deprecated, warning[0][1] + assert_include message, 'deprecated' + assert_equal :deprecated, category end def test_kernel_warn_uplevel