diff options
author | Lars Kanis <kanis@comcard.de> | 2015-08-05 18:11:01 +0200 |
---|---|---|
committer | Lars Kanis <kanis@comcard.de> | 2015-08-05 18:11:01 +0200 |
commit | 9e01dc31f9b940d560cf75528615720ca9cf33e7 (patch) | |
tree | b016891985fe8352c6c80c6d87a3b9c75526ca18 | |
parent | 51713b76283ebe76d3d82aa2ac60c3737588dcac (diff) | |
download | ffi-9e01dc31f9b940d560cf75528615720ca9cf33e7.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 - |