summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-05-20 22:29:17 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-05-20 22:29:17 +0000
commit176061e317b0285908fa360d8b28b6e0c6bb202a (patch)
tree0771236b6f411e267dcdee34b83a6294bff9ae4d /test
parent79a569f458e1ea58d3bf5fe6ddc9604994616daf (diff)
merge revision(s) 31578:
* lib/uri/generic.rb (#route_from_path): Fix a bug where URI('http://h/b/').route_to('http://h/b') wrongly returned './' (should be '../b'). [Bug #4476] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@31578 b2dd03c8-39d4-4d8f-98ff-823fe69b080e Signed-off-by: URABE, Shyouhei <shyouhei@ruby-lang.org> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@31666 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/uri/test_generic.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/uri/test_generic.rb b/test/uri/test_generic.rb
index 5cd4c7f7ae..67d6aa1333 100644
--- a/test/uri/test_generic.rb
+++ b/test/uri/test_generic.rb
@@ -231,8 +231,19 @@ class TestGeneric < Test::Unit::TestCase
url = URI.parse('http://hoge/a/b/').route_to('http://MOGE/b/')
assert_equal('//MOGE/b/', url.to_s)
+ url = URI.parse('http://hoge/b').route_to('http://hoge/b/')
+ assert_equal('b/', url.to_s)
+ url = URI.parse('http://hoge/b/a').route_to('http://hoge/b/')
+ assert_equal('./', url.to_s)
+ url = URI.parse('http://hoge/b/').route_to('http://hoge/b')
+ assert_equal('../b', url.to_s)
+ url = URI.parse('http://hoge/b').route_to('http://hoge/b:c')
+ assert_equal('./b:c', url.to_s)
+
url = URI.parse('file:///a/b/').route_to('file:///a/b/')
assert_equal('', url.to_s)
+ url = URI.parse('file:///a/b/').route_to('file:///a/b')
+ assert_equal('../b', url.to_s)
url = URI.parse('mailto:foo@example.com').route_to('mailto:foo@example.com#bar')
assert_equal('#bar', url.to_s)