summaryrefslogtreecommitdiff
path: root/test/net
diff options
context:
space:
mode:
authorshugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-09-10 06:16:37 +0000
committershugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-09-10 06:16:37 +0000
commit5c09cb9c1e38fd262e2af4e6ddda0069384a0ebd (patch)
treed4bfaeb0dc97282635c83460437faa80d4f2a36a /test/net
parentffe47606ccab45da710ee5f46d28bf7c2ea3305e (diff)
* lib/net/ftp.rb (getmultiline): refactor.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51818 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/net')
-rw-r--r--test/net/ftp/test_ftp.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/net/ftp/test_ftp.rb b/test/net/ftp/test_ftp.rb
index ad8ef5a..e42168e 100644
--- a/test/net/ftp/test_ftp.rb
+++ b/test/net/ftp/test_ftp.rb
@@ -1025,6 +1025,34 @@ EOF
end
end
+ def test_getmultiline
+ server = create_ftp_server { |sock|
+ sock.print("220 (test_ftp).\r\n")
+ sock.print("123- foo\r\n")
+ sock.print("bar\r\n")
+ sock.print(" 123 baz\r\n")
+ sock.print("123 quux\r\n")
+ sock.print("123 foo\r\n")
+ sock.print("foo\r\n")
+ sock.print("\r\n")
+ }
+ begin
+ begin
+ ftp = Net::FTP.new
+ ftp.connect(SERVER_ADDR, server.port)
+ assert_equal("123- foo\nbar\n 123 baz\n123 quux\n",
+ ftp.send(:getmultiline))
+ assert_equal("123 foo\n", ftp.send(:getmultiline))
+ assert_equal("foo\n", ftp.send(:getmultiline))
+ assert_equal("\n", ftp.send(:getmultiline))
+ ensure
+ ftp.close if ftp
+ end
+ ensure
+ server.close
+ end
+ end
+
private