From f2d35a96a0cf639b7a603533323ef702c84c00ac Mon Sep 17 00:00:00 2001 From: Lars Kanis Date: Tue, 9 Jun 2020 15:53:00 +0200 Subject: [PATCH] Add a spec regarding issue #788 --- spec/ffi/library_spec.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/spec/ffi/library_spec.rb b/spec/ffi/library_spec.rb index ff18f9b71..b622a29ac 100644 --- a/spec/ffi/library_spec.rb +++ b/spec/ffi/library_spec.rb @@ -64,6 +64,20 @@ class StructUCDP < FFI::Struct end end + if RbConfig::CONFIG['host_os'] =~ /mingw/ + # See https://github.com/ffi/ffi/issues/788 + it "libc functions shouldn't call an invalid parameter handler" do + mod = Module.new do + extend FFI::Library + ffi_lib 'c' + attach_function(:get_osfhandle, :_get_osfhandle, [:int], :intptr_t) + end + + expect( mod.get_osfhandle(42) ).to eq(-1) + end + end + + describe "ffi_lib" do it "empty name list should raise error" do expect {