diff options
author | Benoit Daloze <[email protected]> | 2022-11-07 20:05:30 +0100 |
---|---|---|
committer | Benoit Daloze <[email protected]> | 2022-11-07 20:05:30 +0100 |
commit | 83decbb62b8b3f1638927033f12b55f9b11f78c6 (patch) | |
tree | 8995f5b5cdb615f3d19edded66c6a9a9e82f159c /spec/ruby/library/stringio/shared/write.rb | |
parent | c99e4c427897e82a3419abed894d28705f70fa13 (diff) |
Update to ruby/spec@740ccc8
Diffstat (limited to 'spec/ruby/library/stringio/shared/write.rb')
-rw-r--r-- | spec/ruby/library/stringio/shared/write.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/ruby/library/stringio/shared/write.rb b/spec/ruby/library/stringio/shared/write.rb index 0eb71466e3..c5a0f8f513 100644 --- a/spec/ruby/library/stringio/shared/write.rb +++ b/spec/ruby/library/stringio/shared/write.rb @@ -45,6 +45,21 @@ describe :stringio_write_string, shared: true do @io.pos.should eql(4) end + it "handles concurrent writes correctly" do + @io = StringIO.new + n = 8 + go = false + threads = n.times.map { |i| + Thread.new { + Thread.pass until go + @io.write i.to_s + } + } + go = true + threads.each(&:join) + @io.string.size.should == n.times.map(&:to_s).join.size + end + ruby_version_is ""..."3.0" do it "does not taint self when the passed argument is tainted" do @io.send(@method, "test".taint) |