summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-05-29 22:50:20 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-05-29 22:50:20 +0000
commitbc5aeb987f21514f2a96cb3f5ffad33855612c8a (patch)
treed2aae631a17f0a01250ede6d5a2116f8049b416b /test
parentf0de89f81ae37ed8b12427c375bc5ad06bcfba0e (diff)
merges r31288 and r31289 from trunk into ruby_1_9_2.
-- * 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] -- Add some more tests for the previous fix. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@31804 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 fcaa599724..3b3f7ceb4f 100644
--- a/test/uri/test_generic.rb
+++ b/test/uri/test_generic.rb
@@ -228,8 +228,19 @@ class URI::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)