diff options
Diffstat (limited to 'test/ruby/test_io.rb')
-rw-r--r-- | test/ruby/test_io.rb | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb index 1cfcba181a..0d89b58b59 100644 --- a/test/ruby/test_io.rb +++ b/test/ruby/test_io.rb @@ -1625,4 +1625,33 @@ End end end.each {|th| th.join} end + + def test_flush_in_finalizer1 + require 'tempfile' + bug3910 = '[ruby-dev:42341]' + path = Tempfile.new("bug3910").path + fds = [] + assert_nothing_raised(TypeError, bug3910) do + 500.times { + f = File.open(path, "w") + fds << f.fileno + f.print "hoge" + } + end + ensure + fds.each {|fd| IO.for_fd(fd).close rescue next} + end + + def test_flush_in_finalizer2 + require 'tempfile' + bug3910 = '[ruby-dev:42341]' + path = Tempfile.new("bug3910").path + 1.times do + io = open(path,"w") + io.print "hoge" + end + assert_nothing_raised(TypeError, bug3910) do + GC.start + end + end end |