1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/test/net/ftp/test_buffered_socket.rb
akr 68ebbbfebe * lib/open-uri.rb: Remove indicator for "frozen_string_literal: true".
* lib/pp.rb: Ditto.

* lib/prettyprint.rb: Ditto.

* lib/resolv.rb: Ditto.

* lib/securerandom.rb: Ditto.

* lib/tmpdir.rb: Ditto.

* lib/unicode_normalize/tables.rb: Ditto.

* test/net/ftp/test_buffered_socket.rb: Ditto.

* test/net/ftp/test_mlsx_entry.rb: Ditto.

* test/open-uri/test_open-uri.rb: Ditto.

* test/open-uri/test_ssl.rb: Ditto.

* test/pathname/test_pathname.rb: Ditto.

* test/test_pp.rb: Ditto.

* test/test_prettyprint.rb: Ditto.

* tool/transcode-tblgen.rb: Ditto.

* ext/pathname/lib/pathname.rb: Ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52526 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-10 11:48:14 +00:00

42 lines
929 B
Ruby

# frozen_string_literal: true
require "net/ftp"
require "test/unit"
require "ostruct"
require "stringio"
class BufferedSocketTest < Test::Unit::TestCase
def test_gets_empty
sock = create_buffered_socket("")
assert_equal(nil, sock.gets)
end
def test_gets_one_line
sock = create_buffered_socket("foo\n")
assert_equal("foo\n", sock.gets)
end
def test_gets_one_line_without_term
sock = create_buffered_socket("foo")
assert_equal("foo", sock.gets)
end
def test_gets_two_lines
sock = create_buffered_socket("foo\nbar\n")
assert_equal("foo\n", sock.gets)
assert_equal("bar\n", sock.gets)
end
def test_gets_two_lines_without_term
sock = create_buffered_socket("foo\nbar")
assert_equal("foo\n", sock.gets)
assert_equal("bar", sock.gets)
end
private
def create_buffered_socket(s)
io = StringIO.new(s)
return Net::FTP::BufferedSocket.new(io)
end
end