aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_syntax.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-08-09 09:32:47 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-08-09 09:32:47 +0000
commit8f6128303102d0b73eef15b4c02b62bfb1cb05f9 (patch)
tree0dc8a7b8ff6d47149760cebed34d4275adfcb1e7 /test/ruby/test_syntax.rb
parent76515504d552d3677f81539c29ed5f558f0dc4f0 (diff)
downloadruby-8f6128303102d0b73eef15b4c02b62bfb1cb05f9.tar.gz
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
Diffstat (limited to 'test/ruby/test_syntax.rb')
-rw-r--r--test/ruby/test_syntax.rb6
1 files 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