From 441546edcfbb1b346c87b69c5f578d1a0e522e06 Mon Sep 17 00:00:00 2001 From: shyouhei Date: Mon, 7 Jul 2008 07:36:34 +0000 Subject: add tag v1_8_6_269 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/tags/v1_8_6_269@17937 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ruby_1_8_6/test/uri/test_ftp.rb | 42 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 ruby_1_8_6/test/uri/test_ftp.rb (limited to 'ruby_1_8_6/test/uri/test_ftp.rb') diff --git a/ruby_1_8_6/test/uri/test_ftp.rb b/ruby_1_8_6/test/uri/test_ftp.rb new file mode 100644 index 0000000000..a7b59efebf --- /dev/null +++ b/ruby_1_8_6/test/uri/test_ftp.rb @@ -0,0 +1,42 @@ +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 -- cgit v1.2.3