ruby-changes:31672
From: knu <ko1@a...>
Date: Thu, 21 Nov 2013 16:27:12 +0900 (JST)
Subject: [ruby-changes:31672] knu:r43751 (trunk): * test/uri/test_generic.rb (URI#test_merge): Test uri + URI(path)
knu 2013-11-21 16:26:53 +0900 (Thu, 21 Nov 2013) New Revision: 43751 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=43751 Log: * test/uri/test_generic.rb (URI#test_merge): Test uri + URI(path) in addition to uri + path. Modified files: trunk/ChangeLog trunk/test/uri/test_generic.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 43750) +++ ChangeLog (revision 43751) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Thu Nov 21 16:25:08 2013 Akinori MUSHA <knu@i...> + + * test/uri/test_generic.rb (URI#test_merge): Test uri + URI(path) + in addition to uri + path. + Thu Nov 21 15:36:08 2013 Zachary Scott <e@z...> * ext/openssl/lib/openssl/buffering.rb: [DOC] Fix HEREDOC comment for Index: test/uri/test_generic.rb =================================================================== --- test/uri/test_generic.rb (revision 43750) +++ test/uri/test_generic.rb (revision 43751) @@ -152,15 +152,31 @@ class URI::TestGeneric < Test::Unit::Tes https://github.com/ruby/ruby/blob/trunk/test/uri/test_generic.rb#L152 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]") -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/