Skip to content

Commit

Permalink
Suppress deprecate warning of test class and use EnvUtil.suppress_war…
Browse files Browse the repository at this point in the history
…ning.
  • Loading branch information
hsbt committed Nov 26, 2024
1 parent 22f5a7a commit bd2e4be
Showing 1 changed file with 12 additions and 15 deletions.
27 changes: 12 additions & 15 deletions test/uri/test_common.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit bd2e4be

Please sign in to comment.