From bd2e4be9d0fa4937efa7811a999f5820ea868a9f Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Tue, 26 Nov 2024 10:47:12 +0900 Subject: [PATCH] Suppress deprecate warning of test class and use EnvUtil.suppress_warning. --- test/uri/test_common.rb | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/test/uri/test_common.rb b/test/uri/test_common.rb index e96f819..1e28347 100644 --- a/test/uri/test_common.rb +++ b/test/uri/test_common.rb @@ -10,23 +10,20 @@ def setup def teardown end - class Foo - include URI::REGEXP::PATTERN - end - - def test_fallback_constants - orig_verbose = $VERBOSE - $VERBOSE = nil + EnvUtil.suppress_warning do + class Foo + include URI::REGEXP::PATTERN + end - assert_raise(NameError) { URI::FOO } + def test_fallback_constants + assert_raise(NameError) { URI::FOO } - assert_equal URI::ABS_URI, URI::RFC2396_PARSER.regexp[:ABS_URI] - assert_equal URI::PATTERN, URI::RFC2396_Parser::PATTERN - assert_equal URI::REGEXP, URI::RFC2396_REGEXP - assert_equal URI::REGEXP::PATTERN, URI::RFC2396_REGEXP::PATTERN - assert_equal Foo::IPV4ADDR, URI::RFC2396_REGEXP::PATTERN::IPV4ADDR - ensure - $VERBOSE = orig_verbose + assert_equal URI::ABS_URI, URI::RFC2396_PARSER.regexp[:ABS_URI] + assert_equal URI::PATTERN, URI::RFC2396_Parser::PATTERN + assert_equal URI::REGEXP, URI::RFC2396_REGEXP + assert_equal URI::REGEXP::PATTERN, URI::RFC2396_REGEXP::PATTERN + assert_equal Foo::IPV4ADDR, URI::RFC2396_REGEXP::PATTERN::IPV4ADDR + end end def test_parser_switch