mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* test/uri/*: translated RUNIT to Test::Unit.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4694 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
16658578a5
commit
12c8c18f09
7 changed files with 81 additions and 172 deletions
|
@ -1,27 +1,26 @@
|
|||
require 'runit/testcase'
|
||||
require 'runit/cui/testrunner'
|
||||
require 'test/unit'
|
||||
require 'uri/http'
|
||||
module URI
|
||||
class Generic
|
||||
def to_ary
|
||||
component_ary
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
class TestHTTP < RUNIT::TestCase
|
||||
module URI
|
||||
|
||||
|
||||
class TestHTTP < Test::Unit::TestCase
|
||||
def setup
|
||||
end
|
||||
|
||||
def teardown
|
||||
end
|
||||
|
||||
def uri_to_ary(uri)
|
||||
uri.class.component.collect {|c| uri.send(c)}
|
||||
end
|
||||
|
||||
def test_parse
|
||||
u = URI.parse('http://a')
|
||||
assert_kind_of(URI::HTTP, u)
|
||||
assert_equal(['http',
|
||||
nil, 'a', URI::HTTP.default_port,
|
||||
'', nil, nil], u.to_ary)
|
||||
'', nil, nil], uri_to_ary(u))
|
||||
end
|
||||
|
||||
def test_normalize
|
||||
|
@ -53,21 +52,12 @@ class TestHTTP < RUNIT::TestCase
|
|||
def test_select
|
||||
assert_equal(['http', 'a.b.c', 80], URI.parse('http://a.b.c/').select(:scheme, :host, :port))
|
||||
u = URI.parse('http://a.b.c/')
|
||||
assert_equal(u.to_ary, u.select(*u.component))
|
||||
assert_exception(ArgumentError) do
|
||||
assert_equal(uri_to_ary(u), u.select(*u.component))
|
||||
assert_raises(ArgumentError) do
|
||||
u.select(:scheme, :host, :not_exist, :port)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if $0 == __FILE__
|
||||
if ARGV.size == 0
|
||||
suite = TestHTTP.suite
|
||||
else
|
||||
suite = RUNIT::TestSuite.new
|
||||
ARGV.each do |testmethod|
|
||||
suite.add_test(TestHTTP.new(testmethod))
|
||||
end
|
||||
end
|
||||
RUNIT::CUI::TestRunner.run(suite)
|
||||
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue