aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-12-14 06:06:18 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-12-14 06:06:18 +0000
commitd6273007fc214eb201ca735877630eda7af15af2 (patch)
tree55f4340a71a11e5b64b76b0f11999ae77aec33d1
parent4d257293f8b434adc6325b1dff962f6ee27347a7 (diff)
downloadruby-d6273007fc214eb201ca735877630eda7af15af2.tar.gz
* test/ruby/test_io.rb (test_reopen, test_reinitialize): should close
the temporay files. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30206 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--test/ruby/test_io.rb36
2 files changed, 29 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index cf1d462fd6..41d84b0e50 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Tue Dec 14 15:03:46 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/ruby/test_io.rb (test_reopen, test_reinitialize): should close
+ the temporay files.
+
Tue Dec 14 14:24:15 2010 NAKAMURA Usaku <usa@ruby-lang.org>
* test/ruby/test_io.rb (make_tempfile): change the prefix from 'foo'
diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb
index 32839953f2..75263e9cc5 100644
--- a/test/ruby/test_io.rb
+++ b/test/ruby/test_io.rb
@@ -1417,20 +1417,28 @@ class TestIO < Test::Unit::TestCase
open(__FILE__) do |f|
f.gets
f2 = open(t.path)
- f2.gets
- assert_nothing_raised {
- f.reopen(f2)
- assert_equal("bar\n", f.gets, '[ruby-core:24240]')
- }
+ begin
+ f2.gets
+ assert_nothing_raised {
+ f.reopen(f2)
+ assert_equal("bar\n", f.gets, '[ruby-core:24240]')
+ }
+ ensure
+ f2.close
+ end
end
open(__FILE__) do |f|
f2 = open(t.path)
- f.reopen(f2)
- assert_equal("foo\n", f.gets)
- assert_equal("bar\n", f.gets)
- f.reopen(f2)
- assert_equal("baz\n", f.gets, '[ruby-dev:39479]')
+ begin
+ f.reopen(f2)
+ assert_equal("foo\n", f.gets)
+ assert_equal("bar\n", f.gets)
+ f.reopen(f2)
+ assert_equal("baz\n", f.gets, '[ruby-dev:39479]')
+ ensure
+ f2.close
+ end
end
end
@@ -1587,8 +1595,12 @@ End
def test_reinitialize
t = make_tempfile
f = open(t.path)
- assert_raise(RuntimeError) do
- f.instance_eval { initialize }
+ begin
+ assert_raise(RuntimeError) do
+ f.instance_eval { initialize }
+ end
+ ensure
+ f.close
end
end