HEX
Server: Apache
System: Linux s198.coreserver.jp 5.15.0-151-generic #161-Ubuntu SMP Tue Jul 22 14:25:40 UTC 2025 x86_64
User: nagasaki (10062)
PHP: 7.1.33
Disabled: NONE
Upload Files
File: //usr/local/rvm/src/ruby-3.0.2/spec/ruby/core/dir/fileno_spec.rb
require_relative '../../spec_helper'
require_relative 'fixtures/common'

has_dir_fileno = begin
  dir = Dir.new('.')
  dir.fileno
  true
rescue NotImplementedError
  false
rescue Exception
  true
ensure
  dir.close
end

describe "Dir#fileno" do
  before :each do
    @name = tmp("fileno")
    mkdir_p @name
    @dir = Dir.new(@name)
  end

  after :each do
    @dir.close
    rm_r @name
  end

  if has_dir_fileno
    it "returns the file descriptor of the dir" do
      @dir.fileno.should be_kind_of(Integer)
    end
  else
    it "raises an error when not implemented on the platform" do
      -> { @dir.fileno }.should raise_error(NotImplementedError)
    end
  end
end