gir_ffi 0.4.3 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. data/History.txt +8 -0
  2. data/README.md +1 -1
  3. data/TODO.rdoc +12 -4
  4. data/lib/ffi-glib.rb +0 -5
  5. data/lib/ffi-glib/list.rb +1 -1
  6. data/lib/ffi-glib/s_list.rb +1 -1
  7. data/lib/ffi-gobject.rb +2 -3
  8. data/lib/ffi-gobject/closure.rb +4 -3
  9. data/lib/ffi-gobject_introspection/i_base_info.rb +11 -14
  10. data/lib/ffi-gobject_introspection/i_constant_info.rb +1 -1
  11. data/lib/ffi-gobject_introspection/i_function_info.rb +0 -6
  12. data/lib/ffi-gobject_introspection/lib.rb +8 -2
  13. data/lib/gir_ffi.rb +5 -0
  14. data/lib/gir_ffi/arg_helper.rb +1 -1
  15. data/lib/gir_ffi/argument_builder.rb +161 -0
  16. data/lib/gir_ffi/base_argument_builder.rb +146 -0
  17. data/lib/gir_ffi/builder/field.rb +7 -5
  18. data/lib/gir_ffi/builder/module.rb +3 -14
  19. data/lib/gir_ffi/builder/property.rb +0 -2
  20. data/lib/gir_ffi/builder/type/callback.rb +0 -8
  21. data/lib/gir_ffi/builder/type/constant.rb +0 -4
  22. data/lib/gir_ffi/builder/type/enum.rb +0 -4
  23. data/lib/gir_ffi/builder/type/interface.rb +0 -4
  24. data/lib/gir_ffi/builder/type/object.rb +0 -1
  25. data/lib/gir_ffi/builder/type/struct_based.rb +0 -6
  26. data/lib/gir_ffi/builder/type/union.rb +0 -4
  27. data/lib/gir_ffi/builder/type/with_layout.rb +0 -1
  28. data/lib/gir_ffi/builder/type/with_methods.rb +1 -7
  29. data/lib/gir_ffi/callback.rb +9 -0
  30. data/lib/gir_ffi/callback_helper.rb +8 -1
  31. data/lib/gir_ffi/class_base.rb +6 -26
  32. data/lib/gir_ffi/error_argument_builder.rb +17 -0
  33. data/lib/gir_ffi/{builder/function.rb → function_builder.rb} +14 -11
  34. data/lib/gir_ffi/in_out_pointer.rb +29 -36
  35. data/lib/gir_ffi/in_pointer.rb +1 -1
  36. data/lib/gir_ffi/info_ext.rb +6 -0
  37. data/lib/gir_ffi/info_ext/i_field_info.rb +0 -2
  38. data/lib/gir_ffi/info_ext/i_type_info.rb +29 -10
  39. data/lib/gir_ffi/info_ext/safe_constant_name.rb +21 -0
  40. data/lib/gir_ffi/info_ext/safe_function_name.rb +13 -0
  41. data/lib/gir_ffi/interface_base.rb +1 -11
  42. data/lib/gir_ffi/module_base.rb +0 -10
  43. data/lib/gir_ffi/null_argument_builder.rb +9 -0
  44. data/lib/gir_ffi/return_value_builder.rb +75 -0
  45. data/lib/gir_ffi/setter_argument_info.rb +16 -0
  46. data/lib/gir_ffi/type_map.rb +10 -1
  47. data/lib/gir_ffi/version.rb +1 -1
  48. data/tasks/test.rake +61 -0
  49. data/test/base_test_helper.rb +0 -2
  50. data/test/ffi-gobject/value_test.rb +15 -0
  51. data/test/ffi-gobject_introspection/i_base_info_test.rb +31 -6
  52. data/test/ffi-gobject_introspection/i_function_info_test.rb +0 -17
  53. data/test/ffi-gobject_introspection/lib_test.rb +0 -55
  54. data/test/ffi-gobject_test.rb +2 -1
  55. data/test/gir_ffi/argument_builder_test.rb +414 -0
  56. data/test/gir_ffi/base_argument_builder_test.rb +13 -0
  57. data/test/gir_ffi/builder/module_test.rb +4 -40
  58. data/test/gir_ffi/builder/type/callback_test.rb +0 -27
  59. data/test/gir_ffi/builder/type/constant_test.rb +0 -12
  60. data/test/gir_ffi/builder/type/enum_test.rb +0 -20
  61. data/test/gir_ffi/builder/type/interface_test.rb +0 -11
  62. data/test/gir_ffi/builder/type/object_test.rb +2 -2
  63. data/test/gir_ffi/builder/type/struct_test.rb +0 -39
  64. data/test/gir_ffi/builder/type/unintrospectable_test.rb +1 -1
  65. data/test/gir_ffi/builder/type/union_test.rb +0 -11
  66. data/test/gir_ffi/builder_test.rb +3 -11
  67. data/test/gir_ffi/callback_helper_test.rb +7 -0
  68. data/test/gir_ffi/{builder/function_test.rb → function_builder_test.rb} +16 -28
  69. data/test/gir_ffi/in_out_pointer_test.rb +0 -20
  70. data/test/gir_ffi/info_ext/i_type_info_test.rb +112 -26
  71. data/test/gir_ffi/info_ext/safe_constant_name_test.rb +16 -0
  72. data/test/gir_ffi/info_ext/safe_function_name_test.rb +22 -0
  73. data/test/gir_ffi/return_value_builder_test.rb +355 -0
  74. data/test/integration/generated_gimarshallingtests_test.rb +608 -296
  75. data/test/integration/generated_regress_test.rb +879 -494
  76. metadata +35 -24
  77. data/lib/gir_ffi/builder/argument.rb +0 -569
  78. data/lib/gir_ffi/builder/argument/base.rb +0 -151
  79. data/lib/gir_ffi/builder/argument/in_base.rb +0 -14
  80. data/lib/gir_ffi/builder/argument/in_out_base.rb +0 -18
  81. data/lib/gir_ffi/builder/argument/out_base.rb +0 -15
  82. data/test/gir_ffi/builder/argument/base_test.rb +0 -55
  83. data/test/integration/pretty_print_test.rb +0 -33
@@ -1,23 +1,6 @@
1
1
  require 'introspection_test_helper'
2
2
 
3
3
  describe GObjectIntrospection::IFunctionInfo do
4
- describe "#safe_name" do
5
- it "keeps lower case names lower case" do
6
- stub(ptr = Object.new).null? { false }
7
- info = GObjectIntrospection::IFunctionInfo.wrap ptr
8
- stub(info).name { "foo" }
9
-
10
- assert_equal "foo", info.safe_name
11
- end
12
-
13
- it "returns a non-empty string if name is empty" do
14
- stub(ptr = Object.new).null? { false }
15
- info = GObjectIntrospection::IFunctionInfo.wrap ptr
16
- stub(info).name { "" }
17
-
18
- assert_equal "_", info.safe_name
19
- end
20
- end
21
4
  end
22
5
 
23
6
 
@@ -1,60 +1,5 @@
1
1
  require 'introspection_test_helper'
2
2
 
3
- describe "loading the shared library" do
4
- before do
5
- # Avoid cluttering the error stream with method redefinition warnings.
6
- stub(GObjectIntrospection::Lib).attach_function { }
7
- end
8
-
9
- describe "with ABI version 0 installed" do
10
- before do
11
- stub(GObjectIntrospection::Lib).ffi_lib("girepository-1.0.so.1") { raise LoadError }
12
- stub(GObjectIntrospection::Lib).ffi_lib("girepository-1.0.so.0") { }
13
- stub(GObjectIntrospection::Lib).ffi_lib("girepository-1.0") { raise "not expected" }
14
- end
15
-
16
- it "prints a warning message" do
17
- _, err = capture_io do
18
- load 'ffi-gobject_introspection/lib.rb'
19
- end
20
-
21
- assert_match(/not supported/, err)
22
- end
23
- end
24
-
25
- describe "with ABI version 1 installed" do
26
- before do
27
- stub(GObjectIntrospection::Lib).ffi_lib("girepository-1.0.so.0") { raise LoadError }
28
- stub(GObjectIntrospection::Lib).ffi_lib("girepository-1.0.so.1") { }
29
- stub(GObjectIntrospection::Lib).ffi_lib("girepository-1.0") { raise "not expected" }
30
- end
31
-
32
- it "does not print a warning message" do
33
- _, err = capture_io do
34
- load 'ffi-gobject_introspection/lib.rb'
35
- end
36
-
37
- assert_equal "", err
38
- end
39
- end
40
-
41
- describe "without being able to determine the ABI version" do
42
- before do
43
- stub(GObjectIntrospection::Lib).ffi_lib("girepository-1.0.so.0") { raise LoadError }
44
- stub(GObjectIntrospection::Lib).ffi_lib("girepository-1.0.so.1") { raise LoadError }
45
- stub(GObjectIntrospection::Lib).ffi_lib("girepository-1.0") { }
46
- end
47
-
48
- it "prints a warning message" do
49
- _, err = capture_io do
50
- load 'ffi-gobject_introspection/lib.rb'
51
- end
52
-
53
- assert_match(/not supported/, err)
54
- end
55
- end
56
- end
57
-
58
3
  describe GObjectIntrospection::Lib::GIArgument do
59
4
  describe "its member :v_ssize" do
60
5
  it "is signed" do
@@ -9,7 +9,8 @@ describe GObject do
9
9
  should "emit a signal" do
10
10
  a = 1
11
11
  o = Regress::TestSubObj.new
12
- ::GObject::Lib.g_signal_connect_data o, "test", Proc.new { a = 2 }, nil, nil, 0
12
+ callback = Proc.new { a = 2 }
13
+ ::GObject::Lib.g_signal_connect_data o, "test", callback, nil, nil, 0
13
14
  GObject.signal_emit o, "test"
14
15
  assert_equal 2, a
15
16
  end
@@ -0,0 +1,414 @@
1
+ require 'gir_ffi_test_helper'
2
+
3
+ describe GirFFI::ArgumentBuilder do
4
+ let(:argument_info) { Object.new }
5
+ let(:type_info) { Object.new }
6
+ let(:var_gen) { GirFFI::VariableNameGenerator.new }
7
+ let(:builder) { GirFFI::ArgumentBuilder.new(var_gen, argument_info) }
8
+
9
+ before do
10
+ stub(argument_info).name { 'foo' }
11
+ stub(argument_info).argument_type { type_info }
12
+ stub(argument_info).direction { direction }
13
+ stub(type_info).interface_type_name { 'Bar::Foo' }
14
+ end
15
+
16
+ describe "for an argument with direction :in" do
17
+ let(:direction) { :in }
18
+
19
+ describe "for :callback" do
20
+ before do
21
+ stub(interface_type_info = Object.new).namespace { "Bar" }
22
+ stub(interface_type_info).name { "Foo" }
23
+
24
+ stub(type_info).tag { :interface }
25
+ stub(type_info).flattened_tag { :callback }
26
+ stub(type_info).type_specification { ":callback" }
27
+ stub(type_info).interface { interface_type_info }
28
+ end
29
+
30
+ it "has the correct value for #pre" do
31
+ builder.pre.must_equal [ "_v1 = GirFFI::Callback.from(\"Bar\", \"Foo\", foo)" ]
32
+ end
33
+
34
+ it "has the correct value for #post" do
35
+ builder.post.must_equal [ ]
36
+ end
37
+ end
38
+ end
39
+
40
+ describe "for an argument with direction :out" do
41
+ let(:direction) { :out }
42
+
43
+ describe "for :enum" do
44
+ before do
45
+ stub(type_info).tag { :interface }
46
+ stub(type_info).flattened_tag { :enum }
47
+ stub(type_info).type_specification { ":enum" }
48
+ end
49
+
50
+ it "has the correct value for #pre" do
51
+ builder.pre.must_equal [ "_v1 = GirFFI::InOutPointer.for :enum" ]
52
+ end
53
+
54
+ it "has the correct value for #post" do
55
+ builder.post.must_equal [ "_v2 = Bar::Foo[_v1.to_value]" ]
56
+ end
57
+ end
58
+
59
+ describe "for :flags" do
60
+ before do
61
+ stub(type_info).tag { :interface }
62
+ stub(type_info).flattened_tag { :flags }
63
+ stub(type_info).type_specification { ":flags" }
64
+ end
65
+
66
+ it "has the correct value for #pre" do
67
+ builder.pre.must_equal [ "_v1 = GirFFI::InOutPointer.for :flags" ]
68
+ end
69
+
70
+ it "has the correct value for #post" do
71
+ builder.post.must_equal [ "_v2 = Bar::Foo[_v1.to_value]" ]
72
+ end
73
+ end
74
+
75
+ describe "for :object" do
76
+ before do
77
+ stub(type_info).tag { :interface }
78
+ stub(type_info).flattened_tag { :object }
79
+ stub(type_info).type_specification { ":object" }
80
+ end
81
+
82
+ describe "when not allocated by the caller" do
83
+ before do
84
+ stub(argument_info).caller_allocates? { false }
85
+ end
86
+
87
+ it "has the correct value for #pre" do
88
+ builder.pre.must_equal [ "_v1 = GirFFI::InOutPointer.for :object" ]
89
+ end
90
+
91
+ it "has the correct value for #post" do
92
+ builder.post.must_equal [ "_v2 = Bar::Foo.wrap(_v1.to_value)" ]
93
+ end
94
+ end
95
+
96
+ describe "when allocated by the caller" do
97
+ before do
98
+ stub(argument_info).caller_allocates? { true }
99
+ end
100
+
101
+ it "has the correct value for #pre" do
102
+ builder.pre.must_equal [ "_v1 = Bar::Foo.allocate" ]
103
+ end
104
+
105
+ it "has the correct value for #post" do
106
+ builder.post.must_equal [ "_v2 = _v1" ]
107
+ end
108
+ end
109
+ end
110
+
111
+ describe "for :struct" do
112
+ before do
113
+ stub(type_info).tag { :interface }
114
+ stub(type_info).flattened_tag { :struct }
115
+ stub(type_info).type_specification { ":struct" }
116
+ end
117
+
118
+ describe "when not allocated by the caller" do
119
+ before do
120
+ stub(argument_info).caller_allocates? { false }
121
+ end
122
+
123
+ it "has the correct value for #pre" do
124
+ builder.pre.must_equal [ "_v1 = GirFFI::InOutPointer.for :struct" ]
125
+ end
126
+
127
+ it "has the correct value for #post" do
128
+ builder.post.must_equal [ "_v2 = Bar::Foo.wrap(_v1.to_value)" ]
129
+ end
130
+ end
131
+
132
+ describe "when allocated by the caller" do
133
+ before do
134
+ stub(argument_info).caller_allocates? { true }
135
+ end
136
+
137
+ it "has the correct value for #pre" do
138
+ builder.pre.must_equal [ "_v1 = Bar::Foo.allocate" ]
139
+ end
140
+
141
+ it "has the correct value for #post" do
142
+ builder.post.must_equal [ "_v2 = _v1" ]
143
+ end
144
+ end
145
+ end
146
+
147
+ describe "for :strv" do
148
+ before do
149
+ stub(type_info).tag { :array }
150
+ stub(type_info).flattened_tag { :strv }
151
+ stub(type_info).type_specification { "[:strv, :utf8]" }
152
+ end
153
+
154
+ it "has the correct value for #pre" do
155
+ builder.pre.must_equal [ "_v1 = GirFFI::InOutPointer.for [:strv, :utf8]" ]
156
+ end
157
+
158
+ it "has the correct value for #post" do
159
+ builder.post.must_equal [ "_v2 = GLib::Strv.wrap(_v1.to_value)" ]
160
+ end
161
+ end
162
+
163
+ describe "for :array" do
164
+ before do
165
+ stub(type_info).tag { :array }
166
+ stub(type_info).flattened_tag { :array }
167
+ stub(type_info).element_type { :foo }
168
+ stub(type_info).type_specification { ":array" }
169
+ end
170
+
171
+ it "has the correct value for #pre" do
172
+ builder.pre.must_equal [ "_v1 = GirFFI::InOutPointer.for :array" ]
173
+ end
174
+
175
+ it "has the correct value for #post" do
176
+ builder.post.must_equal [ "_v2 = GLib::Array.wrap(:foo, _v1.to_value)" ]
177
+ end
178
+ end
179
+
180
+ describe "for :c" do
181
+ describe "with fixed size" do
182
+ before do
183
+ stub(type_info).tag { :array }
184
+ stub(type_info).flattened_tag { :c }
185
+ stub(type_info).type_specification { "[:c, :foo]" }
186
+ stub(type_info).array_fixed_size { 3 }
187
+ end
188
+
189
+ it "has the correct value for #pre" do
190
+ builder.pre.must_equal [ "_v1 = GirFFI::InOutPointer.for [:c, :foo]" ]
191
+ end
192
+
193
+ it "has the correct value for #post" do
194
+ builder.post.must_equal [ "_v2 = _v1.to_sized_array_value 3" ]
195
+ end
196
+ end
197
+
198
+ describe "with separate size parameter" do
199
+ let(:length_argument) { Object.new }
200
+ before do
201
+ stub(type_info).tag { :array }
202
+ stub(type_info).flattened_tag { :c }
203
+ stub(type_info).type_specification { "[:c, :foo]" }
204
+ stub(type_info).array_fixed_size { -1 }
205
+ stub(length_argument).retname { "bar" }
206
+ builder.length_arg = length_argument
207
+ end
208
+
209
+ it "has the correct value for #pre" do
210
+ builder.pre.must_equal [ "_v1 = GirFFI::InOutPointer.for [:c, :foo]" ]
211
+ end
212
+
213
+ it "has the correct value for #post" do
214
+ builder.post.must_equal [ "_v2 = _v1.to_sized_array_value bar" ]
215
+ end
216
+ end
217
+ end
218
+
219
+ describe "for :glist" do
220
+ before do
221
+ stub(type_info).tag { :glist }
222
+ stub(type_info).flattened_tag { :glist }
223
+ stub(type_info).element_type { :foo }
224
+ stub(type_info).type_specification { ":glist" }
225
+ end
226
+
227
+ it "has the correct value for #pre" do
228
+ builder.pre.must_equal [ "_v1 = GirFFI::InOutPointer.for :glist" ]
229
+ end
230
+
231
+ it "has the correct value for #post" do
232
+ builder.post.must_equal [ "_v2 = GLib::List.wrap(:foo, _v1.to_value)" ]
233
+ end
234
+ end
235
+
236
+ describe "for :gslist" do
237
+ before do
238
+ stub(type_info).tag { :gslist }
239
+ stub(type_info).flattened_tag { :gslist }
240
+ stub(type_info).element_type { :foo }
241
+ stub(type_info).type_specification { ":gslist" }
242
+ end
243
+
244
+ it "has the correct value for #pre" do
245
+ builder.pre.must_equal [ "_v1 = GirFFI::InOutPointer.for :gslist" ]
246
+ end
247
+
248
+ it "has the correct value for #post" do
249
+ builder.post.must_equal [ "_v2 = GLib::SList.wrap(:foo, _v1.to_value)" ]
250
+ end
251
+ end
252
+
253
+ describe "for :ghash" do
254
+ before do
255
+ stub(type_info).tag { :ghash }
256
+ stub(type_info).flattened_tag { :ghash }
257
+ stub(type_info).element_type { [:foo, :bar] }
258
+ stub(type_info).type_specification { ":ghash" }
259
+ end
260
+
261
+ it "has the correct value for #pre" do
262
+ builder.pre.must_equal [ "_v1 = GirFFI::InOutPointer.for :ghash" ]
263
+ end
264
+
265
+ it "has the correct value for #post" do
266
+ builder.post.must_equal [ "_v2 = GLib::HashTable.wrap([:foo, :bar], _v1.to_value)" ]
267
+ end
268
+ end
269
+ end
270
+
271
+ describe "for an argument with direction :inout" do
272
+ let(:direction) { :inout }
273
+
274
+ describe "for :enum" do
275
+ before do
276
+ stub(type_info).tag { :interface }
277
+ stub(type_info).flattened_tag { :enum }
278
+ end
279
+
280
+ it "has the correct value for #pre" do
281
+ builder.pre.must_equal [ "_v1 = GirFFI::InOutPointer.from :enum, Bar::Foo[foo]" ]
282
+ end
283
+
284
+ it "has the correct value for #post" do
285
+ builder.post.must_equal [ "_v2 = Bar::Foo[_v1.to_value]" ]
286
+ end
287
+ end
288
+
289
+ describe "for :flags" do
290
+ before do
291
+ stub(type_info).tag { :interface }
292
+ stub(type_info).flattened_tag { :flags }
293
+ end
294
+
295
+ it "has the correct value for #pre" do
296
+ builder.pre.must_equal [ "_v1 = GirFFI::InOutPointer.from :flags, Bar::Foo[foo]" ]
297
+ end
298
+
299
+ it "has the correct value for #post" do
300
+ builder.post.must_equal [ "_v2 = Bar::Foo[_v1.to_value]" ]
301
+ end
302
+ end
303
+
304
+ describe "for :gint32" do
305
+ before do
306
+ stub(type_info).tag { :gint32 }
307
+ stub(type_info).flattened_tag { :gint32 }
308
+ end
309
+
310
+ it "has the correct value for #pre" do
311
+ builder.pre.must_equal [ "_v1 = GirFFI::InOutPointer.from :gint32, foo" ]
312
+ end
313
+
314
+ it "has the correct value for #post" do
315
+ builder.post.must_equal [ "_v2 = _v1.to_value" ]
316
+ end
317
+ end
318
+
319
+ describe "for an array length" do
320
+ let(:array_argument) { Object.new }
321
+ before do
322
+ stub(type_info).tag { :gint32 }
323
+ stub(type_info).flattened_tag { :gint32 }
324
+ stub(array_argument).name { "foo_array" }
325
+ builder.array_arg = array_argument
326
+ end
327
+
328
+ it "has the correct value for #pre" do
329
+ builder.pre.must_equal [ "foo = foo_array.nil? ? 0 : foo_array.length",
330
+ "_v1 = GirFFI::InOutPointer.from :gint32, foo" ]
331
+ end
332
+
333
+ it "has the correct value for #post" do
334
+ builder.post.must_equal [ "_v2 = _v1.to_value" ]
335
+ end
336
+ end
337
+
338
+ describe "for :strv" do
339
+ before do
340
+ stub(type_info).tag { :array }
341
+ stub(type_info).flattened_tag { :strv }
342
+ stub(type_info).type_specification { "[:strv, :utf8]" }
343
+ end
344
+
345
+ it "has the correct value for #pre" do
346
+ builder.pre.must_equal [ "_v1 = GirFFI::InOutPointer.from [:strv, :utf8], GLib::Strv.from(foo)" ]
347
+ end
348
+
349
+ it "has the correct value for #post" do
350
+ builder.post.must_equal [ "_v2 = GLib::Strv.wrap(_v1.to_value)" ]
351
+ end
352
+ end
353
+
354
+ describe "for :utf8" do
355
+ before do
356
+ stub(type_info).tag { :utf8 }
357
+ stub(type_info).flattened_tag { :utf8 }
358
+ stub(type_info).type_specification { ":utf8" }
359
+ end
360
+
361
+ it "has the correct value for #pre" do
362
+ builder.pre.must_equal [ "_v1 = GirFFI::InOutPointer.from :utf8, foo" ]
363
+ end
364
+
365
+ it "has the correct value for #post" do
366
+ builder.post.must_equal [ "_v2 = _v1.to_value" ]
367
+ end
368
+ end
369
+
370
+ describe "for :c" do
371
+ describe "with fixed size" do
372
+ before do
373
+ stub(type_info).tag { :array }
374
+ stub(type_info).flattened_tag { :c }
375
+ stub(type_info).type_specification { "[:c, :bar]" }
376
+ stub(type_info).array_fixed_size { 3 }
377
+ end
378
+
379
+ it "has the correct value for #pre" do
380
+ builder.pre.must_equal [
381
+ "GirFFI::ArgHelper.check_fixed_array_size 3, foo, \"foo\"",
382
+ "_v1 = GirFFI::InOutPointer.from [:c, :bar], foo"
383
+ ]
384
+ end
385
+
386
+ it "has the correct value for #post" do
387
+ builder.post.must_equal [ "_v2 = _v1.to_sized_array_value 3" ]
388
+ end
389
+ end
390
+
391
+ describe "with separate size parameter" do
392
+ let(:length_argument) { Object.new }
393
+ before do
394
+ stub(type_info).tag { :array }
395
+ stub(type_info).flattened_tag { :c }
396
+ stub(type_info).type_specification { "[:c, :bar]" }
397
+ stub(type_info).array_fixed_size { -1 }
398
+ stub(length_argument).retname { "baz" }
399
+ builder.length_arg = length_argument
400
+ end
401
+
402
+ it "has the correct value for #pre" do
403
+ # TODO: Perhaps this should include a length check as well.
404
+ builder.pre.must_equal [ "_v1 = GirFFI::InOutPointer.from [:c, :bar], foo" ]
405
+ end
406
+
407
+ it "has the correct value for #post" do
408
+ builder.post.must_equal [ "_v2 = _v1.to_sized_array_value baz" ]
409
+ end
410
+ end
411
+ end
412
+ end
413
+ end
414
+