aboutsummaryrefslogtreecommitdiffstats
path: root/test/uri
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-10-06 03:30:49 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-10-06 03:30:49 +0000
commit5fd45a4b79dd26f9e7b6dc41142912df911e4d7d (patch)
tree7cdb7ea6a408e863811acd5ba6c44ad0380fe6b1 /test/uri
parent915ae780c37478fea358d6c77513a728e86a10f2 (diff)
downloadruby-5fd45a4b79dd26f9e7b6dc41142912df911e4d7d.tar.gz
* lib/uri/generic.rb (URI::Generic#hostname): new method.
(URI::Generic#hostname=): ditto. * lib/open-uri.rb: use URI#hostname * lib/net/http.rb: ditto. [ruby-core:32056] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29416 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/uri')
-rw-r--r--test/uri/test_generic.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/uri/test_generic.rb b/test/uri/test_generic.rb
index fcaa599724..821b147fa0 100644
--- a/test/uri/test_generic.rb
+++ b/test/uri/test_generic.rb
@@ -695,4 +695,14 @@ class URI::TestGeneric < Test::Unit::TestCase
assert_raise(URI::InvalidURIError) { uri.path = 'bar' }
assert_raise(URI::InvalidURIError) { uri.query = 'bar' }
end
+
+ def test_ipv6
+ assert_equal("[::1]", URI("http://[::1]/bar/baz").host)
+ assert_equal("::1", URI("http://[::1]/bar/baz").hostname)
+
+ u = URI("http://foo/bar")
+ assert_equal("http://foo/bar", u.to_s)
+ u.hostname = "::1"
+ assert_equal("http://[::1]/bar", u.to_s)
+ end
end