1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/uri/generic.rb (URI::Generic.build): duplicate args before adding

new items. (don't change arguments)

* lib/uri/generic.rb (URI::Generic.build): use URI::Generic::COMPONENT
  if this method is called from URI::Generic.

* lib/uri/generic.rb (URI::Generic.build2): escape only if the item is
  a String.

* lib/uri/generic.rb (URI::Generic.build2): use DEFAULT_PARSER because
  it doesn't have parser method. [Bug #6420]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35692 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2012-05-18 07:32:08 +00:00
parent 69305da74d
commit 9381cd1184
3 changed files with 29 additions and 5 deletions

View file

@ -723,4 +723,13 @@ class URI::TestGeneric < Test::Unit::TestCase
u.hostname = "::1"
assert_equal("http://[::1]/bar", u.to_s)
end
def test_build
URI::Generic.build(['http', nil, 'example.com', 80, nil, '/foo', nil, nil, nil])
end
def test_build2
URI::Generic.build2(path: "/foo bar/baz")
URI::Generic.build2(['http', nil, 'example.com', 80, nil, '/foo bar' , nil, nil, nil])
end
end