diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-10-25 05:44:38 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-10-25 05:44:38 +0000 |
commit | 635d0822cdb3a9eb7612ea478601d17ebe76b74d (patch) | |
tree | 08029047a84a89d290ac70b5461ae5b620d8390a /test/ruby/test_io.rb | |
parent | 50a99a76791bcd09b15353d704226a9cb52fd2b9 (diff) |
io.c: write a newline together
* io.c (rb_io_puts): write a newline together at once for each
argument. based on the patch by rohitpaulk (Rohit Kuruvilla) at
[ruby-core:83508]. [Feature #14042]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60417 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_io.rb')
-rw-r--r-- | test/ruby/test_io.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb index c7de83784b..a32369eca5 100644 --- a/test/ruby/test_io.rb +++ b/test/ruby/test_io.rb @@ -2445,6 +2445,19 @@ End end) end + def test_puts_parallel + pipe(proc do |w| + threads = [] + 100.times do + threads << Thread.new { w.puts "hey" } + end + threads.each(&:join) + w.close + end, proc do |r| + assert_equal("hey\n" * 100, r.read) + end) + end + def test_display pipe(proc do |w| "foo".display(w) |