ffi 1.9.6-x64-mingw32 → 1.9.8-x64-mingw32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of ffi might be problematic. Click here for more details.

@@ -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
-