diff options
author | Lars Kanis <kanis@comcard.de> | 2015-08-05 18:11:01 +0200 |
---|---|---|
committer | Lars Kanis <lars@greiz-reinsdorf.de> | 2015-08-06 06:29:06 +0200 |
commit | 7c509bb123a906d42afbb74468f81a43719d0cdc (patch) | |
tree | 73930f6bcfe7c9207649e9f506eaa46edc660ec8 | |
parent | c1f91d47806af07ed2c109eda67663c35165ffb4 (diff) | |
download | ffi-7c509bb123a906d42afbb74468f81a43719d0cdc.tar.gz |
Exclude gettimeofday() tests on Windows.
-rw-r--r-- | spec/ffi/rbx/attach_function_spec.rb | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/spec/ffi/rbx/attach_function_spec.rb b/spec/ffi/rbx/attach_function_spec.rb index e90f535..7593662 100644 --- a/spec/ffi/rbx/attach_function_spec.rb +++ b/spec/ffi/rbx/attach_function_spec.rb @@ -5,29 +5,30 @@ require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper")) -class Timeval < FFI::Struct - layout :tv_sec, :ulong, 0, :tv_usec, :ulong, 4 -end - -module LibC - extend FFI::Library - ffi_lib FFI::Library::LIBC +unless FFI::Platform.windows? + class Timeval < FFI::Struct + layout :tv_sec, :ulong, 0, :tv_usec, :ulong, 4 + end - attach_function :gettimeofday, [:pointer, :pointer], :int -end + module LibC + extend FFI::Library + ffi_lib FFI::Library::LIBC -describe FFI::Library, "#attach_function" do - it "correctly returns a value for gettimeofday" do - t = Timeval.new - time = LibC.gettimeofday(t.pointer, nil) - expect(time).to be_kind_of(Integer) + attach_function :gettimeofday, [:pointer, :pointer], :int end - - it "correctly populates a struct for gettimeofday" do - t = Timeval.new - LibC.gettimeofday(t.pointer, nil) - expect(t[:tv_sec]).to be_kind_of(Numeric) - expect(t[:tv_usec]).to be_kind_of(Numeric) + + describe FFI::Library, "#attach_function" do + it "correctly returns a value for gettimeofday" do + t = Timeval.new + time = LibC.gettimeofday(t.pointer, nil) + expect(time).to be_kind_of(Integer) + end + + it "correctly populates a struct for gettimeofday" do + t = Timeval.new + LibC.gettimeofday(t.pointer, nil) + expect(t[:tv_sec]).to be_kind_of(Numeric) + expect(t[:tv_usec]).to be_kind_of(Numeric) + end end end - |