gir_ffi 0.10.2 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (113) hide show
  1. checksums.yaml +4 -4
  2. data/Changelog.md +13 -0
  3. data/Gemfile +9 -4
  4. data/README.md +3 -2
  5. data/Rakefile +2 -1
  6. data/lib/ffi-glib/byte_array.rb +1 -1
  7. data/lib/ffi-glib/main_loop.rb +2 -1
  8. data/lib/ffi-glib/strv.rb +5 -2
  9. data/lib/ffi-glib/variant.rb +3 -5
  10. data/lib/ffi-glib.rb +4 -0
  11. data/lib/ffi-gobject/closure.rb +8 -10
  12. data/lib/ffi-gobject/object.rb +9 -6
  13. data/lib/ffi-gobject/param_spec.rb +4 -0
  14. data/lib/ffi-gobject/value.rb +13 -16
  15. data/lib/ffi-gobject_introspection/gobject_type_init.rb +18 -0
  16. data/lib/ffi-gobject_introspection/i_callable_info.rb +1 -5
  17. data/lib/ffi-gobject_introspection/i_constant_info.rb +3 -3
  18. data/lib/ffi-gobject_introspection/i_repository.rb +3 -47
  19. data/lib/ffi-gobject_introspection/i_vfunc_info.rb +3 -11
  20. data/lib/ffi-gobject_introspection/lib.rb +8 -31
  21. data/lib/{gir_ffi-base/glib → ffi-gobject_introspection}/strv.rb +9 -13
  22. data/lib/ffi-gobject_introspection.rb +47 -2
  23. data/lib/gir_ffi/allocation_helper.rb +1 -19
  24. data/lib/gir_ffi/arg_helper.rb +36 -26
  25. data/lib/{gir_ffi-base/glib → gir_ffi}/boolean.rb +7 -5
  26. data/lib/gir_ffi/boxed_base.rb +5 -23
  27. data/lib/gir_ffi/builder.rb +3 -3
  28. data/lib/gir_ffi/builders/argument_builder.rb +7 -8
  29. data/lib/gir_ffi/builders/base_argument_builder.rb +0 -1
  30. data/lib/gir_ffi/builders/callback_argument_builder.rb +2 -2
  31. data/lib/gir_ffi/builders/callback_return_value_builder.rb +21 -13
  32. data/lib/gir_ffi/builders/field_builder.rb +4 -10
  33. data/lib/gir_ffi/builders/module_builder.rb +6 -4
  34. data/lib/gir_ffi/builders/object_builder.rb +16 -16
  35. data/lib/gir_ffi/builders/struct_builder.rb +4 -6
  36. data/lib/gir_ffi/builders/struct_like.rb +1 -1
  37. data/lib/gir_ffi/builders/user_defined_builder.rb +83 -23
  38. data/lib/gir_ffi/builders/vfunc_argument_builder.rb +12 -17
  39. data/lib/gir_ffi/class_base.rb +0 -4
  40. data/lib/gir_ffi/core.rb +16 -13
  41. data/lib/gir_ffi/enum_base.rb +2 -41
  42. data/lib/gir_ffi/enum_like_base.rb +48 -0
  43. data/lib/gir_ffi/ffi_ext/pointer.rb +1 -1
  44. data/lib/gir_ffi/flags_base.rb +2 -41
  45. data/lib/gir_ffi/in_out_pointer.rb +1 -1
  46. data/lib/gir_ffi/in_pointer.rb +4 -4
  47. data/lib/gir_ffi/info_ext/i_type_info.rb +14 -5
  48. data/lib/gir_ffi/info_ext/i_vfunc_info.rb +8 -0
  49. data/lib/gir_ffi/module_base.rb +4 -0
  50. data/lib/gir_ffi/receiver_argument_info.rb +1 -1
  51. data/lib/gir_ffi/sized_array.rb +6 -6
  52. data/lib/gir_ffi/struct_base.rb +1 -6
  53. data/lib/gir_ffi/struct_like_base.rb +54 -45
  54. data/lib/gir_ffi/type_map.rb +6 -7
  55. data/lib/gir_ffi/union_base.rb +1 -1
  56. data/lib/gir_ffi/{user_defined_type_info.rb → user_defined_object_info.rb} +1 -2
  57. data/lib/gir_ffi/user_defined_property_info.rb +80 -2
  58. data/lib/gir_ffi/version.rb +1 -1
  59. data/lib/gir_ffi-base/gobject/lib.rb +0 -1
  60. data/lib/gir_ffi-base/gobject.rb +3 -5
  61. data/lib/gir_ffi-base.rb +3 -8
  62. data/tasks/test.rake +17 -3
  63. data/test/base_test_helper.rb +39 -23
  64. data/test/ffi-glib/closure_test.rb +37 -0
  65. data/test/ffi-glib/main_loop_test.rb +24 -0
  66. data/test/ffi-glib/ruby_closure_test.rb +0 -5
  67. data/test/ffi-gobject/object_test.rb +6 -10
  68. data/test/ffi-gobject/param_spec_test.rb +17 -5
  69. data/test/ffi-gobject/value_test.rb +15 -6
  70. data/test/ffi-gobject_introspection/gobject_type_init_test.rb +25 -0
  71. data/test/ffi-gobject_introspection/i_base_info_test.rb +1 -1
  72. data/test/ffi-gobject_introspection/i_repository_test.rb +18 -0
  73. data/test/ffi-gobject_introspection/i_vfunc_info_test.rb +40 -0
  74. data/test/{gir_ffi-base/glib → ffi-gobject_introspection}/strv_test.rb +8 -8
  75. data/test/gir_ffi/allocation_helper_test.rb +35 -0
  76. data/test/gir_ffi/arg_helper_test.rb +102 -7
  77. data/test/gir_ffi/boolean_test.rb +34 -0
  78. data/test/gir_ffi/boxed_base_test.rb +46 -6
  79. data/test/gir_ffi/builder_test.rb +88 -29
  80. data/test/gir_ffi/builders/argument_builder_test.rb +19 -0
  81. data/test/gir_ffi/builders/callback_argument_builder_test.rb +17 -0
  82. data/test/gir_ffi/builders/callback_return_value_builder_test.rb +1 -1
  83. data/test/gir_ffi/builders/field_builder_test.rb +2 -1
  84. data/test/gir_ffi/builders/struct_builder_test.rb +42 -25
  85. data/test/gir_ffi/builders/user_defined_builder_test.rb +365 -17
  86. data/test/gir_ffi/builders/vfunc_argument_builder_test.rb +100 -0
  87. data/test/gir_ffi/builders/vfunc_builder_test.rb +5 -3
  88. data/test/{gir_ffi_test.rb → gir_ffi/core_test.rb} +8 -6
  89. data/test/gir_ffi/in_out_pointer_test.rb +1 -1
  90. data/test/gir_ffi/receiver_argument_info_test.rb +32 -0
  91. data/test/gir_ffi/sized_array_test.rb +34 -0
  92. data/test/gir_ffi/struct_base_test.rb +4 -32
  93. data/test/gir_ffi/struct_like_base_test.rb +164 -0
  94. data/test/gir_ffi/union_base_test.rb +4 -20
  95. data/test/gir_ffi/{user_defined_type_info_test.rb → user_defined_object_info_test.rb} +10 -10
  96. data/test/gir_ffi/user_defined_property_info_test.rb +22 -5
  97. data/test/gir_ffi/version_test.rb +1 -1
  98. data/test/integration/callback_exceptions_test.rb +2 -0
  99. data/test/integration/derived_classes_test.rb +2 -0
  100. data/test/integration/generated_everything_test.rb +22 -0
  101. data/test/integration/generated_gimarshallingtests_test.rb +23 -21
  102. data/test/integration/generated_gio_test.rb +2 -0
  103. data/test/integration/generated_glib_test.rb +2 -0
  104. data/test/integration/generated_gst_test.rb +2 -0
  105. data/test/integration/generated_gtop_test.rb +2 -0
  106. data/test/integration/generated_regress_test.rb +113 -29
  107. data/test/integration/generated_secret_test.rb +2 -0
  108. data/test/integration/generated_warnlib_test.rb +2 -0
  109. data/test/integration/method_lookup_test.rb +2 -0
  110. data/test/introspection_test_helper.rb +15 -0
  111. metadata +21 -27
  112. data/lib/gir_ffi-base/glib.rb +0 -8
  113. data/test/gir_ffi-base/glib/boolean_test.rb +0 -34
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+ require 'gir_ffi_test_helper'
3
+
4
+ describe GirFFI::Boolean do
5
+ it 'has the same native size as an int' do
6
+ FFI.type_size(GirFFI::Boolean).must_equal FFI.type_size :int
7
+ end
8
+
9
+ describe '.from_native' do
10
+ it 'converts 0 to false' do
11
+ GirFFI::Boolean.from_native(0, 'whatever').must_equal false
12
+ end
13
+
14
+ it 'converts 1 to true' do
15
+ GirFFI::Boolean.from_native(1, 'whatever').must_equal true
16
+ end
17
+ end
18
+
19
+ describe '.to_native' do
20
+ it 'converts false to 0' do
21
+ GirFFI::Boolean.to_native(false, 'whatever').must_equal 0
22
+ end
23
+
24
+ it 'converts true to 1' do
25
+ GirFFI::Boolean.to_native(true, 'whatever').must_equal 1
26
+ end
27
+ end
28
+
29
+ describe '.size' do
30
+ it 'returns the correct type size' do
31
+ GirFFI::Boolean.size.must_equal FFI.type_size :int
32
+ end
33
+ end
34
+ end
@@ -4,12 +4,12 @@ require 'gir_ffi_test_helper'
4
4
  GirFFI.setup :GIMarshallingTests
5
5
 
6
6
  describe GirFFI::BoxedBase do
7
- describe 'wrap_copy' do
8
- it 'returns a wrapped copy with owned true' do
9
- original = GIMarshallingTests::BoxedStruct.new
10
- copy = GIMarshallingTests::BoxedStruct.wrap_copy(original.to_ptr)
11
- copy.to_ptr.wont_equal original.to_ptr
12
- copy.struct.must_be :owned?
7
+ describe 'initialize' do
8
+ it 'sets up the held struct pointer' do
9
+ # NOTE: GObject::Value uses the generic constructor, unlike
10
+ # GIMarshallingTests::BoxedStruct, which has its own constructor.
11
+ value = GObject::Value.new
12
+ value.to_ptr.wont_be_nil
13
13
  end
14
14
  end
15
15
 
@@ -18,7 +18,47 @@ describe GirFFI::BoxedBase do
18
18
  original = GIMarshallingTests::BoxedStruct.new
19
19
  copy = GIMarshallingTests::BoxedStruct.copy_from(original)
20
20
  copy.to_ptr.wont_equal original.to_ptr
21
+ copy.to_ptr.wont_be :autorelease?
21
22
  copy.struct.wont_be :owned?
22
23
  end
23
24
  end
25
+
26
+ describe 'wrap_own' do
27
+ it 'wraps and owns the supplied pointer' do
28
+ original = GIMarshallingTests::BoxedStruct.new
29
+ copy = GIMarshallingTests::BoxedStruct.wrap_own(original.to_ptr)
30
+ copy.to_ptr.must_equal original.to_ptr
31
+ copy.to_ptr.wont_be :autorelease?
32
+ copy.struct.must_be :owned?
33
+ end
34
+ end
35
+
36
+ describe 'upon garbage collection' do
37
+ it 'frees and disowns the underlying struct if it is owned' do
38
+ if jruby? || rubinius?
39
+ skip 'cannot be reliably tested on JRuby and Rubinius'
40
+ end
41
+
42
+ allow(GObject).to receive(:boxed_free)
43
+ gtype = GIMarshallingTests::BoxedStruct.gtype
44
+
45
+ owned_struct = GIMarshallingTests::BoxedStruct.new.struct
46
+ owned_ptr = owned_struct.to_ptr
47
+
48
+ unowned_struct = GIMarshallingTests::BoxedStruct.new.struct
49
+ unowned_struct.owned = false
50
+ unowned_ptr = unowned_struct.to_ptr
51
+
52
+ GC.start
53
+ # Creating a new object is sometimes needed to trigger enough garbage collection.
54
+ GIMarshallingTests::BoxedStruct.new
55
+ sleep 1
56
+ GC.start
57
+ GC.start
58
+
59
+ expect(GObject).to have_received(:boxed_free).with(gtype, owned_ptr)
60
+ expect(GObject).not_to have_received(:boxed_free).with(gtype, unowned_ptr)
61
+ owned_struct.wont_be :owned?
62
+ end
63
+ end
24
64
  end
@@ -2,6 +2,7 @@
2
2
  require 'gir_ffi_test_helper'
3
3
 
4
4
  GirFFI.setup :Regress
5
+ GirFFI.setup :GIMarshallingTests
5
6
 
6
7
  describe GirFFI::Builder do
7
8
  let(:gir) { GObjectIntrospection::IRepository.default }
@@ -14,8 +15,84 @@ describe GirFFI::Builder do
14
15
  end
15
16
  end
16
17
 
18
+ describe '.build_module' do
19
+ it 'refuses to build existing modules defined elsewhere' do
20
+ result = -> { GirFFI::Builder.build_module('Array') }.must_raise
21
+ result.message.must_equal 'The module Array was already defined elsewhere'
22
+ end
23
+
24
+ describe 'building a module for the first time' do
25
+ before do
26
+ save_module :Regress
27
+ GirFFI::Builder.build_module 'Regress'
28
+ end
29
+
30
+ it 'creates a Lib module ready to attach functions from the shared library' do
31
+ gir = GObjectIntrospection::IRepository.default
32
+ expected = [gir.shared_library('Regress')]
33
+ assert_equal expected, Regress::Lib.ffi_libraries.map(&:name)
34
+ end
35
+
36
+ after do
37
+ restore_module :Regress
38
+ end
39
+ end
40
+
41
+ describe 'building a module that already exists' do
42
+ it 'does not replace the existing module' do
43
+ oldmodule = Regress
44
+ GirFFI::Builder.build_module 'Regress'
45
+ assert_equal oldmodule, Regress
46
+ end
47
+
48
+ it 'does not replace the existing Lib module' do
49
+ oldmodule = Regress::Lib
50
+ GirFFI::Builder.build_module 'Regress'
51
+ assert_equal oldmodule, Regress::Lib
52
+ end
53
+ end
54
+
55
+ it 'passes the version on to ModuleBuilder' do
56
+ builder = double(generate: nil)
57
+ expect(GirFFI::Builders::ModuleBuilder).to receive(:new).
58
+ with('Foo', namespace: 'Foo', version: '1.0').
59
+ and_return builder
60
+
61
+ GirFFI::Builder.build_module 'Foo', '1.0'
62
+ end
63
+ end
64
+
65
+ describe '.build_by_gtype' do
66
+ it 'returns the class types known to the GIR' do
67
+ result = GirFFI::Builder.build_by_gtype GObject::Object.gtype
68
+ result.must_equal GObject::Object
69
+ end
70
+
71
+ it 'returns the class for user-defined types' do
72
+ klass = Class.new GIMarshallingTests::OverridesObject
73
+ Object.const_set "Derived#{Sequence.next}", klass
74
+ gtype = GirFFI.define_type klass
75
+
76
+ found_klass = GirFFI::Builder.build_by_gtype gtype
77
+ found_klass.must_equal klass
78
+ end
79
+
80
+ it 'returns a valid class for boxed classes unknown to GIR' do
81
+ object_class = GIMarshallingTests::PropertiesObject.object_class
82
+ property = object_class.find_property 'some-boxed-glist'
83
+ gtype = property.value_type
84
+
85
+ gtype.wont_equal GObject::TYPE_NONE
86
+
87
+ found_klass = GirFFI::Builder.build_by_gtype gtype
88
+ found_klass.name.must_be_nil
89
+ found_klass.ancestors.must_include GirFFI::BoxedBase
90
+ end
91
+ end
92
+
17
93
  describe '.attach_ffi_function' do
18
94
  let(:lib) { Module.new }
95
+
19
96
  it 'calls attach_function with the correct types for Regress.test_callback_destroy_notify' do
20
97
  function_info = get_introspection_data 'Regress', 'test_callback_destroy_notify'
21
98
 
@@ -57,8 +134,19 @@ describe GirFFI::Builder do
57
134
  and_return true
58
135
  GirFFI::Builder.attach_ffi_function(lib, info)
59
136
  end
137
+
138
+ it 'does not attach the function if it is already defined' do
139
+ info = get_introspection_data 'Regress', 'test_array_gint32_in'
140
+ allow(lib).to receive(:method_defined?).and_return true
141
+ expect(lib).not_to receive(:attach_function)
142
+ GirFFI::Builder.attach_ffi_function(lib, info)
143
+ end
60
144
  end
61
145
 
146
+ #
147
+ # NOTE: Legacy tests below.
148
+ #
149
+
62
150
  describe 'looking at Regress.test_callback_destroy_notify' do
63
151
  before do
64
152
  save_module :GObject
@@ -202,33 +290,4 @@ describe GirFFI::Builder do
202
290
  restore_module :Regress
203
291
  end
204
292
  end
205
-
206
- describe 'building Regress' do
207
- before do
208
- save_module :Regress
209
- GirFFI::Builder.build_module 'Regress'
210
- end
211
-
212
- it 'creates a Lib module ready to attach functions from the shared library' do
213
- gir = GObjectIntrospection::IRepository.default
214
- expected = [gir.shared_library('Regress')]
215
- assert_equal expected, Regress::Lib.ffi_libraries.map(&:name)
216
- end
217
-
218
- it 'does not replace existing module' do
219
- oldmodule = Regress
220
- GirFFI::Builder.build_module 'Regress'
221
- assert_equal oldmodule, Regress
222
- end
223
-
224
- it 'does not replace existing Lib module' do
225
- oldmodule = Regress::Lib
226
- GirFFI::Builder.build_module 'Regress'
227
- assert_equal oldmodule, Regress::Lib
228
- end
229
-
230
- after do
231
- restore_module :Regress
232
- end
233
- end
234
293
  end
@@ -378,6 +378,25 @@ describe GirFFI::Builders::ArgumentBuilder do
378
378
  end
379
379
  end
380
380
  end
381
+
382
+ describe 'for :void' do
383
+ let(:function_info) do
384
+ get_introspection_data('Everything', 'one_outparam_gpointer')
385
+ end
386
+ let(:arg_info) { function_info.args[0] }
387
+
388
+ before do
389
+ skip unless function_info
390
+ end
391
+
392
+ it 'has the correct value for #pre_conversion' do
393
+ builder.pre_conversion.must_equal ['_v1 = FFI::MemoryPointer.new :pointer']
394
+ end
395
+
396
+ it 'has the correct value for #post_conversion' do
397
+ builder.post_conversion.must_equal ['_v2 = _v1.get_pointer(0)']
398
+ end
399
+ end
381
400
  end
382
401
 
383
402
  describe 'for an argument with direction :inout' do
@@ -23,6 +23,23 @@ describe GirFFI::Builders::CallbackArgumentBuilder do
23
23
  builder.post_conversion.must_equal ['_v1.put_pointer 0, GirFFI::ZeroTerminated.from(:gfloat, _v2)']
24
24
  end
25
25
  end
26
+
27
+ describe 'when the argument is allocated by us, the callee' do
28
+ let(:vfunc_info) do
29
+ get_vfunc_introspection_data('GIMarshallingTests', 'Object',
30
+ 'method_int8_arg_and_out_callee')
31
+ end
32
+
33
+ let(:arg_info) { vfunc_info.args[1] }
34
+
35
+ it 'has the correct value for #pre_conversion' do
36
+ builder.pre_conversion.must_equal ['_v1 = FFI::MemoryPointer.new(:int8).tap { |ptr| out.put_pointer 0, ptr }']
37
+ end
38
+
39
+ it 'has the correct value for #post_conversion' do
40
+ builder.post_conversion.must_equal ['_v1.put_int8 0, _v2']
41
+ end
42
+ end
26
43
  end
27
44
 
28
45
  describe 'for an argument with direction :error' do
@@ -73,7 +73,7 @@ describe GirFFI::Builders::CallbackReturnValueBuilder do
73
73
  it 'increases the refcount of the result and converts it to a pointer' do
74
74
  # Ensure variable names are generated in order
75
75
  builder.capture_variable_name.must_equal '_v1'
76
- builder.post_conversion.must_equal ['_v2 = GObject::Object.from(_v1.ref).to_ptr']
76
+ builder.post_conversion.must_equal ['_v1.ref', '_v2 = GObject::Object.from(_v1).to_ptr']
77
77
  end
78
78
 
79
79
  it 'returns the result of the conversion' do
@@ -2,7 +2,8 @@
2
2
  require 'gir_ffi_test_helper'
3
3
 
4
4
  describe GirFFI::Builders::FieldBuilder do
5
- let(:instance) { GirFFI::Builders::FieldBuilder.new field_info }
5
+ let(:klass) { 'dummy' }
6
+ let(:instance) { GirFFI::Builders::FieldBuilder.new field_info, klass }
6
7
 
7
8
  describe 'for a field of type :gint8 with an offset' do
8
9
  let(:field_info) { get_field_introspection_data 'Regress', 'TestSimpleBoxedA', 'some_int8' }
@@ -11,39 +11,39 @@ describe GirFFI::Builders::StructBuilder do
11
11
  :some_double, :double, 8,
12
12
  :some_enum, Regress::TestEnum, 16]
13
13
  end
14
- end
15
14
 
16
- describe 'for a struct with a simple layout' do
17
- before do
18
- @field = Object.new
15
+ describe 'for a struct with a simple layout' do
16
+ before do
17
+ @field = Object.new
19
18
 
20
- @struct = Object.new
21
- allow(@struct).to receive(:namespace).and_return 'Foo'
22
- allow(@struct).to receive(:safe_name).and_return 'Bar'
23
- allow(@struct).to receive(:fields).and_return [@field]
19
+ @struct = Object.new
20
+ allow(@struct).to receive(:namespace).and_return 'Foo'
21
+ allow(@struct).to receive(:safe_name).and_return 'Bar'
22
+ allow(@struct).to receive(:fields).and_return [@field]
24
23
 
25
- @builder = GirFFI::Builders::StructBuilder.new @struct
26
- end
24
+ @builder = GirFFI::Builders::StructBuilder.new @struct
25
+ end
27
26
 
28
- it 'creates the correct layout specification' do
29
- expect(@field).to receive(:layout_specification).and_return [:bar, :int32, 0]
30
- spec = @builder.send :layout_specification
31
- assert_equal [:bar, :int32, 0], spec
27
+ it 'creates the correct layout specification' do
28
+ expect(@field).to receive(:layout_specification).and_return [:bar, :int32, 0]
29
+ spec = @builder.layout_specification
30
+ assert_equal [:bar, :int32, 0], spec
31
+ end
32
32
  end
33
- end
34
33
 
35
- describe 'for a struct with a layout with a complex type' do
36
- it 'does not flatten the complex type specification' do
37
- expect(simplefield = Object.new).to receive(:layout_specification).and_return [:bar, :foo, 0]
38
- expect(complexfield = Object.new).to receive(:layout_specification).and_return [:baz, [:qux, 2], 0]
39
- expect(struct = Object.new).to receive(:fields).and_return [simplefield, complexfield]
34
+ describe 'for a struct with a layout with a complex type' do
35
+ it 'does not flatten the complex type specification' do
36
+ expect(simplefield = Object.new).to receive(:layout_specification).and_return [:bar, :foo, 0]
37
+ expect(complexfield = Object.new).to receive(:layout_specification).and_return [:baz, [:qux, 2], 0]
38
+ expect(struct = Object.new).to receive(:fields).and_return [simplefield, complexfield]
40
39
 
41
- allow(struct).to receive(:safe_name).and_return 'Bar'
42
- allow(struct).to receive(:namespace).and_return 'Foo'
40
+ allow(struct).to receive(:safe_name).and_return 'Bar'
41
+ allow(struct).to receive(:namespace).and_return 'Foo'
43
42
 
44
- builder = GirFFI::Builders::StructBuilder.new struct
45
- spec = builder.send :layout_specification
46
- assert_equal [:bar, :foo, 0, :baz, [:qux, 2], 0], spec
43
+ builder = GirFFI::Builders::StructBuilder.new struct
44
+ spec = builder.layout_specification
45
+ assert_equal [:bar, :foo, 0, :baz, [:qux, 2], 0], spec
46
+ end
47
47
  end
48
48
  end
49
49
 
@@ -72,4 +72,21 @@ describe GirFFI::Builders::StructBuilder do
72
72
  builder.superclass.must_equal GObject::ObjectClass
73
73
  end
74
74
  end
75
+
76
+ describe '#setup_class' do
77
+ before do
78
+ save_module :Regress
79
+ end
80
+
81
+ it 'stubs the structs methods' do
82
+ info = get_introspection_data 'Regress', 'TestStructA'
83
+ builder = GirFFI::Builders::StructBuilder.new info
84
+ builder.setup_class
85
+ assert_defines_instance_method Regress::TestStructA, :clone
86
+ end
87
+
88
+ after do
89
+ restore_module :Regress
90
+ end
91
+ end
75
92
  end