ruby-changes:40549
From: sonots <ko1@a...>
Date: Wed, 18 Nov 2015 09:53:20 +0900 (JST)
Subject: [ruby-changes:40549] sonots:r52628 (trunk): * test/logger/test_logdevice.rb: Fix tests of logger to make it work on
sonots 2015-11-18 09:53:14 +0900 (Wed, 18 Nov 2015) New Revision: 52628 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=52628 Log: * test/logger/test_logdevice.rb: Fix tests of logger to make it work on windows (windows can not remove opened file) [Bug #11702] Modified files: trunk/ChangeLog trunk/test/logger/test_logdevice.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 52627) +++ ChangeLog (revision 52628) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Wed Nov 18 09:50:21 2015 Naotoshi Seo <sonots@g...> + + * test/logger/test_logdevice.rb: Fix tests of logger to make it work on + windows (windows can not remove opened file) [Bug #11702] + Wed Nov 18 06:59:52 2015 Eric Wong <e@8...> * ext/socket/ancdata.c (bsock_recvmsg_internal): grow buffer Index: test/logger/test_logdevice.rb =================================================================== --- test/logger/test_logdevice.rb (revision 52627) +++ test/logger/test_logdevice.rb (revision 52628) @@ -131,7 +131,7 @@ class TestLogDevice < Test::Unit::TestCa https://github.com/ruby/ruby/blob/trunk/test/logger/test_logdevice.rb#L131 def test_reopen_file logdev = d(@filename) old_dev = logdev.dev - File.unlink(@filename) if File.exist?(@filename) # remove once, then reopen + logdev.reopen begin assert(File.exist?(@filename)) @@ -154,14 +154,20 @@ class TestLogDevice < Test::Unit::TestCa https://github.com/ruby/ruby/blob/trunk/test/logger/test_logdevice.rb#L154 def test_reopen_file_by_file logdev = d(@filename) old_dev = logdev.dev - File.unlink(@filename) if File.exist?(@filename) # remove once, then reopen - logdev.reopen(@filename) + + tempfile2 = Tempfile.new("logger") + tempfile2.close + filename2 = tempfile2.path + File.unlink(filename2) + + logdev.reopen(filename2) begin - assert(File.exist?(@filename)) - assert_equal(@filename, logdev.filename) + assert(File.exist?(filename2)) + assert_equal(filename2, logdev.filename) assert(old_dev.closed?) ensure logdev.close + tempfile2.close(true) end end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/