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,22 +1,10 @@
|
|||
#
|
||||
# $Id$
|
||||
#
|
||||
# Copyright (c) 2002 akira yamada <akira@ruby-lang.org>
|
||||
# You can redistribute it and/or modify it under the same term as Ruby.
|
||||
#
|
||||
|
||||
require 'runit/testcase'
|
||||
require 'runit/cui/testrunner'
|
||||
require 'test/unit'
|
||||
require 'uri'
|
||||
module URI
|
||||
class Generic
|
||||
def to_ary
|
||||
component_ary
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
class TestGeneric < RUNIT::TestCase
|
||||
module URI
|
||||
|
||||
|
||||
class TestGeneric < Test::Unit::TestCase
|
||||
def setup
|
||||
@url = 'http://a/b/c/d;p?q'
|
||||
@base_url = URI.parse(@url)
|
||||
|
@ -25,6 +13,10 @@ class TestGeneric < RUNIT::TestCase
|
|||
def teardown
|
||||
end
|
||||
|
||||
def uri_to_ary(uri)
|
||||
uri.class.component.collect {|c| uri.send(c)}
|
||||
end
|
||||
|
||||
def test_parse
|
||||
# 0
|
||||
assert_kind_of(URI::HTTP, @base_url)
|
||||
|
@ -36,7 +28,7 @@ class TestGeneric < RUNIT::TestCase
|
|||
'q',
|
||||
nil
|
||||
]
|
||||
ary = @base_url.to_ary
|
||||
ary = uri_to_ary(@base_url)
|
||||
assert_equal(exp, ary)
|
||||
|
||||
# 1
|
||||
|
@ -48,7 +40,7 @@ class TestGeneric < RUNIT::TestCase
|
|||
nil, 'ftp.is.co.za', URI::FTP.default_port,
|
||||
'/rfc/rfc1808.txt', nil,
|
||||
]
|
||||
ary = url.to_ary
|
||||
ary = uri_to_ary(url)
|
||||
assert_equal(exp, ary)
|
||||
|
||||
# 2
|
||||
|
@ -62,7 +54,7 @@ class TestGeneric < RUNIT::TestCase
|
|||
nil,
|
||||
nil
|
||||
]
|
||||
ary = url.to_ary
|
||||
ary = uri_to_ary(url)
|
||||
assert_equal(exp, ary)
|
||||
|
||||
# 3
|
||||
|
@ -76,7 +68,7 @@ class TestGeneric < RUNIT::TestCase
|
|||
nil,
|
||||
nil
|
||||
]
|
||||
ary = url.to_ary
|
||||
ary = uri_to_ary(url)
|
||||
assert_equal(exp, ary)
|
||||
|
||||
# 4
|
||||
|
@ -88,7 +80,7 @@ class TestGeneric < RUNIT::TestCase
|
|||
'mduerst@ifi.unizh.ch',
|
||||
[]
|
||||
]
|
||||
ary = url.to_ary
|
||||
ary = uri_to_ary(url)
|
||||
assert_equal(exp, ary)
|
||||
|
||||
# 5
|
||||
|
@ -102,7 +94,7 @@ class TestGeneric < RUNIT::TestCase
|
|||
nil,
|
||||
nil
|
||||
]
|
||||
ary = url.to_ary
|
||||
ary = uri_to_ary(url)
|
||||
assert_equal(exp, ary)
|
||||
|
||||
# 6
|
||||
|
@ -116,13 +108,13 @@ class TestGeneric < RUNIT::TestCase
|
|||
nil,
|
||||
nil
|
||||
]
|
||||
ary = url.to_ary
|
||||
ary = uri_to_ary(url)
|
||||
assert_equal(exp, ary)
|
||||
|
||||
# 7
|
||||
# reported by Mr. Kubota <em6t-kbt@asahi-net.or.jp>
|
||||
assert_exception(URI::InvalidURIError) { URI.parse('http://a_b:80/') }
|
||||
assert_exception(URI::InvalidURIError) { URI.parse('http://a_b/') }
|
||||
assert_raises(URI::InvalidURIError) { URI.parse('http://a_b:80/') }
|
||||
assert_raises(URI::InvalidURIError) { URI.parse('http://a_b/') }
|
||||
|
||||
# 8
|
||||
# reporte by m_seki
|
||||
|
@ -621,14 +613,5 @@ class TestGeneric < RUNIT::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
if $0 == __FILE__
|
||||
if ARGV.size == 0
|
||||
suite = TestGeneric.suite
|
||||
else
|
||||
suite = RUNIT::TestSuite.new
|
||||
ARGV.each do |testmethod|
|
||||
suite.add_test(TestGeneric.new(testmethod))
|
||||
end
|
||||
end
|
||||
RUNIT::CUI::TestRunner.run(suite)
|
||||
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue