diff options
author | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-03-28 08:38:21 +0000 |
---|---|---|
committer | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-03-28 08:38:21 +0000 |
commit | 15cc40924affcb97e7e618c91c5ac11825a24e34 (patch) | |
tree | 27ad29a08fe0c64d8dfcb8877738717d11c90173 /test/ruby/test_io.rb | |
parent | cb37a13e6bd8fdb6d11cdd52dd860806d6a9af23 (diff) | |
download | ruby-15cc40924affcb97e7e618c91c5ac11825a24e34.tar.gz |
io.c: IO#write without args returns 0
This is consistent with other implementations of .write
in openssl and stringio.
* io.c (io_write_m): return 0 on argc == 0
[ruby-core:86285] [Bug #14338]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62967 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_io.rb')
-rw-r--r-- | test/ruby/test_io.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb index a271c9e677..43c3ed7566 100644 --- a/test/ruby/test_io.rb +++ b/test/ruby/test_io.rb @@ -1287,6 +1287,13 @@ class TestIO < Test::Unit::TestCase assert_empty(err) end + def test_write_no_args + IO.pipe do |r, w| + assert_equal 0, w.write, '[ruby-core:86285] [Bug #14338]' + assert_equal :wait_readable, r.read_nonblock(1, exception: false) + end + end + def test_write_non_writable with_pipe do |r, w| assert_raise(IOError) do |