[ruby/uri] Restore constants like URI::REGEXP::PATTERN::IPV6ADDR
https://github.com/ruby/uri/commit/ee9a38701a
This commit is contained in:
parent
e97dcf53a2
commit
1d6c986104
@ -536,4 +536,11 @@ module URI
|
||||
end
|
||||
|
||||
end # class Parser
|
||||
|
||||
# Backward compatibility for URI::REGEXP::PATTERN::*
|
||||
RFC2396_Parser.new.pattern.each_pair do |sym, str|
|
||||
unless RFC2396_REGEXP::PATTERN.const_defined?(sym)
|
||||
RFC2396_REGEXP::PATTERN.const_set(sym, str)
|
||||
end
|
||||
end
|
||||
end # module URI
|
||||
|
@ -10,6 +10,10 @@ class URI::TestCommon < Test::Unit::TestCase
|
||||
def teardown
|
||||
end
|
||||
|
||||
class Foo
|
||||
include URI::REGEXP::PATTERN
|
||||
end
|
||||
|
||||
def test_fallback_constants
|
||||
orig_verbose = $VERBOSE
|
||||
$VERBOSE = nil
|
||||
@ -19,6 +23,8 @@ class URI::TestCommon < Test::Unit::TestCase
|
||||
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
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user