aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_io.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/ruby/test_io.rb')
-rw-r--r--test/ruby/test_io.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb
index 4c224a247f..b16662cd42 100644
--- a/test/ruby/test_io.rb
+++ b/test/ruby/test_io.rb
@@ -3397,6 +3397,27 @@ __END__
end;
end
+ def test_race_closed_stream
+ bug13158 = '[ruby-core:79262] [Bug #13158]'
+ closed = nil
+ IO.pipe do |r, w|
+ thread = Thread.new do
+ begin
+ while r.gets
+ end
+ ensure
+ closed = r.closed?
+ end
+ end
+ sleep 0.01
+ r.close
+ assert_raise_with_message(IOError, /stream closed/) do
+ thread.join
+ end
+ assert_equal(true, closed, "#{bug13158}: stream should be closed")
+ end
+ end
+
if RUBY_ENGINE == "ruby" # implementation details
def test_foreach_rs_conversion
make_tempfile {|t|