From 835693dac5bd2d38cac972adbfd7980c305435a4 Mon Sep 17 00:00:00 2001 From: knu Date: Fri, 15 Apr 2011 06:13:08 +0000 Subject: * 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/trunk@31288 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/uri/test_generic.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'test') diff --git a/test/uri/test_generic.rb b/test/uri/test_generic.rb index 821b147fa0..1866b37f54 100644 --- a/test/uri/test_generic.rb +++ b/test/uri/test_generic.rb @@ -222,6 +222,9 @@ class URI::TestGeneric < Test::Unit::TestCase url = URI.parse('http://hoge/a/b/').route_to('http://hoge/b/') assert_equal('../../b/', url.to_s) + url = URI.parse('http://hoge/a/b/').route_to('http://hoge/a/b') + assert_equal('../b', url.to_s) + url = URI.parse('http://hoge/a/b/').route_to('http://HOGE/b/') assert_equal('../../b/', url.to_s) @@ -230,6 +233,8 @@ class URI::TestGeneric < Test::Unit::TestCase 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) -- cgit v1.2.3