diff options
author | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-01-06 09:21:35 +0000 |
---|---|---|
committer | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-01-06 09:21:35 +0000 |
commit | d879313b4379516b1773b9d1896ea4dadb5dda2e (patch) | |
tree | 3d9a3b7230457e2aeb91bca12b066e5b5de50ddc /test | |
parent | 96cc53e50e1d9c40c3efedaf59e62e035da9822d (diff) | |
download | ruby-d879313b4379516b1773b9d1896ea4dadb5dda2e.tar.gz |
net/ftp: fix FrozenError in BufferedSocket
I noticed this bug while working on something else with
RUBYOPT=-d on, existing test cases all passed with it.
Note: I use String.new because it is the local style, here,
I prefer +'' (or ''.b, for a future commit)
* lib/net/ftp.rb (BufferedSocket#read): use String.new
* test/net/ftp/test_buffered_socket.rb (test_read_nil): new test
[ruby-core:84675] [Bug #14323]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61639 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/net/ftp/test_buffered_socket.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/test/net/ftp/test_buffered_socket.rb b/test/net/ftp/test_buffered_socket.rb index 3cc46fa555..875c53f4e0 100644 --- a/test/net/ftp/test_buffered_socket.rb +++ b/test/net/ftp/test_buffered_socket.rb @@ -33,6 +33,12 @@ class BufferedSocketTest < Test::Unit::TestCase assert_equal("bar", sock.gets) end + def test_read_nil + sock = create_buffered_socket("foo\nbar") + assert_equal("foo\nbar", sock.read) + assert_equal("", sock.read) + end + private def create_buffered_socket(s) |