diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-10-01 13:03:58 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-10-01 13:03:58 +0000 |
commit | ec2db8decf97b79aef557c4b81eef3a0479f4ae3 (patch) | |
tree | a06beca0521251d5e1a6ae50493fb0f7e8923a39 /test/test_tempfile.rb | |
parent | 57c7de44fc6592136e40c08f88430ce9cf83cc93 (diff) |
tempfile.rb: undefine finalizer on unlink
* lib/tempfile.rb (Tempfile#unlink): finalizer is no longer needed
after unlinking. patched by by normalperson (Eric Wong) at
[ruby-core:56521] [Bug #8768]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43110 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/test_tempfile.rb')
-rw-r--r-- | test/test_tempfile.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/test_tempfile.rb b/test/test_tempfile.rb index 4f7e26f606..b3282538e4 100644 --- a/test/test_tempfile.rb +++ b/test/test_tempfile.rb @@ -206,6 +206,20 @@ puts Tempfile.new('foo').path end end + def test_tempfile_finalizer_does_not_run_if_unlinked + bug8768 = '[ruby-core:56521] [Bug #8768]' + args = %w(--disable-gems -rtempfile) + assert_in_out_err(args, <<-'EOS') do |(filename), (error)| + tmp = Tempfile.new('foo') + puts tmp.path + tmp.unlink + $DEBUG = true + EOS + assert_file.not_exist?(filename) + assert_nil(error, "#{bug8768} we used to get a confusing 'removing ...done' here") + end + end + def test_size_flushes_buffer_before_determining_file_size t = tempfile("foo") t.write("hello") |