From 8f6128303102d0b73eef15b4c02b62bfb1cb05f9 Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 9 Aug 2014 09:32:47 +0000 Subject: [PATCH] test_syntax.rb: fix tempfile leaks * test/ruby/test_syntax.rb (test_must_ascii_compatible), (test_script_lines): ensure to close temporary files. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47115 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_syntax.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb index 1e988ddde7..475ee99a33 100644 --- a/test/ruby/test_syntax.rb +++ b/test/ruby/test_syntax.rb @@ -37,7 +37,8 @@ class TestSyntax < Test::Unit::TestCase make_tmpsrc(f, "# -*- coding: #{enc.name} -*-") assert_raise(ArgumentError, enc.name) {load(f.path)} end - f.close! + ensure + f.close! if f end def test_script_lines @@ -53,7 +54,8 @@ class TestSyntax < Test::Unit::TestCase assert_equal([enc, enc], debug_lines[f.path].map(&:encoding), bug4361) end end - f.close! + ensure + f.close! if f end def test_newline_in_block_parameters