summaryrefslogtreecommitdiff
path: root/test/uri
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-03-21 16:03:59 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-03-21 16:03:59 +0000
commitb6e2c52857056b41de8391816fe373de47f32c84 (patch)
treed72904310edb3ec5f5667cfa15c757c005757189 /test/uri
parent7506fde3e911100ccca169eff3a5f4916e8ed1da (diff)
Docs and tests on URI.hierarchical?, URI.absolute?
Improve code coverage and clarify meaning of hierarchical based on RFC text. [Fix GH-1846] From: Xavier Riley <xavriley@hotmail.com> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62882 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/uri')
-rw-r--r--test/uri/test_generic.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/uri/test_generic.rb b/test/uri/test_generic.rb
index 7e428aa849..31aa5c7552 100644
--- a/test/uri/test_generic.rb
+++ b/test/uri/test_generic.rb
@@ -774,6 +774,24 @@ class URI::TestGeneric < Test::Unit::TestCase
assert_equal 'http://example', uri.to_s
end
+ def test_hierarchical
+ hierarchical = URI.parse('http://a.b.c/example')
+ opaque = URI.parse('mailto:mduerst@ifi.unizh.ch')
+
+ assert hierarchical.hierarchical?
+ refute opaque.hierarchical?
+ end
+
+ def test_absolute
+ abs_uri = URI.parse('http://a.b.c/')
+ not_abs = URI.parse('a.b.c')
+
+ refute not_abs.absolute?
+
+ assert abs_uri.absolute
+ assert abs_uri.absolute?
+ end
+
def test_ipv6
assert_equal("[::1]", URI("http://[::1]/bar/baz").host)
assert_equal("::1", URI("http://[::1]/bar/baz").hostname)