diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-05-28 14:06:28 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-05-28 14:06:28 +0000 |
commit | a7b1cfbb99631ed077133dc858a82bfeaf48959f (patch) | |
tree | 2e18c836bbffca7295a3a6e206728f785bf59cc6 /test/ruby/test_io.rb | |
parent | 58a6412754b4e3acf898b462b15f195b00219db6 (diff) | |
download | ruby-a7b1cfbb99631ed077133dc858a82bfeaf48959f.tar.gz |
* test/ruby/test_io.rb (test_flush_in_finalizer1): Use
ObjectSpace.each_object to close files.
GC.start is not reliable.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46212 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_io.rb')
-rw-r--r-- | test/ruby/test_io.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb index b104086d43..9d2ecef725 100644 --- a/test/ruby/test_io.rb +++ b/test/ruby/test_io.rb @@ -2358,6 +2358,7 @@ End assert_nothing_raised(TypeError, bug3910) do 500.times { f = File.open(path, "w") + f.instance_variable_set(:@test_flush_in_finalizer1, true) fds << f.fileno f.print "hoge" } @@ -2365,7 +2366,11 @@ End t } ensure - GC.start + ObjectSpace.each_object(File) {|f| + if f.instance_variables.include?(:@test_flush_in_finalizer1) + f.close + end + } t.close! end |