summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Kanis <lars@greiz-reinsdorf.de>2020-06-09 15:53:00 +0200
committerLars Kanis <lars@greiz-reinsdorf.de>2020-06-09 15:53:00 +0200
commitf2d35a96a0cf639b7a603533323ef702c84c00ac (patch)
tree1692dea8b9fa849afcb897469609aeb6d02392ec
parent90f4fcabc2ee729bfac83a103dac0780c37f05fd (diff)
downloadffi-f2d35a96a0cf639b7a603533323ef702c84c00ac.tar.gz
Add a spec regarding issue #788
-rw-r--r--spec/ffi/library_spec.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/ffi/library_spec.rb b/spec/ffi/library_spec.rb
index ff18f9b..b622a29 100644
--- a/spec/ffi/library_spec.rb
+++ b/spec/ffi/library_spec.rb
@@ -64,6 +64,20 @@ describe "Library" do
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 {