ruby-changes:35034
From: nobu <ko1@a...>
Date: Sat, 9 Aug 2014 18:32:52 +0900 (JST)
Subject: [ruby-changes:35034] nobu:r47116 (trunk): test_io.rb: fix tempfile leaks
nobu 2014-08-09 18:32:48 +0900 (Sat, 09 Aug 2014) New Revision: 47116 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=47116 Log: test_io.rb: fix tempfile leaks * test/ruby/test_io.rb (test_flush_in_finalizer2): cannot unlink opened file on Windows. Modified files: trunk/test/ruby/test_io.rb Index: test/ruby/test_io.rb =================================================================== --- test/ruby/test_io.rb (revision 47115) +++ test/ruby/test_io.rb (revision 47116) @@ -2396,22 +2396,24 @@ End https://github.com/ruby/ruby/blob/trunk/test/ruby/test_io.rb#L2396 Tempfile.open("bug3910") {|t| path = t.path t.close - 1.times do - io = open(path,"w") - io.instance_variable_set(:@test_flush_in_finalizer2, true) - io.print "hoge" - end - assert_nothing_raised(TypeError, bug3910) do - GC.start + begin + 1.times do + io = open(path,"w") + io.instance_variable_set(:@test_flush_in_finalizer2, true) + io.print "hoge" + end + assert_nothing_raised(TypeError, bug3910) do + GC.start + end + ensure + ObjectSpace.each_object(File) {|f| + if f.instance_variables.include?(:@test_flush_in_finalizer2) + f.close + end + } end t.close! } - ensure - ObjectSpace.each_object(File) {|f| - if f.instance_variables.include?(:@test_flush_in_finalizer2) - f.close - end - } end def test_readlines_limit_0 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/