ruby-changes:51735
From: normal <ko1@a...>
Date: Wed, 11 Jul 2018 17:33:41 +0900 (JST)
Subject: [ruby-changes:51735] normal:r63947 (trunk): test/test_{tempfile, tmpdir}: get rid of leftover files
normal 2018-07-11 17:33:37 +0900 (Wed, 11 Jul 2018) New Revision: 63947 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=63947 Log: test/test_{tempfile,tmpdir}: get rid of leftover files I ran out of inodes in $TMPDIR Modified files: trunk/test/test_tempfile.rb trunk/test/test_tmpdir.rb Index: test/test_tmpdir.rb =================================================================== --- test/test_tmpdir.rb (revision 63946) +++ test/test_tmpdir.rb (revision 63947) @@ -64,15 +64,17 @@ class TestTmpdir < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/test_tmpdir.rb#L64 def test_mktmpdir_traversal expect = Dir.glob(TRAVERSAL_PATH + '*').count - Dir.mktmpdir(TRAVERSAL_PATH + 'foo') - actual = Dir.glob(TRAVERSAL_PATH + '*').count - assert_equal expect, actual + Dir.mktmpdir(TRAVERSAL_PATH + 'foo') do + actual = Dir.glob(TRAVERSAL_PATH + '*').count + assert_equal expect, actual + end end def test_mktmpdir_traversal_array expect = Dir.glob(TRAVERSAL_PATH + '*').count - Dir.mktmpdir([TRAVERSAL_PATH, 'foo']) - actual = Dir.glob(TRAVERSAL_PATH + '*').count - assert_equal expect, actual + Dir.mktmpdir([TRAVERSAL_PATH, 'foo']) do + actual = Dir.glob(TRAVERSAL_PATH + '*').count + assert_equal expect, actual + end end end Index: test/test_tempfile.rb =================================================================== --- test/test_tempfile.rb (revision 63946) +++ test/test_tempfile.rb (revision 63947) @@ -400,6 +400,9 @@ puts Tempfile.new('foo').path https://github.com/ruby/ruby/blob/trunk/test/test_tempfile.rb#L400 actual = Dir.glob(TRAVERSAL_PATH + '*').count assert_equal expect, actual ensure - t&.close + if t + File.unlink(t.path) + t.close + end end end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/