diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-10-06 03:30:49 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-10-06 03:30:49 +0000 |
commit | 5fd45a4b79dd26f9e7b6dc41142912df911e4d7d (patch) | |
tree | 7cdb7ea6a408e863811acd5ba6c44ad0380fe6b1 /test | |
parent | 915ae780c37478fea358d6c77513a728e86a10f2 (diff) | |
download | ruby-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')
-rw-r--r-- | test/uri/test_generic.rb | 10 |
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 |