summaryrefslogtreecommitdiff
path: root/test/net
diff options
context:
space:
mode:
authorshugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-10-09 08:29:36 +0000
committershugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-10-09 08:29:36 +0000
commit3e70f44ae9ab258b36df248e0f42539530fd8d72 (patch)
treee981193127eb6dac00ba7b0f1ccc463f49cfcb12 /test/net
parent29e9230bc5422689493f6fb43378a920246809df (diff)
* lib/net/ftp.rb (parse257): refactor.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52095 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/net')
-rw-r--r--test/net/ftp/test_ftp.rb20
1 files changed, 19 insertions, 1 deletions
diff --git a/test/net/ftp/test_ftp.rb b/test/net/ftp/test_ftp.rb
index ae3649ec1c..cd84733b2c 100644
--- a/test/net/ftp/test_ftp.rb
+++ b/test/net/ftp/test_ftp.rb
@@ -1318,8 +1318,26 @@ EOF
end
end
- private
+ def test_parse257
+ ftp = Net::FTP.new
+ assert_equal('/foo/bar',
+ ftp.send(:parse257, '257 "/foo/bar" directory created'))
+ assert_equal('/foo/bar"baz',
+ ftp.send(:parse257, '257 "/foo/bar""baz" directory created'))
+ assert_equal('/foo/x"y"z',
+ ftp.send(:parse257, '257 "/foo/x""y""z" directory created'))
+ assert_equal('/foo/bar',
+ ftp.send(:parse257, '257 "/foo/bar" "comment"'))
+ assert_equal('',
+ ftp.send(:parse257, '257 "" directory created'))
+ assert_equal('',
+ ftp.send(:parse257, '257 directory created'))
+ assert_raise(Net::FTPReplyError) do
+ ftp.send(:parse257, "500 Syntax error")
+ end
+ end
+ private
def create_ftp_server(sleep_time = nil)
server = TCPServer.new(SERVER_ADDR, 0)