diff options
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_io.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb index 402d497896..c7c4129e3e 100644 --- a/test/ruby/test_io.rb +++ b/test/ruby/test_io.rb @@ -1216,6 +1216,32 @@ class TestIO < Test::Unit::TestCase end) end + def test_write_with_multiple_arguments + pipe(proc do |w| + w.write("foo", "bar") + w.close + end, proc do |r| + assert_equal("foobar", r.read) + end) + end + + def test_write_with_many_arguments + pipe(proc do |w| + w.write(*(["a"] * 1023)) + w.close + end, proc do |r| + assert_equal("a" * 1023, r.read) + end) + end + + def test_write_with_too_many_arguments + with_pipe do |r, w| + assert_raise(ArgumentError) do + w.write(*(["a"] * 1024)) + end + end + end + def test_write_non_writable with_pipe do |r, w| assert_raise(IOError) do |