gir_ffi 0.9.5 → 0.10.0.pre1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/Changelog.md +9 -0
  3. data/lib/ffi-glib/byte_array.rb +1 -1
  4. data/lib/ffi-glib/bytes.rb +4 -4
  5. data/lib/ffi-glib/container_class_methods.rb +2 -0
  6. data/lib/ffi-glib/iconv.rb +2 -2
  7. data/lib/ffi-glib/variant.rb +10 -2
  8. data/lib/ffi-gobject.rb +6 -14
  9. data/lib/ffi-gobject/object.rb +7 -0
  10. data/lib/ffi-gobject/object_class.rb +1 -1
  11. data/lib/ffi-gobject/param_spec.rb +12 -0
  12. data/lib/ffi-gobject/value.rb +20 -11
  13. data/lib/gir_ffi-base/gobject.rb +35 -3
  14. data/lib/gir_ffi-base/gobject/lib.rb +2 -0
  15. data/lib/gir_ffi/allocation_helper.rb +11 -0
  16. data/lib/gir_ffi/arg_helper.rb +4 -0
  17. data/lib/gir_ffi/boxed_base.rb +28 -32
  18. data/lib/gir_ffi/builders/argument_builder.rb +31 -6
  19. data/lib/gir_ffi/builders/c_to_ruby_convertor.rb +36 -7
  20. data/lib/gir_ffi/builders/callback_argument_builder.rb +24 -10
  21. data/lib/gir_ffi/builders/closure_to_pointer_convertor.rb +1 -1
  22. data/lib/gir_ffi/builders/field_builder.rb +28 -10
  23. data/lib/gir_ffi/builders/full_c_to_ruby_convertor.rb +2 -3
  24. data/lib/gir_ffi/builders/initializer_return_value_builder.rb +5 -1
  25. data/lib/gir_ffi/builders/null_argument_builder.rb +0 -12
  26. data/lib/gir_ffi/builders/pointer_value_convertor.rb +38 -0
  27. data/lib/gir_ffi/builders/return_value_builder.rb +12 -10
  28. data/lib/gir_ffi/builders/ruby_to_c_convertor.rb +21 -2
  29. data/lib/gir_ffi/builders/struct_builder.rb +9 -2
  30. data/lib/gir_ffi/builders/{boxed_builder.rb → struct_like.rb} +2 -5
  31. data/lib/gir_ffi/builders/unintrospectable_boxed_builder.rb +5 -2
  32. data/lib/gir_ffi/builders/union_builder.rb +5 -2
  33. data/lib/gir_ffi/enum_base.rb +4 -0
  34. data/lib/gir_ffi/error_argument_info.rb +0 -16
  35. data/lib/gir_ffi/ffi_ext/pointer.rb +11 -5
  36. data/lib/gir_ffi/flags_base.rb +4 -0
  37. data/lib/gir_ffi/in_out_pointer.rb +5 -30
  38. data/lib/gir_ffi/in_pointer.rb +5 -4
  39. data/lib/gir_ffi/info_ext/i_type_info.rb +3 -5
  40. data/lib/gir_ffi/object_base.rb +4 -0
  41. data/lib/gir_ffi/sized_array.rb +20 -0
  42. data/lib/gir_ffi/struct_base.rb +13 -2
  43. data/lib/gir_ffi/struct_like_base.rb +53 -0
  44. data/lib/gir_ffi/union_base.rb +7 -1
  45. data/lib/gir_ffi/version.rb +1 -1
  46. data/test/ffi-glib/destroy_notify_test.rb +4 -1
  47. data/test/ffi-gobject/param_spec_test.rb +18 -0
  48. data/test/gir_ffi/arg_helper_test.rb +17 -0
  49. data/test/gir_ffi/boxed_base_test.rb +24 -0
  50. data/test/gir_ffi/builders/argument_builder_test.rb +156 -63
  51. data/test/gir_ffi/builders/callback_argument_builder_test.rb +10 -10
  52. data/test/gir_ffi/builders/callback_builder_test.rb +31 -8
  53. data/test/gir_ffi/builders/field_builder_test.rb +32 -30
  54. data/test/gir_ffi/builders/function_builder_test.rb +251 -45
  55. data/test/gir_ffi/builders/initializer_builder_test.rb +17 -1
  56. data/test/gir_ffi/builders/return_value_builder_test.rb +115 -68
  57. data/test/gir_ffi/builders/struct_builder_test.rb +6 -0
  58. data/test/gir_ffi/builders/unintrospectable_builder_test.rb +4 -1
  59. data/test/gir_ffi/builders/vfunc_builder_test.rb +10 -10
  60. data/test/gir_ffi/in_out_pointer_test.rb +12 -81
  61. data/test/gir_ffi/in_pointer_test.rb +0 -17
  62. data/test/gir_ffi/info_ext/i_type_info_test.rb +0 -10
  63. data/test/gir_ffi/sized_array_test.rb +62 -0
  64. data/test/gir_ffi/struct_base_test.rb +24 -0
  65. data/test/gir_ffi/union_base_test.rb +24 -0
  66. data/test/gir_ffi/version_test.rb +1 -1
  67. data/test/integration/generated_gimarshallingtests_test.rb +32 -12
  68. data/test/integration/generated_regress_test.rb +9 -12
  69. metadata +12 -8
  70. data/lib/ffi-gobject/base.rb +0 -27
  71. data/lib/gir_ffi/user_data_argument_info.rb +0 -24
  72. data/lib/gir_ffi/user_data_type_info.rb +0 -22
@@ -11,102 +11,32 @@ describe GirFFI::InOutPointer do
11
11
  end
12
12
  end
13
13
 
14
- describe 'an instance created with .from' do
15
- before do
16
- @result = GirFFI::InOutPointer.from :gint32, 23
17
- end
18
-
19
- it 'holds a pointer to the given value' do
20
- assert_equal 23, @result.get_int32(0)
21
- end
22
-
23
- it 'is an instance of GirFFI::InOutPointer' do
24
- assert_instance_of GirFFI::InOutPointer, @result
25
- end
26
- end
27
-
28
- describe '.from' do
29
- it 'handles :gboolean false' do
30
- ptr = GirFFI::InOutPointer.from :gboolean, false
31
- ptr.read_int.must_equal 0
32
- end
33
-
34
- it 'handles :gboolean true' do
35
- ptr = GirFFI::InOutPointer.from :gboolean, true
36
- ptr.read_int.must_equal(1)
37
- end
38
-
39
- it 'handles :utf8 pointers' do
40
- str_ptr = GirFFI::InPointer.from :utf8, 'Hello'
41
- GirFFI::InOutPointer.from :utf8, str_ptr
42
- end
43
- end
44
-
45
- describe 'in instance created with .for' do
46
- before do
47
- @result = GirFFI::InOutPointer.for :gint32
48
- end
49
-
50
- it 'holds a pointer to a null value' do
51
- assert_equal 0, @result.get_int32(0)
52
- end
53
-
54
- it 'is an instance of GirFFI::InOutPointer' do
55
- assert_instance_of GirFFI::InOutPointer, @result
56
- end
57
- end
58
-
59
- describe '.for' do
60
- it 'handles :gboolean' do
61
- result = GirFFI::InOutPointer.for :gboolean
62
- result.to_value.must_equal false
63
- end
64
-
65
- it 'handles :utf8' do
66
- result = GirFFI::InOutPointer.for :utf8
67
- result.to_value.must_be :null?
68
- end
69
-
70
- it 'handles GObject::Value' do
71
- result = GirFFI::InOutPointer.for GObject::Value
72
- type_size = FFI.type_size GObject::Value
73
- expected = "\x00" * type_size
74
- result.to_value.read_bytes(type_size).must_equal expected
75
- end
76
- end
77
-
78
- describe '#set_value' do
79
- it 'works setting the value to nil for GObject::Value' do
80
- pointer = GirFFI::InOutPointer.from GObject::Value, GObject::Value.from(3)
81
- pointer.set_value nil
82
- type_size = FFI.type_size GObject::Value
83
- expected = "\x00" * type_size
84
- pointer.to_value.read_bytes(type_size).must_equal expected
85
- end
86
- end
87
-
88
14
  describe '#to_value' do
89
15
  it 'returns the held value' do
90
- ptr = GirFFI::InOutPointer.from :gint32, 123
16
+ ptr = GirFFI::InOutPointer.allocate_new :gint32
17
+ ptr.write_int32 123
91
18
  assert_equal 123, ptr.to_value
92
19
  end
93
20
 
94
21
  describe 'for :gboolean values' do
95
22
  it 'works when the value is false' do
96
- ptr = GirFFI::InOutPointer.from :gboolean, false
23
+ ptr = GirFFI::InOutPointer.allocate_new :gboolean
24
+ ptr.write_int 0
97
25
  ptr.to_value.must_equal false
98
26
  end
99
27
 
100
28
  it 'works when the value is true' do
101
- ptr = GirFFI::InOutPointer.from :gboolean, true
29
+ ptr = GirFFI::InOutPointer.allocate_new :gboolean
30
+ ptr.write_int 1
102
31
  ptr.to_value.must_equal true
103
32
  end
104
33
  end
105
34
 
106
35
  describe 'for :utf8 values' do
107
- it 'returns a pointer to the held value' do
108
- str_ptr = GirFFI::InPointer.from :utf8, 'Some value'
109
- ptr = GirFFI::InOutPointer.from :utf8, str_ptr
36
+ it 'returns a pointer to the held string value' do
37
+ str_ptr = GirFFI::InPointer.from_utf8 'Some value'
38
+ ptr = GirFFI::InOutPointer.allocate_new :utf8
39
+ ptr.write_pointer str_ptr
110
40
  assert_equal 'Some value', ptr.to_value.read_string
111
41
  end
112
42
  end
@@ -115,7 +45,8 @@ describe GirFFI::InOutPointer do
115
45
  it 'returns a pointer to the held value' do
116
46
  val = GObject::EnumValue.new
117
47
  val.value = 3
118
- ptr = GirFFI::InOutPointer.from GObject::EnumValue, val
48
+ ptr = GirFFI::InOutPointer.allocate_new GObject::EnumValue
49
+ GObject::EnumValue.copy_value_to_pointer val, ptr
119
50
  result = ptr.to_value
120
51
  GObject::EnumValue.wrap(result).value.must_equal 3
121
52
  end
@@ -181,21 +181,4 @@ describe GirFFI::InPointer do
181
181
  end
182
182
  end
183
183
  end
184
-
185
- describe '.from_closure_data' do
186
- describe 'when called with nil' do
187
- it 'returns a null pointer' do
188
- GirFFI::InPointer.from_closure_data(nil).must_be :null?
189
- end
190
- end
191
-
192
- describe 'when called with a string' do
193
- it 'stores the string in GirFFI::ArgHelper::OBJECT_STORE' do
194
- str = 'Foo'
195
- ptr = GirFFI::InPointer.from_closure_data(str)
196
- result = GirFFI::ArgHelper::OBJECT_STORE.fetch(ptr)
197
- result.must_equal str
198
- end
199
- end
200
- end
201
184
  end
@@ -291,16 +291,6 @@ describe GirFFI::InfoExt::ITypeInfo do
291
291
  end
292
292
  end
293
293
 
294
- describe 'for a string' do
295
- before do
296
- allow(type_info).to receive(:tag).and_return :utf8
297
- end
298
-
299
- it 'returns an array containing :utf8' do
300
- type_info.extra_conversion_arguments.must_equal [:utf8]
301
- end
302
- end
303
-
304
294
  describe 'for a fixed-size array' do
305
295
  before do
306
296
  allow(type_info).to receive(:tag).and_return :array
@@ -81,6 +81,68 @@ describe GirFFI::SizedArray do
81
81
  end
82
82
  end
83
83
 
84
+ describe '.copy_from' do
85
+ describe 'from a Ruby array' do
86
+ it 'creates an unowned GirFFI::SizedArray with the same elements' do
87
+ arr = GirFFI::SizedArray.copy_from :gint32, 3, [3, 2, 1]
88
+ arr.must_be_instance_of GirFFI::SizedArray
89
+ assert_equal [3, 2, 1], arr.to_a
90
+ arr.to_ptr.wont_be :autorelease?
91
+ end
92
+
93
+ it 'creates unowned copies of struct pointer elements' do
94
+ struct = GIMarshallingTests::BoxedStruct.new
95
+ struct.long_ = 2342
96
+ arr = GirFFI::SizedArray.copy_from([:pointer, GIMarshallingTests::BoxedStruct],
97
+ 1,
98
+ [struct])
99
+ arr.must_be_instance_of GirFFI::SizedArray
100
+ arr.to_ptr.wont_be :autorelease?
101
+
102
+ struct_copy = arr.first
103
+ struct_copy.long_.must_equal struct.long_
104
+ struct_copy.to_ptr.wont_equal struct.to_ptr
105
+ struct_copy.to_ptr.wont_be :autorelease?
106
+ end
107
+
108
+ it 'increases the ref count of object pointer elements' do
109
+ obj = GIMarshallingTests::Object.new 42
110
+ arr = GirFFI::SizedArray.copy_from([:pointer, GIMarshallingTests::Object],
111
+ -1,
112
+ [obj, nil])
113
+ arr.must_be_instance_of GirFFI::SizedArray
114
+ arr.to_ptr.wont_be :autorelease?
115
+
116
+ arr.to_a.must_equal [obj, nil]
117
+ obj.ref_count.must_equal 2
118
+ end
119
+ end
120
+
121
+ describe 'from a GirFFI::SizedArray' do
122
+ it 'return an unowned copy of its argument' do
123
+ arr = GirFFI::SizedArray.from :gint32, 3, [3, 2, 1]
124
+ arr2 = GirFFI::SizedArray.copy_from :gint32, 3, arr
125
+ arr.to_ptr.wont_equal arr2.to_ptr
126
+ arr2.to_a.must_equal [3, 2, 1]
127
+ arr2.to_ptr.wont_be :autorelease?
128
+ end
129
+ end
130
+
131
+ it 'returns nil when passed nil' do
132
+ arr = GirFFI::SizedArray.copy_from :gint32, 0, nil
133
+ arr.must_be_nil
134
+ end
135
+
136
+ it 'creates an unowned copy of its argument if given a pointer' do
137
+ arr = GirFFI::SizedArray.from :gint32, 3, [3, 2, 1]
138
+ arr2 = GirFFI::SizedArray.copy_from :gint32, 3, arr.to_ptr
139
+ assert_instance_of GirFFI::SizedArray, arr2
140
+ arr2.to_ptr.wont_equal arr.to_ptr
141
+ arr2.to_ptr.wont_be :autorelease?
142
+ arr2.to_a.must_equal [3, 2, 1]
143
+ end
144
+ end
145
+
84
146
  describe '#==' do
85
147
  it 'returns true when comparing to an array with the same elements' do
86
148
  sized = GirFFI::SizedArray.from :int32, 3, [1, 2, 3]
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+ require 'gir_ffi_test_helper'
3
+
4
+ GirFFI.setup :GIMarshallingTests
5
+
6
+ describe GirFFI::StructBase do
7
+ describe 'wrap_copy' do
8
+ it 'returns a wrapped copy with autorelease true' do
9
+ original = GIMarshallingTests::SimpleStruct.new
10
+ copy = GIMarshallingTests::SimpleStruct.wrap_copy(original.to_ptr)
11
+ copy.to_ptr.wont_equal original.to_ptr
12
+ copy.to_ptr.must_be :autorelease?
13
+ end
14
+ end
15
+
16
+ describe 'copy_from' do
17
+ it 'returns a copy with autorelease false' do
18
+ original = GIMarshallingTests::SimpleStruct.new
19
+ copy = GIMarshallingTests::SimpleStruct.copy_from(original)
20
+ copy.to_ptr.wont_equal original.to_ptr
21
+ copy.to_ptr.wont_be :autorelease?
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+ require 'gir_ffi_test_helper'
3
+
4
+ GirFFI.setup :GIMarshallingTests
5
+
6
+ describe GirFFI::UnionBase do
7
+ describe 'wrap_copy' do
8
+ it 'returns a wrapped copy with autorelease true' do
9
+ original = GIMarshallingTests::Union.new
10
+ copy = GIMarshallingTests::Union.wrap_copy(original.to_ptr)
11
+ copy.to_ptr.wont_equal original.to_ptr
12
+ copy.to_ptr.must_be :autorelease?
13
+ end
14
+ end
15
+
16
+ describe 'copy_from' do
17
+ it 'returns a copy with autorelease false' do
18
+ original = GIMarshallingTests::Union.new
19
+ copy = GIMarshallingTests::Union.copy_from(original)
20
+ copy.to_ptr.wont_equal original.to_ptr
21
+ copy.to_ptr.wont_be :autorelease?
22
+ end
23
+ end
24
+ end
@@ -3,6 +3,6 @@ require 'gir_ffi_test_helper'
3
3
 
4
4
  describe GirFFI::VERSION do
5
5
  it 'is set to a valid version number' do
6
- GirFFI::VERSION.must_match(/\d\.\d\.\d/)
6
+ GirFFI::VERSION.must_match(/\d+\.\d+\.\d+/)
7
7
  end
8
8
  end
@@ -45,6 +45,7 @@ describe GIMarshallingTests do
45
45
  it 'creates an instance using #new' do
46
46
  bx = GIMarshallingTests::BoxedStruct.new
47
47
  assert_instance_of GIMarshallingTests::BoxedStruct, bx
48
+ bx.to_ptr.must_be :autorelease?
48
49
  end
49
50
 
50
51
  it 'has a working method #inv' do
@@ -56,22 +57,27 @@ describe GIMarshallingTests do
56
57
  it 'has a working function #inout' do
57
58
  bx = GIMarshallingTests::BoxedStruct.new
58
59
  bx.long_ = 42
60
+ bx.to_ptr.must_be :autorelease?
59
61
 
60
- res = GIMarshallingTests::BoxedStruct.inout bx
62
+ # FIXME: Temporary check method
63
+ bx.to_ptr.autorelease = true
61
64
 
62
- # TODO: Deal with the fact that bx is now invalid (at least with
63
- # gobject-introspection 1.40).
65
+ res = GIMarshallingTests::BoxedStruct.inout bx
66
+ bx.to_ptr.must_be :autorelease?
67
+ res.to_ptr.must_be :autorelease?
64
68
 
65
69
  assert_equal 0, res.long_
66
70
  end
67
71
 
68
72
  it 'has a working function #out' do
69
73
  res = GIMarshallingTests::BoxedStruct.out
74
+ res.to_ptr.must_be :autorelease?
70
75
  assert_equal 42, res.long_
71
76
  end
72
77
 
73
78
  it 'has a working function #returnv' do
74
79
  res = GIMarshallingTests::BoxedStruct.returnv
80
+ res.to_ptr.must_be :autorelease?
75
81
  assert_equal 42, res.long_
76
82
  res.g_strv.must_be :==, %w(0 1 2)
77
83
  end
@@ -275,8 +281,9 @@ describe GIMarshallingTests do
275
281
  it 'has a writable field pointer' do
276
282
  instance.pointer.must_be_nil
277
283
  nested = GIMarshallingTests::NestedStruct.new
284
+ nested.simple_struct.int8 = 23
278
285
  instance.pointer = nested
279
- instance.pointer.must_equal nested
286
+ instance.pointer.simple_struct.int8.must_equal 23
280
287
  end
281
288
  end
282
289
 
@@ -302,7 +309,7 @@ describe GIMarshallingTests do
302
309
 
303
310
  res = GIMarshallingTests::Object.full_inout ob
304
311
 
305
- ob.ref_count.must_be :>, 0
312
+ ob.ref_count.must_equal 1
306
313
  res.ref_count.must_equal 1
307
314
 
308
315
  res.must_be_instance_of GIMarshallingTests::Object
@@ -311,12 +318,14 @@ describe GIMarshallingTests do
311
318
 
312
319
  it 'has a working function #full_out' do
313
320
  res = GIMarshallingTests::Object.full_out
314
- assert_instance_of GIMarshallingTests::Object, res
321
+ res.must_be_instance_of GIMarshallingTests::Object
322
+ res.ref_count.must_equal 1
315
323
  end
316
324
 
317
325
  it 'has a working function #full_return' do
318
326
  res = GIMarshallingTests::Object.full_return
319
- assert_instance_of GIMarshallingTests::Object, res
327
+ res.must_be_instance_of GIMarshallingTests::Object
328
+ res.ref_count.must_equal 1
320
329
  end
321
330
 
322
331
  it 'has a working function #inout_same' do
@@ -325,19 +334,28 @@ describe GIMarshallingTests do
325
334
 
326
335
  it 'has a working function #none_inout' do
327
336
  ob = GIMarshallingTests::Object.new 42
337
+ ob.ref_count.must_equal 1
338
+
328
339
  res = GIMarshallingTests::Object.none_inout ob
329
- assert_instance_of GIMarshallingTests::Object, res
330
- ob.wont_equal res
340
+
341
+ ob.ref_count.must_equal 1
342
+ res.ref_count.must_equal 2
343
+
344
+ res.must_be_instance_of GIMarshallingTests::Object
345
+ ob.int.must_equal 42
346
+ res.int.must_equal 0
331
347
  end
332
348
 
333
349
  it 'has a working function #none_out' do
334
350
  res = GIMarshallingTests::Object.none_out
335
- assert_instance_of GIMarshallingTests::Object, res
351
+ res.must_be_instance_of GIMarshallingTests::Object
352
+ res.ref_count.must_equal 2
336
353
  end
337
354
 
338
355
  it 'has a working function #none_return' do
339
356
  res = GIMarshallingTests::Object.none_return
340
- assert_instance_of GIMarshallingTests::Object, res
357
+ res.must_be_instance_of GIMarshallingTests::Object
358
+ res.ref_count.must_equal 2
341
359
  end
342
360
 
343
361
  it 'has a working function #static_method' do
@@ -1454,12 +1472,14 @@ describe GIMarshallingTests do
1454
1472
  GIMarshallingTests.array_struct_in arr
1455
1473
  end
1456
1474
 
1457
- # NOTE: Should be run with valgrind. See gimarhallingtests.c.
1458
1475
  it 'has a working function #array_struct_take_in' do
1459
1476
  arr = [1, 2, 3].map do |val|
1460
1477
  GIMarshallingTests::BoxedStruct.new.tap { |struct| struct.long_ = val }
1461
1478
  end
1479
+ # NOTE: This copies values so arr's elements stay valid
1462
1480
  GIMarshallingTests.array_struct_take_in arr
1481
+
1482
+ arr.map(&:long_).must_equal [1, 2, 3]
1463
1483
  end
1464
1484
 
1465
1485
  it 'has a working function #array_struct_value_in' do
@@ -479,6 +479,7 @@ describe Regress do
479
479
  rect = Regress::FooBRect.wrap(Regress::FooBRect::Struct.new.to_ptr)
480
480
  rect.x = 42
481
481
  rect.y = 23
482
+ skip 'Cannot copy FooBRect structs'
482
483
  instance.rect = rect
483
484
  instance.rect.x.must_equal 42.0
484
485
  instance.rect.y.must_equal 23.0
@@ -894,11 +895,9 @@ describe Regress do
894
895
  describe 'Regress::FooStruct' do
895
896
  let(:instance) { Regress::FooStruct.new }
896
897
 
897
- it 'has a writable field priv' do
898
- instance.priv.must_be_nil
899
- struct = Regress::FooStructPrivate.new
900
- instance.priv = struct
901
- instance.priv.must_equal struct
898
+ it 'blocks access to the field priv' do
899
+ proc { instance.priv = nil }.must_raise NoMethodError
900
+ proc { instance.priv }.must_raise NoMethodError
902
901
  end
903
902
 
904
903
  it 'has a writable field member' do
@@ -1168,12 +1167,9 @@ describe Regress do
1168
1167
  instance.nested_a.some_int.must_equal 12_345
1169
1168
  end
1170
1169
 
1171
- it 'has a writable field priv' do
1172
- instance.priv.wont_be_nil
1173
- other = Regress::TestBoxed.new
1174
- instance.priv.wont_equal other.priv
1175
- instance.priv = other.priv
1176
- instance.priv.must_equal other.priv
1170
+ it 'blocks access to the field priv' do
1171
+ proc { instance.priv = nil }.must_raise NoMethodError
1172
+ proc { instance.priv }.must_raise NoMethodError
1177
1173
  end
1178
1174
 
1179
1175
  it 'creates an instance using #new' do
@@ -1297,6 +1293,7 @@ describe Regress do
1297
1293
  end
1298
1294
 
1299
1295
  it 'has a working method #free' do
1296
+ skip "#free is used internally and shouldn't be exposed"
1300
1297
  instance.free
1301
1298
  pass
1302
1299
  end
@@ -2567,7 +2564,7 @@ describe Regress do
2567
2564
 
2568
2565
  it 'has a writable field data1' do
2569
2566
  instance.data1.must_be :null?
2570
- instance.data1 = GirFFI::InOutPointer.from(:gint32, 42)
2567
+ instance.data1 = GirFFI::AllocationHelper.allocate(:int32).tap { |it| it.write_int(42) }
2571
2568
  instance.data1.read_int.must_equal 42
2572
2569
  end
2573
2570