ffi 1.9.6-x64-mingw32 → 1.9.8-x64-mingw32
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of ffi might be problematic. Click here for more details.
- checksums.yaml +8 -8
- data/README.md +1 -1
- data/Rakefile +9 -9
- data/ext/ffi_c/Call.c +85 -20
- data/ext/ffi_c/Variadic.c +6 -2
- data/ext/ffi_c/libffi/src/x86/win32.S +2 -2
- data/ffi.gemspec +1 -1
- data/lib/2.0/ffi_c.so +0 -0
- data/lib/2.1/ffi_c.so +0 -0
- data/lib/2.2/ffi_c.so +0 -0
- data/lib/ffi.rb +6 -4
- data/lib/ffi/enum.rb +12 -6
- data/lib/ffi/library.rb +21 -1
- data/lib/ffi/platform.rb +2 -0
- data/lib/ffi/platform/aarch64-linux/types.conf +104 -0
- data/lib/ffi/platform/mips64el-linux/types.conf +104 -0
- data/lib/ffi/platform/powerpc64-linux/types.conf +104 -0
- data/lib/ffi/platform/x86_64-darwin/types.conf +30 -4
- data/lib/ffi/struct.rb +6 -0
- data/lib/ffi/version.rb +1 -1
- data/libtest/EnumTest.c +17 -0
- data/spec/ffi/enum_spec.rb +196 -0
- data/spec/ffi/fixtures/EnumTest.c +17 -0
- data/spec/ffi/function_spec.rb +7 -4
- metadata +19 -11
- data/spec/ffi/ffi.log +0 -5833
- data/spec/ffi/struct_by_ref_spec.rb.orig +0 -43
@@ -1,43 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# This file is part of ruby-ffi.
|
3
|
-
# For licensing, see LICENSE.SPECS
|
4
|
-
#
|
5
|
-
|
6
|
-
require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper"))
|
7
|
-
|
8
|
-
describe FFI::Struct, ' by_ref' do
|
9
|
-
before :all do
|
10
|
-
@struct_class = struct_class = Class.new(FFI::Struct) do
|
11
|
-
layout :a, :pointer
|
12
|
-
end
|
13
|
-
|
14
|
-
@api = Module.new do
|
15
|
-
extend FFI::Library
|
16
|
-
ffi_lib TestLibrary::PATH
|
17
|
-
fn = FFI::Type::POINTER.size == FFI::Type::LONG.size ? :ret_ulong : ret_uint64_t
|
18
|
-
attach_function :struct_test, fn, [ struct_class.by_ref ], :pointer
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
it "should accept instances of exact struct class" do
|
23
|
-
s = @struct_class.new
|
24
|
-
@api.struct_test(s).should == s.pointer
|
25
|
-
end
|
26
|
-
|
27
|
-
it "should accept nil" do
|
28
|
-
@api.struct_test(nil).should == nil
|
29
|
-
end
|
30
|
-
|
31
|
-
it "should reject other types" do
|
32
|
-
lambda { @api.struct_test('test').should == nil }.should raise_error(TypeError)
|
33
|
-
end
|
34
|
-
|
35
|
-
it "should reject instances of other struct classes" do
|
36
|
-
other_class = Class.new(FFI::Struct) do
|
37
|
-
layout :a, :pointer
|
38
|
-
end
|
39
|
-
|
40
|
-
lambda { @api.struct_test(other_class.new) }.should raise_error(TypeError)
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|