aboutsummaryrefslogtreecommitdiffstats
path: root/test/uri
diff options
context:
space:
mode:
authorknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-11-21 07:26:53 +0000
committerknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-11-21 07:26:53 +0000
commitd3edb4a85e08bbcd208f0a201f187d9ddd0a918d (patch)
tree4d5c364cce20a3106d4789f8b96d986b89accf8b /test/uri
parentf0dfcefa48654318286e37f853971178b1ff593f (diff)
downloadruby-d3edb4a85e08bbcd208f0a201f187d9ddd0a918d.tar.gz
* test/uri/test_generic.rb (URI#test_merge): Test uri + URI(path)
in addition to uri + path. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43751 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/uri')
-rw-r--r--test/uri/test_generic.rb34
1 files changed, 25 insertions, 9 deletions
diff --git a/test/uri/test_generic.rb b/test/uri/test_generic.rb
index e8becd5b8e..b5b1fc1c26 100644
--- a/test/uri/test_generic.rb
+++ b/test/uri/test_generic.rb
@@ -152,15 +152,31 @@ class URI::TestGeneric < Test::Unit::TestCase
u3 = URI.parse('http://foo/bar')
u4 = URI.parse('http://foo/bar/')
- assert_equal(URI.parse('http://foo/baz'), u1 + 'baz')
- assert_equal(URI.parse('http://foo/baz'), u2 + 'baz')
- assert_equal(URI.parse('http://foo/baz'), u3 + 'baz')
- assert_equal(URI.parse('http://foo/bar/baz'), u4 + 'baz')
-
- assert_equal(URI.parse('http://foo/baz'), u1 + '/baz')
- assert_equal(URI.parse('http://foo/baz'), u2 + '/baz')
- assert_equal(URI.parse('http://foo/baz'), u3 + '/baz')
- assert_equal(URI.parse('http://foo/baz'), u4 + '/baz')
+ {
+ u1 => {
+ 'baz' => 'http://foo/baz',
+ '/baz' => 'http://foo/baz',
+ },
+ u2 => {
+ 'baz' => 'http://foo/baz',
+ '/baz' => 'http://foo/baz',
+ },
+ u3 => {
+ 'baz' => 'http://foo/baz',
+ '/baz' => 'http://foo/baz',
+ },
+ u4 => {
+ 'baz' => 'http://foo/bar/baz',
+ '/baz' => 'http://foo/baz',
+ },
+ }.each { |base, map|
+ map.each { |url, result|
+ expected = URI.parse(result)
+ uri = URI.parse(url)
+ assert_equal expected, base + url, "<#{base}> + #{url.inspect} to become <#{expected}>"
+ assert_equal expected, base + uri, "<#{base}> + <#{uri}> to become <#{expected}>"
+ }
+ }
url = URI.parse('http://hoge/a.html') + 'b.html'
assert_equal('http://hoge/b.html', url.to_s, "[ruby-dev:11508]")