File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -339,9 +339,11 @@ def do_write(s)
339339 # Writes _s_ to the stream. If the argument is not a String it will be
340340 # converted using +.to_s+ method. Returns the number of bytes written.
341341
342- def write ( s )
343- do_write ( s )
344- s . bytesize
342+ def write ( *s )
343+ s . inject ( 0 ) do |written , str |
344+ do_write ( str )
345+ written + str . bytesize
346+ end
345347 end
346348
347349 ##
Original file line number Diff line number Diff line change @@ -362,6 +362,15 @@ def test_write_zero
362362 }
363363 end
364364
365+ def test_write_multiple_arguments
366+ ssl_pair { |s1 , s2 |
367+ str1 = "foo" ; str2 = "bar"
368+ assert_equal 6 , s1 . write ( str1 , str2 )
369+ s1 . close
370+ assert_equal "foobar" , s2 . read
371+ }
372+ end
373+
365374 def test_partial_tls_record_read_nonblock
366375 ssl_pair { |s1 , s2 |
367376 # the beginning of a TLS record
You can’t perform that action at this time.
0 commit comments