1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/test/uri/test_ftp.rb
akira 12c8c18f09 * test/uri/*: translated RUNIT to Test::Unit.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4694 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-10-05 06:09:26 +00:00

42 lines
881 B
Ruby

require 'test/unit'
require 'uri/ftp'
module URI
class TestFTP < Test::Unit::TestCase
def setup
end
def test_parse
url = URI.parse('ftp://user:pass@host.com/abc/def')
assert_kind_of(URI::FTP, url)
exp = [
'ftp',
'user:pass', 'host.com', URI::FTP.default_port,
'/abc/def', nil,
]
ary = [
url.scheme, url.userinfo, url.host, url.port,
url.path, url.opaque
]
assert_equal(exp, ary)
assert_equal('user', url.user)
assert_equal('pass', url.password)
end
def test_select
assert_equal(['ftp', 'a.b.c', 21], URI.parse('ftp://a.b.c/').select(:scheme, :host, :port))
u = URI.parse('ftp://a.b.c/')
ary = u.component.collect {|c| u.send(c)}
assert_equal(ary, u.select(*u.component))
assert_raises(ArgumentError) do
u.select(:scheme, :host, :not_exist, :port)
end
end
end
end