Sha256: 9fed1596219f63bb49d04876177326d06b89615c823c85198a4e0a928b49390c

Contents?: true

Size: 735 Bytes

Versions: 2

Compression:

Stored size: 735 Bytes

Contents

require "minitest/spec"
require "minitest/autorun"
require "ffi/stat"

describe FFI::Stat do
  it "can stat a file" do
    skip unless FFI::Stat.respond_to?(:stat)

    ffi_stat = FFI::Stat.stat(__FILE__)
    rb_stat = File.stat(__FILE__)

    ffi_stat[:st_dev].must_equal(rb_stat.dev)
    ffi_stat[:st_ino].must_equal(rb_stat.ino)
    ffi_stat[:st_mode].must_equal(rb_stat.mode)
    ffi_stat[:st_nlink].must_equal(rb_stat.nlink)
    ffi_stat[:st_uid].must_equal(rb_stat.uid)
    ffi_stat[:st_gid].must_equal(rb_stat.gid)
    ffi_stat[:st_rdev].must_equal(rb_stat.rdev)

    ffi_stat[:st_size].must_equal(rb_stat.size)
    ffi_stat[:st_blksize].must_equal(rb_stat.blksize)
    ffi_stat[:st_blocks].must_equal(rb_stat.blocks)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ffi-stat-0.3.0 spec/stat_spec.rb
ffi-stat-0.2.0 spec/stat_spec.rb