diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-10-23 05:09:35 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-10-23 05:09:35 +0000 |
commit | 71a7ef31d7d6343468db164804340920e17c2705 (patch) | |
tree | 7c5d97eb55a5d24a24636abc20fd305e8ea7d5d8 /test/ruby/test_io.rb | |
parent | 92023a8f60a6c75428ce595e2e2680f377714396 (diff) |
io.c: fix buffered output
* io.c (io_binwritev): append to buffered data, not overwriting.
[Feature #9323]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60372 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_io.rb')
-rw-r--r-- | test/ruby/test_io.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb index 122e63da3a..1fa9dbb443 100644 --- a/test/ruby/test_io.rb +++ b/test/ruby/test_io.rb @@ -1225,6 +1225,20 @@ class TestIO < Test::Unit::TestCase end) end + def test_write_with_multiple_arguments_and_buffer + mkcdtmpdir do + line = "x"*9+"\n" + file = "test.out" + open(file, "wb") do |w| + w.write(line) + assert_equal(11, w.write(line, "\n")) + end + open(file, "rb") do |r| + assert_equal([line, line, "\n"], r.readlines) + end + end + end + def test_write_with_many_arguments [1023, 1024].each do |n| pipe(proc do |w| |