Issue #5708 has been reported by Akira Tanaka.

----------------------------------------
Bug #5708: Tempfile.new(pre) with block in test_autoclose
http://redmine.ruby-lang.org/issues/5708

Author: Akira Tanaka
Status: Open
Priority: Normal
Assignee: 
Category: 
Target version: 
ruby -v: ruby 2.0.0dev (2011-12-03 trunk 33934) [x86_64-linux]


??????????????????????test/ruby/test_io.rb ??? test_autoclose ????
Tempfile.new ???????????????????使????????????

Tempfile.new ????????????????????????????????????????????????????????

test/ruby/test_io.rb:

  def test_autoclose
    feature2250 = '[ruby-core:26222]'
    pre = 'ft2250'

    Tempfile.new(pre) do |t|
      f = IO.for_fd(t.fileno)
      assert_equal(true, f.autoclose?)
      f.autoclose = false
      assert_equal(false, f.autoclose?)
      f.close
      assert_nothing_raised(Errno::EBADF) {t.close}

      t.open
      f = IO.for_fd(t.fileno, autoclose: false)
      assert_equal(false, f.autoclose?)
      f.autoclose = true
      assert_equal(true, f.autoclose?)
      f.close
      assert_raise(Errno::EBADF) {t.close}
    end

    Tempfile.new(pre) do |t|
      try_fdopen(t.fileno)
      assert_raise(Errno::EBADF) {t.close}
    end

    Tempfile.new(pre) do |t|
      try_fdopen(f.fileno, false)
      assert_nothing_raised(Errno::EBADF) {t.close}
    end
  end




-- 
http://redmine.ruby-lang.org