gir_ffi 0.14.1 → 0.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (263) hide show
  1. checksums.yaml +4 -4
  2. data/Changelog.md +21 -0
  3. data/Gemfile +6 -4
  4. data/README.md +4 -4
  5. data/Rakefile +5 -5
  6. data/lib/ffi-glib/array.rb +14 -4
  7. data/lib/ffi-glib/byte_array.rb +7 -2
  8. data/lib/ffi-glib/container_class_methods.rb +1 -1
  9. data/lib/ffi-glib/error.rb +1 -1
  10. data/lib/ffi-glib/hash_table.rb +3 -3
  11. data/lib/ffi-glib/list.rb +1 -1
  12. data/lib/ffi-glib/list_methods.rb +1 -1
  13. data/lib/ffi-glib/main_loop.rb +3 -3
  14. data/lib/ffi-glib/ptr_array.rb +30 -8
  15. data/lib/ffi-glib/s_list.rb +1 -1
  16. data/lib/ffi-glib/variant.rb +1 -1
  17. data/lib/ffi-glib.rb +16 -16
  18. data/lib/ffi-gobject/object.rb +23 -32
  19. data/lib/ffi-gobject/param_spec.rb +1 -1
  20. data/lib/ffi-gobject/ruby_closure.rb +2 -2
  21. data/lib/ffi-gobject/value.rb +37 -28
  22. data/lib/ffi-gobject.rb +13 -13
  23. data/lib/ffi-gobject_introspection/gobject_type_init.rb +2 -2
  24. data/lib/ffi-gobject_introspection/i_arg_info.rb +2 -2
  25. data/lib/ffi-gobject_introspection/i_base_info.rb +27 -17
  26. data/lib/ffi-gobject_introspection/i_callable_info.rb +4 -4
  27. data/lib/ffi-gobject_introspection/i_constant_info.rb +2 -2
  28. data/lib/ffi-gobject_introspection/i_enum_info.rb +1 -0
  29. data/lib/ffi-gobject_introspection/i_field_info.rb +1 -1
  30. data/lib/ffi-gobject_introspection/i_function_info.rb +1 -1
  31. data/lib/ffi-gobject_introspection/i_interface_info.rb +1 -1
  32. data/lib/ffi-gobject_introspection/i_object_info.rb +2 -2
  33. data/lib/ffi-gobject_introspection/i_property_info.rb +2 -2
  34. data/lib/ffi-gobject_introspection/i_repository.rb +9 -6
  35. data/lib/ffi-gobject_introspection/i_struct_info.rb +2 -1
  36. data/lib/ffi-gobject_introspection/i_type_info.rb +13 -7
  37. data/lib/ffi-gobject_introspection/i_unresolved_info.rb +1 -1
  38. data/lib/ffi-gobject_introspection/i_vfunc_info.rb +1 -1
  39. data/lib/ffi-gobject_introspection/lib.rb +30 -19
  40. data/lib/ffi-gobject_introspection/strv.rb +1 -1
  41. data/lib/ffi-gobject_introspection.rb +20 -20
  42. data/lib/gir_ffi/allocation_helper.rb +1 -1
  43. data/lib/gir_ffi/arg_helper.rb +4 -4
  44. data/lib/gir_ffi/{in_out_pointer.rb → array_element_convertor.rb} +16 -23
  45. data/lib/gir_ffi/boolean.rb +1 -1
  46. data/lib/gir_ffi/boxed_base.rb +1 -1
  47. data/lib/gir_ffi/builder.rb +18 -10
  48. data/lib/gir_ffi/builders/argument_builder.rb +17 -17
  49. data/lib/gir_ffi/builders/base_argument_builder.rb +1 -0
  50. data/lib/gir_ffi/builders/base_method_builder.rb +7 -7
  51. data/lib/gir_ffi/builders/base_return_value_builder.rb +1 -1
  52. data/lib/gir_ffi/builders/base_type_builder.rb +1 -1
  53. data/lib/gir_ffi/builders/c_to_ruby_convertor.rb +5 -5
  54. data/lib/gir_ffi/builders/callback_argument_builder.rb +8 -8
  55. data/lib/gir_ffi/builders/callback_builder.rb +3 -3
  56. data/lib/gir_ffi/builders/callback_return_value_builder.rb +2 -2
  57. data/lib/gir_ffi/builders/closure_argument_builder.rb +1 -1
  58. data/lib/gir_ffi/builders/closure_return_value_builder.rb +1 -1
  59. data/lib/gir_ffi/builders/constant_builder.rb +1 -1
  60. data/lib/gir_ffi/builders/constructor_builder.rb +9 -9
  61. data/lib/gir_ffi/builders/enum_builder.rb +2 -2
  62. data/lib/gir_ffi/builders/field_builder.rb +16 -15
  63. data/lib/gir_ffi/builders/flags_builder.rb +2 -2
  64. data/lib/gir_ffi/builders/full_c_to_ruby_convertor.rb +1 -1
  65. data/lib/gir_ffi/builders/function_builder.rb +11 -5
  66. data/lib/gir_ffi/builders/initializer_builder.rb +3 -3
  67. data/lib/gir_ffi/builders/initializer_return_value_builder.rb +2 -2
  68. data/lib/gir_ffi/builders/interface_builder.rb +2 -2
  69. data/lib/gir_ffi/builders/mapping_method_builder.rb +9 -9
  70. data/lib/gir_ffi/builders/marshalling_method_builder.rb +7 -7
  71. data/lib/gir_ffi/builders/method_template.rb +1 -1
  72. data/lib/gir_ffi/builders/module_builder.rb +4 -6
  73. data/lib/gir_ffi/builders/object_builder.rb +6 -6
  74. data/lib/gir_ffi/builders/property_argument_builder.rb +1 -1
  75. data/lib/gir_ffi/builders/property_builder.rb +13 -12
  76. data/lib/gir_ffi/builders/property_return_value_builder.rb +1 -1
  77. data/lib/gir_ffi/builders/registered_type_builder.rb +14 -5
  78. data/lib/gir_ffi/builders/return_value_builder.rb +4 -4
  79. data/lib/gir_ffi/builders/ruby_to_c_convertor.rb +6 -6
  80. data/lib/gir_ffi/builders/signal_closure_builder.rb +2 -2
  81. data/lib/gir_ffi/builders/struct_builder.rb +4 -4
  82. data/lib/gir_ffi/builders/struct_like.rb +1 -1
  83. data/lib/gir_ffi/builders/type_builder.rb +12 -12
  84. data/lib/gir_ffi/builders/unintrospectable_boxed_builder.rb +2 -2
  85. data/lib/gir_ffi/builders/unintrospectable_builder.rb +2 -2
  86. data/lib/gir_ffi/builders/union_builder.rb +4 -4
  87. data/lib/gir_ffi/builders/user_defined_builder.rb +2 -2
  88. data/lib/gir_ffi/builders/vfunc_argument_builder.rb +1 -1
  89. data/lib/gir_ffi/builders/vfunc_builder.rb +6 -6
  90. data/lib/gir_ffi/builders/with_layout.rb +2 -2
  91. data/lib/gir_ffi/callback_base.rb +1 -1
  92. data/lib/gir_ffi/class_base.rb +5 -5
  93. data/lib/gir_ffi/core.rb +19 -20
  94. data/lib/gir_ffi/enum_base.rb +1 -1
  95. data/lib/gir_ffi/enum_like_base.rb +2 -2
  96. data/lib/gir_ffi/error_argument_info.rb +2 -2
  97. data/lib/gir_ffi/error_type_info.rb +1 -1
  98. data/lib/gir_ffi/ffi_ext/pointer.rb +1 -1
  99. data/lib/gir_ffi/ffi_ext.rb +1 -1
  100. data/lib/gir_ffi/flags_base.rb +1 -1
  101. data/lib/gir_ffi/in_pointer.rb +10 -0
  102. data/lib/gir_ffi/info_ext/full_type_name.rb +3 -3
  103. data/lib/gir_ffi/info_ext/i_arg_info.rb +1 -1
  104. data/lib/gir_ffi/info_ext/i_callable_info.rb +1 -1
  105. data/lib/gir_ffi/info_ext/i_callback_info.rb +1 -1
  106. data/lib/gir_ffi/info_ext/i_field_info.rb +1 -1
  107. data/lib/gir_ffi/info_ext/i_function_info.rb +1 -1
  108. data/lib/gir_ffi/info_ext/i_property_info.rb +2 -2
  109. data/lib/gir_ffi/info_ext/i_registered_type_info.rb +4 -5
  110. data/lib/gir_ffi/info_ext/i_signal_info.rb +7 -3
  111. data/lib/gir_ffi/info_ext/i_type_info.rb +48 -26
  112. data/lib/gir_ffi/info_ext/i_unresolved_info.rb +1 -1
  113. data/lib/gir_ffi/info_ext/i_value_info.rb +2 -2
  114. data/lib/gir_ffi/info_ext/i_vfunc_info.rb +2 -2
  115. data/lib/gir_ffi/info_ext/safe_constant_name.rb +8 -8
  116. data/lib/gir_ffi/info_ext/safe_function_name.rb +2 -2
  117. data/lib/gir_ffi/info_ext.rb +15 -15
  118. data/lib/gir_ffi/interface_base.rb +3 -3
  119. data/lib/gir_ffi/lib_c.rb +1 -1
  120. data/lib/gir_ffi/method_stubber.rb +1 -1
  121. data/lib/gir_ffi/module_base.rb +1 -1
  122. data/lib/gir_ffi/object_base.rb +3 -4
  123. data/lib/gir_ffi/receiver_argument_info.rb +1 -1
  124. data/lib/gir_ffi/receiver_type_info.rb +2 -2
  125. data/lib/gir_ffi/registered_type_base.rb +1 -1
  126. data/lib/gir_ffi/sized_array.rb +4 -2
  127. data/lib/gir_ffi/struct.rb +1 -1
  128. data/lib/gir_ffi/struct_base.rb +1 -1
  129. data/lib/gir_ffi/type_map.rb +2 -23
  130. data/lib/gir_ffi/unintrospectable_boxed_info.rb +2 -2
  131. data/lib/gir_ffi/unintrospectable_type_info.rb +1 -1
  132. data/lib/gir_ffi/union.rb +1 -1
  133. data/lib/gir_ffi/union_base.rb +1 -1
  134. data/lib/gir_ffi/user_defined_object_info.rb +6 -2
  135. data/lib/gir_ffi/user_defined_property_info.rb +33 -33
  136. data/lib/gir_ffi/version.rb +1 -1
  137. data/lib/gir_ffi-base/gobject/lib.rb +3 -2
  138. data/lib/gir_ffi-base/gobject.rb +26 -25
  139. data/lib/gir_ffi-base.rb +1 -1
  140. data/lib/gir_ffi.rb +3 -3
  141. data/tasks/test.rake +3 -2
  142. data/test/base_test_helper.rb +16 -9
  143. data/test/ffi-glib/array_test.rb +71 -56
  144. data/test/ffi-glib/byte_array_test.rb +13 -7
  145. data/test/ffi-glib/bytes_test.rb +24 -19
  146. data/test/ffi-glib/closure_test.rb +11 -11
  147. data/test/ffi-glib/destroy_notify_test.rb +6 -6
  148. data/test/ffi-glib/hash_table_test.rb +27 -27
  149. data/test/ffi-glib/list_test.rb +22 -22
  150. data/test/ffi-glib/main_loop_test.rb +12 -12
  151. data/test/ffi-glib/ptr_array_test.rb +39 -39
  152. data/test/ffi-glib/ruby_closure_test.rb +10 -10
  153. data/test/ffi-glib/s_list_test.rb +20 -20
  154. data/test/ffi-glib/strv_test.rb +19 -19
  155. data/test/ffi-glib/variant_test.rb +5 -5
  156. data/test/ffi-gobject/gobject_test.rb +48 -44
  157. data/test/ffi-gobject/object_class_test.rb +8 -8
  158. data/test/ffi-gobject/object_test.rb +49 -67
  159. data/test/ffi-gobject/param_spec_test.rb +12 -12
  160. data/test/ffi-gobject/value_test.rb +145 -125
  161. data/test/ffi-gobject_introspection/gobject_type_init_test.rb +8 -8
  162. data/test/ffi-gobject_introspection/i_base_info_test.rb +15 -16
  163. data/test/ffi-gobject_introspection/i_constant_info_test.rb +9 -13
  164. data/test/ffi-gobject_introspection/i_enum_info_test.rb +7 -7
  165. data/test/ffi-gobject_introspection/i_function_info_test.rb +1 -1
  166. data/test/ffi-gobject_introspection/i_interface_info_test.rb +10 -10
  167. data/test/ffi-gobject_introspection/i_object_info_test.rb +23 -23
  168. data/test/ffi-gobject_introspection/i_property_info_test.rb +19 -19
  169. data/test/ffi-gobject_introspection/i_registered_type_info_test.rb +10 -10
  170. data/test/ffi-gobject_introspection/i_repository_test.rb +31 -31
  171. data/test/ffi-gobject_introspection/i_struct_info_test.rb +10 -10
  172. data/test/ffi-gobject_introspection/i_type_info_test.rb +12 -15
  173. data/test/ffi-gobject_introspection/i_union_info_test.rb +7 -7
  174. data/test/ffi-gobject_introspection/i_vfunc_info_test.rb +16 -16
  175. data/test/ffi-gobject_introspection/lib_test.rb +3 -3
  176. data/test/ffi-gobject_introspection/strv_test.rb +9 -9
  177. data/test/ffi-gobject_test.rb +44 -44
  178. data/test/gir_ffi/allocation_helper_test.rb +13 -13
  179. data/test/gir_ffi/arg_helper_test.rb +63 -64
  180. data/test/gir_ffi/boolean_test.rb +20 -20
  181. data/test/gir_ffi/boxed_base_test.rb +18 -18
  182. data/test/gir_ffi/builder_test.rb +115 -93
  183. data/test/gir_ffi/builders/argument_builder_test.rb +280 -286
  184. data/test/gir_ffi/builders/base_argument_builder_test.rb +1 -1
  185. data/test/gir_ffi/builders/callback_argument_builder_test.rb +53 -56
  186. data/test/gir_ffi/builders/callback_builder_test.rb +71 -72
  187. data/test/gir_ffi/builders/callback_return_value_builder_test.rb +36 -40
  188. data/test/gir_ffi/builders/constant_builder_test.rb +1 -1
  189. data/test/gir_ffi/builders/constructor_builder_test.rb +10 -10
  190. data/test/gir_ffi/builders/enum_builder_test.rb +10 -10
  191. data/test/gir_ffi/builders/field_builder_test.rb +42 -42
  192. data/test/gir_ffi/builders/function_builder_test.rb +236 -224
  193. data/test/gir_ffi/builders/initializer_builder_test.rb +14 -14
  194. data/test/gir_ffi/builders/interface_builder_test.rb +9 -9
  195. data/test/gir_ffi/builders/module_builder_test.rb +18 -18
  196. data/test/gir_ffi/builders/object_builder_test.rb +38 -38
  197. data/test/gir_ffi/builders/property_builder_test.rb +91 -94
  198. data/test/gir_ffi/builders/registered_type_builder_test.rb +35 -11
  199. data/test/gir_ffi/builders/return_value_builder_test.rb +215 -222
  200. data/test/gir_ffi/builders/signal_closure_builder_test.rb +122 -113
  201. data/test/gir_ffi/builders/struct_builder_test.rb +32 -32
  202. data/test/gir_ffi/builders/unintrospectable_boxed_builder_test.rb +8 -14
  203. data/test/gir_ffi/builders/unintrospectable_builder_test.rb +23 -23
  204. data/test/gir_ffi/builders/union_builder_test.rb +12 -15
  205. data/test/gir_ffi/builders/user_defined_builder_test.rb +147 -147
  206. data/test/gir_ffi/builders/vfunc_argument_builder_test.rb +40 -40
  207. data/test/gir_ffi/builders/vfunc_builder_test.rb +145 -157
  208. data/test/gir_ffi/callback_base_test.rb +9 -9
  209. data/test/gir_ffi/class_base_test.rb +49 -51
  210. data/test/gir_ffi/core_test.rb +32 -32
  211. data/test/gir_ffi/enum_base_test.rb +19 -19
  212. data/test/gir_ffi/error_type_info_test.rb +23 -23
  213. data/test/gir_ffi/ffi_ext/pointer_test.rb +5 -5
  214. data/test/gir_ffi/g_type_test.rb +11 -11
  215. data/test/gir_ffi/in_pointer_test.rb +70 -50
  216. data/test/gir_ffi/info_ext/i_callable_info_test.rb +5 -5
  217. data/test/gir_ffi/info_ext/i_callback_info_test.rb +4 -4
  218. data/test/gir_ffi/info_ext/i_field_info_test.rb +6 -6
  219. data/test/gir_ffi/info_ext/i_function_info_test.rb +17 -17
  220. data/test/gir_ffi/info_ext/i_signal_info_test.rb +8 -8
  221. data/test/gir_ffi/info_ext/i_type_info_test.rb +229 -215
  222. data/test/gir_ffi/info_ext/i_unresolved_info_test.rb +4 -4
  223. data/test/gir_ffi/info_ext/safe_constant_name_test.rb +8 -8
  224. data/test/gir_ffi/info_ext/safe_function_name_test.rb +8 -8
  225. data/test/gir_ffi/interface_base_test.rb +8 -8
  226. data/test/gir_ffi/method_stubber_test.rb +19 -19
  227. data/test/gir_ffi/object_base_test.rb +19 -19
  228. data/test/gir_ffi/object_store_test.rb +13 -13
  229. data/test/gir_ffi/receiver_argument_info_test.rb +15 -15
  230. data/test/gir_ffi/sized_array_test.rb +68 -68
  231. data/test/gir_ffi/struct_base_test.rb +8 -8
  232. data/test/gir_ffi/struct_like_base_test.rb +64 -64
  233. data/test/gir_ffi/type_map_test.rb +6 -6
  234. data/test/gir_ffi/unintrospectable_type_info_test.rb +33 -33
  235. data/test/gir_ffi/union_base_test.rb +8 -8
  236. data/test/gir_ffi/user_defined_object_info_test.rb +34 -34
  237. data/test/gir_ffi/user_defined_property_info_test.rb +16 -16
  238. data/test/gir_ffi/variable_name_generator_test.rb +8 -8
  239. data/test/gir_ffi/version_test.rb +4 -4
  240. data/test/gir_ffi/zero_terminated_test.rb +34 -34
  241. data/test/gir_ffi_test_helper.rb +3 -3
  242. data/test/integration/callback_exceptions_test.rb +17 -21
  243. data/test/integration/derived_classes_test.rb +13 -13
  244. data/test/integration/generated_everything_test.rb +224 -224
  245. data/test/integration/generated_gimarshallingtests_test.rb +1118 -1017
  246. data/test/integration/generated_gio_test.rb +36 -36
  247. data/test/integration/generated_glib_test.rb +4 -6
  248. data/test/integration/generated_gobject_test.rb +43 -35
  249. data/test/integration/generated_gst_test.rb +16 -16
  250. data/test/integration/generated_gtk_source_test.rb +22 -17
  251. data/test/integration/generated_gtop_test.rb +8 -15
  252. data/test/integration/generated_pango_ft2_test.rb +2 -2
  253. data/test/integration/generated_pango_test.rb +4 -4
  254. data/test/integration/generated_regress_test.rb +1809 -1621
  255. data/test/integration/generated_secret_test.rb +8 -11
  256. data/test/integration/generated_utility_test.rb +81 -81
  257. data/test/integration/generated_warnlib_test.rb +13 -19
  258. data/test/integration/method_lookup_test.rb +6 -6
  259. data/test/introspection_test_helper.rb +48 -7
  260. data/test/minitest/stats_plugin.rb +1 -1
  261. metadata +11 -28
  262. data/lib/ffi-glib/array_methods.rb +0 -16
  263. data/test/gir_ffi/in_out_pointer_test.rb +0 -56
@@ -1,455 +1,449 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'gir_ffi_test_helper'
3
+ require "gir_ffi_test_helper"
4
4
 
5
5
  describe GirFFI::Builders::ArgumentBuilder do
6
6
  let(:var_gen) { GirFFI::VariableNameGenerator.new }
7
7
  let(:builder) { GirFFI::Builders::ArgumentBuilder.new(var_gen, arg_info) }
8
8
 
9
- describe 'for an argument with direction :in' do
10
- describe 'for :c' do
11
- describe 'with full ownership transfer' do
9
+ describe "for an argument with direction :in" do
10
+ describe "for :c" do
11
+ describe "with full ownership transfer" do
12
12
  let(:arg_info) do
13
- get_introspection_data('GIMarshallingTests', 'array_struct_take_in').args[0]
13
+ get_introspection_data("GIMarshallingTests", "array_struct_take_in").args[0]
14
14
  end
15
15
 
16
- it 'has the correct value for #pre_conversion' do
17
- builder.pre_conversion.
18
- must_equal ['_v1 = GirFFI::SizedArray.copy_from([:pointer, GIMarshallingTests::BoxedStruct], -1, structs)']
16
+ it "has the correct value for #pre_conversion" do
17
+ _(builder.pre_conversion).
18
+ must_equal ["_v1 = GirFFI::SizedArray.copy_from([:pointer, GIMarshallingTests::BoxedStruct], -1, structs)"]
19
19
  end
20
20
 
21
- it 'has the correct value for #post_conversion' do
22
- builder.post_conversion.must_equal []
21
+ it "has the correct value for #post_conversion" do
22
+ _(builder.post_conversion).must_equal []
23
23
  end
24
24
  end
25
25
  end
26
26
 
27
- describe 'for :callback' do
27
+ describe "for :callback" do
28
28
  let(:arg_info) do
29
- get_introspection_data('Regress', 'test_callback_destroy_notify').args[0]
29
+ get_introspection_data("Regress", "test_callback_destroy_notify").args[0]
30
30
  end
31
31
 
32
- it 'has the correct value for #pre_conversion' do
33
- builder.pre_conversion.must_equal ['_v1 = Regress::TestCallbackUserData.from(callback)']
32
+ it "has the correct value for #pre_conversion" do
33
+ _(builder.pre_conversion).must_equal ["_v1 = Regress::TestCallbackUserData.from(callback)"]
34
34
  end
35
35
 
36
- it 'has the correct value for #post_conversion' do
37
- builder.post_conversion.must_equal []
36
+ it "has the correct value for #post_conversion" do
37
+ _(builder.post_conversion).must_equal []
38
38
  end
39
39
  end
40
40
 
41
- describe 'for :zero_terminated' do
41
+ describe "for :zero_terminated" do
42
42
  let(:arg_info) do
43
- get_introspection_data('GIMarshallingTests',
44
- 'array_in_len_zero_terminated').args[0]
43
+ get_introspection_data("GIMarshallingTests",
44
+ "array_in_len_zero_terminated").args[0]
45
45
  end
46
46
 
47
- it 'has the correct value for #pre_conversion' do
48
- builder.pre_conversion.must_equal ['_v1 = GirFFI::ZeroTerminated.from(:gint32, ints)']
47
+ it "has the correct value for #pre_conversion" do
48
+ _(builder.pre_conversion).must_equal ["_v1 = GirFFI::ZeroTerminated.from(:gint32, ints)"]
49
49
  end
50
50
 
51
- it 'has the correct value for #post_conversion' do
52
- builder.post_conversion.must_equal []
51
+ it "has the correct value for #post_conversion" do
52
+ _(builder.post_conversion).must_equal []
53
53
  end
54
54
  end
55
55
 
56
- describe 'for :void' do
57
- let(:arg_info) { get_introspection_data('Regress', 'test_callback_user_data').args[1] }
56
+ describe "for :void" do
57
+ let(:arg_info) { get_introspection_data("Regress", "test_callback_user_data").args[1] }
58
58
 
59
- describe 'when it is a regular argument' do
60
- it 'has the correct value for method_argument_name' do
61
- builder.method_argument_name.must_equal arg_info.name
59
+ describe "when it is a regular argument" do
60
+ it "has the correct value for method_argument_name" do
61
+ _(builder.method_argument_name).must_equal arg_info.name
62
62
  end
63
63
 
64
- it 'has the correct value for #pre_conversion' do
65
- builder.pre_conversion.must_equal ['_v1 = user_data']
64
+ it "has the correct value for #pre_conversion" do
65
+ _(builder.pre_conversion).must_equal ["_v1 = user_data"]
66
66
  end
67
67
 
68
- it 'has the correct value for #post_conversion' do
69
- builder.post_conversion.must_equal []
68
+ it "has the correct value for #post_conversion" do
69
+ _(builder.post_conversion).must_equal []
70
70
  end
71
71
  end
72
72
 
73
- describe 'when it is a closure' do
73
+ describe "when it is a closure" do
74
74
  before do
75
75
  callback = Object.new
76
- allow(callback).to receive(:call_argument_name).and_return 'foo'
76
+ allow(callback).to receive(:call_argument_name).and_return "foo"
77
77
  builder.mark_as_user_data callback
78
78
  end
79
79
 
80
- it 'has the correct value for method_argument_name' do
81
- builder.method_argument_name.must_be_nil
80
+ it "has the correct value for method_argument_name" do
81
+ _(builder.method_argument_name).must_be_nil
82
82
  end
83
83
 
84
- it 'has the correct value for #pre_conversion' do
85
- builder.pre_conversion.must_equal ['_v1 = GirFFI::ArgHelper.store(foo)']
84
+ it "has the correct value for #pre_conversion" do
85
+ _(builder.pre_conversion).must_equal ["_v1 = GirFFI::ArgHelper.store(foo)"]
86
86
  end
87
87
 
88
- it 'has the correct value for #post_conversion' do
89
- builder.post_conversion.must_equal []
88
+ it "has the correct value for #post_conversion" do
89
+ _(builder.post_conversion).must_equal []
90
90
  end
91
91
  end
92
92
  end
93
93
  end
94
94
 
95
- describe 'for an argument with direction :out' do
96
- describe 'for :enum' do
97
- let(:arg_info) { get_introspection_data('GIMarshallingTests', 'genum_out').args[0] }
95
+ describe "for an argument with direction :out" do
96
+ describe "for :enum" do
97
+ let(:arg_info) { get_introspection_data("GIMarshallingTests", "genum_out").args[0] }
98
98
 
99
- it 'has the correct value for #pre_conversion' do
100
- builder.pre_conversion.must_equal ['_v1 = FFI::MemoryPointer.new GIMarshallingTests::GEnum']
99
+ it "has the correct value for #pre_conversion" do
100
+ _(builder.pre_conversion).must_equal ["_v1 = FFI::MemoryPointer.new GIMarshallingTests::GEnum"]
101
101
  end
102
102
 
103
- it 'has the correct value for #post_conversion' do
104
- builder.post_conversion.must_equal ['_v2 = GIMarshallingTests::GEnum.get_value_from_pointer(_v1, 0)']
103
+ it "has the correct value for #post_conversion" do
104
+ _(builder.post_conversion).must_equal ["_v2 = GIMarshallingTests::GEnum.get_value_from_pointer(_v1, 0)"]
105
105
  end
106
106
  end
107
107
 
108
- describe 'for :flags' do
108
+ describe "for :flags" do
109
109
  let(:arg_info) do
110
- get_introspection_data('GIMarshallingTests', 'flags_out').args[0]
110
+ get_introspection_data("GIMarshallingTests", "flags_out").args[0]
111
111
  end
112
112
 
113
- it 'has the correct value for #pre_conversion' do
114
- builder.pre_conversion.must_equal ['_v1 = FFI::MemoryPointer.new GIMarshallingTests::Flags']
113
+ it "has the correct value for #pre_conversion" do
114
+ _(builder.pre_conversion).must_equal ["_v1 = FFI::MemoryPointer.new GIMarshallingTests::Flags"]
115
115
  end
116
116
 
117
- it 'has the correct value for #post_conversion' do
118
- builder.post_conversion.must_equal ['_v2 = GIMarshallingTests::Flags.get_value_from_pointer(_v1, 0)']
117
+ it "has the correct value for #post_conversion" do
118
+ _(builder.post_conversion).must_equal ["_v2 = GIMarshallingTests::Flags.get_value_from_pointer(_v1, 0)"]
119
119
  end
120
120
  end
121
121
 
122
- describe 'for :object' do
123
- describe 'with full ownership transfer' do
122
+ describe "for :object" do
123
+ describe "with full ownership transfer" do
124
124
  let(:arg_info) do
125
- get_method_introspection_data('Regress', 'TestObj', 'null_out').args[0]
125
+ get_method_introspection_data("Regress", "TestObj", "null_out").args[0]
126
126
  end
127
127
 
128
- it 'has the correct value for #pre_conversion' do
129
- builder.pre_conversion.must_equal ['_v1 = FFI::MemoryPointer.new :pointer']
128
+ it "has the correct value for #pre_conversion" do
129
+ _(builder.pre_conversion).must_equal ["_v1 = FFI::MemoryPointer.new :pointer"]
130
130
  end
131
131
 
132
- it 'has the correct value for #post_conversion' do
133
- builder.post_conversion.must_equal ['_v2 = Regress::TestObj.wrap(_v1.get_pointer(0))']
132
+ it "has the correct value for #post_conversion" do
133
+ _(builder.post_conversion).must_equal ["_v2 = Regress::TestObj.wrap(_v1.get_pointer(0))"]
134
134
  end
135
135
  end
136
136
 
137
- describe 'with no ownership transfer' do
137
+ describe "with no ownership transfer" do
138
138
  let(:arg_info) do
139
- get_method_introspection_data('GIMarshallingTests', 'Object', 'none_out').args[0]
139
+ get_method_introspection_data("GIMarshallingTests", "Object", "none_out").args[0]
140
140
  end
141
141
 
142
- it 'has the correct value for #pre_conversion' do
143
- builder.pre_conversion.must_equal ['_v1 = FFI::MemoryPointer.new :pointer']
142
+ it "has the correct value for #pre_conversion" do
143
+ _(builder.pre_conversion).must_equal ["_v1 = FFI::MemoryPointer.new :pointer"]
144
144
  end
145
145
 
146
- it 'has the correct value for #post_conversion' do
147
- builder.post_conversion.
148
- must_equal ['_v2 = GIMarshallingTests::Object.wrap(_v1.get_pointer(0)).tap { |it| it && it.ref }']
146
+ it "has the correct value for #post_conversion" do
147
+ _(builder.post_conversion).
148
+ must_equal ["_v2 = GIMarshallingTests::Object.wrap(_v1.get_pointer(0)).tap { |it| it && it.ref }"]
149
149
  end
150
150
  end
151
151
  end
152
152
 
153
- describe 'for :struct' do
154
- describe 'when not allocated by the caller' do
153
+ describe "for :struct" do
154
+ describe "when not allocated by the caller" do
155
155
  let(:arg_info) do
156
- get_introspection_data('GIMarshallingTests', 'boxed_struct_out').args[0]
156
+ get_introspection_data("GIMarshallingTests", "boxed_struct_out").args[0]
157
157
  end
158
158
 
159
- it 'has the correct value for #pre_conversion' do
160
- builder.pre_conversion.must_equal [
161
- '_v1 = FFI::MemoryPointer.new :pointer'
159
+ it "has the correct value for #pre_conversion" do
160
+ _(builder.pre_conversion).must_equal [
161
+ "_v1 = FFI::MemoryPointer.new :pointer"
162
162
  ]
163
163
  end
164
164
 
165
- it 'has the correct value for #post_conversion' do
166
- builder.post_conversion.
167
- must_equal ['_v2 = GIMarshallingTests::BoxedStruct.wrap_copy(_v1.get_pointer(0))']
165
+ it "has the correct value for #post_conversion" do
166
+ _(builder.post_conversion).
167
+ must_equal ["_v2 = GIMarshallingTests::BoxedStruct.wrap_copy(_v1.get_pointer(0))"]
168
168
  end
169
169
  end
170
170
 
171
- describe 'when allocated by the caller' do
171
+ describe "when allocated by the caller" do
172
172
  let(:arg_info) do
173
- get_method_introspection_data('Regress', 'TestStructA', 'clone').args[0]
173
+ get_method_introspection_data("Regress", "TestStructA", "clone").args[0]
174
174
  end
175
175
 
176
- it 'has the correct value for #pre_conversion' do
177
- builder.pre_conversion.must_equal ['_v1 = Regress::TestStructA.new']
176
+ it "has the correct value for #pre_conversion" do
177
+ _(builder.pre_conversion).must_equal ["_v1 = Regress::TestStructA.new"]
178
178
  end
179
179
 
180
- it 'has empty #post_conversion' do
181
- builder.post_conversion.must_equal []
180
+ it "has empty #post_conversion" do
181
+ _(builder.post_conversion).must_equal []
182
182
  end
183
183
  end
184
184
  end
185
185
 
186
- describe 'for :strv' do
186
+ describe "for :strv" do
187
187
  let(:arg_info) do
188
- get_introspection_data('GIMarshallingTests', 'gstrv_out').args[0]
188
+ get_introspection_data("GIMarshallingTests", "gstrv_out").args[0]
189
189
  end
190
190
 
191
- it 'has the correct value for #pre_conversion' do
192
- builder.pre_conversion.must_equal ['_v1 = FFI::MemoryPointer.new :pointer']
191
+ it "has the correct value for #pre_conversion" do
192
+ _(builder.pre_conversion).must_equal ["_v1 = FFI::MemoryPointer.new :pointer"]
193
193
  end
194
194
 
195
- it 'has the correct value for #post_conversion' do
196
- builder.post_conversion.must_equal ['_v2 = GLib::Strv.wrap(_v1.get_pointer(0))']
195
+ it "has the correct value for #post_conversion" do
196
+ _(builder.post_conversion).must_equal ["_v2 = GLib::Strv.wrap(_v1.get_pointer(0))"]
197
197
  end
198
198
  end
199
199
 
200
- describe 'for :array' do
201
- describe 'when allocated by the callee' do
200
+ describe "for :array" do
201
+ describe "when allocated by the callee" do
202
202
  let(:arg_info) do
203
- get_introspection_data('GIMarshallingTests', 'garray_utf8_none_out').args[0]
203
+ get_introspection_data("GIMarshallingTests", "garray_utf8_none_out").args[0]
204
204
  end
205
205
 
206
- it 'has the correct value for #pre_conversion' do
207
- builder.pre_conversion.must_equal ['_v1 = FFI::MemoryPointer.new :pointer']
206
+ it "has the correct value for #pre_conversion" do
207
+ _(builder.pre_conversion).must_equal ["_v1 = FFI::MemoryPointer.new :pointer"]
208
208
  end
209
209
 
210
- it 'has the correct value for #post_conversion' do
211
- builder.post_conversion.must_equal ['_v2 = GLib::Array.wrap(:utf8, _v1.get_pointer(0))']
210
+ it "has the correct value for #post_conversion" do
211
+ _(builder.post_conversion).must_equal ["_v2 = GLib::Array.wrap(:utf8, _v1.get_pointer(0))"]
212
212
  end
213
213
  end
214
214
 
215
- describe 'when allocated by the caller' do
215
+ describe "when allocated by the caller" do
216
216
  let(:function_info) do
217
- get_introspection_data('GIMarshallingTests', 'garray_utf8_full_out_caller_allocated')
217
+ get_introspection_data("GIMarshallingTests", "garray_utf8_full_out_caller_allocated")
218
218
  end
219
219
 
220
220
  let(:arg_info) { function_info.args[0] }
221
221
 
222
- before do
223
- skip unless function_info
224
- end
225
-
226
- it 'has the correct value for #pre_conversion' do
227
- builder.pre_conversion.must_equal ['_v1 = GLib::Array.new :utf8']
222
+ it "has the correct value for #pre_conversion" do
223
+ _(builder.pre_conversion).must_equal ["_v1 = GLib::Array.new :utf8"]
228
224
  end
229
225
 
230
- it 'has empty #post_conversion' do
231
- builder.post_conversion.must_equal []
226
+ it "has empty #post_conversion" do
227
+ _(builder.post_conversion).must_equal []
232
228
  end
233
229
  end
234
230
  end
235
231
 
236
- describe 'for :ptr_array' do
232
+ describe "for :ptr_array" do
237
233
  let(:arg_info) do
238
- get_introspection_data('GIMarshallingTests', 'gptrarray_utf8_none_out').args[0]
234
+ get_introspection_data("GIMarshallingTests", "gptrarray_utf8_none_out").args[0]
239
235
  end
240
236
 
241
- it 'has the correct value for #pre_conversion' do
242
- builder.pre_conversion.must_equal ['_v1 = FFI::MemoryPointer.new :pointer']
237
+ it "has the correct value for #pre_conversion" do
238
+ _(builder.pre_conversion).must_equal ["_v1 = FFI::MemoryPointer.new :pointer"]
243
239
  end
244
240
 
245
- it 'has the correct value for #post_conversion' do
246
- builder.post_conversion.must_equal ['_v2 = GLib::PtrArray.wrap(:utf8, _v1.get_pointer(0))']
241
+ it "has the correct value for #post_conversion" do
242
+ _(builder.post_conversion).must_equal ["_v2 = GLib::PtrArray.wrap(:utf8, _v1.get_pointer(0))"]
247
243
  end
248
244
  end
249
245
 
250
- describe 'for :error' do
246
+ describe "for :error" do
251
247
  let(:arg_info) do
252
- get_introspection_data('GIMarshallingTests', 'gerror_out').args[0]
248
+ get_introspection_data("GIMarshallingTests", "gerror_out").args[0]
253
249
  end
254
250
 
255
- it 'has the correct value for #pre_conversion' do
256
- builder.pre_conversion.must_equal ['_v1 = FFI::MemoryPointer.new :pointer']
251
+ it "has the correct value for #pre_conversion" do
252
+ _(builder.pre_conversion).must_equal ["_v1 = FFI::MemoryPointer.new :pointer"]
257
253
  end
258
254
 
259
- it 'has the correct value for #post_conversion' do
260
- builder.post_conversion.must_equal ['_v2 = GLib::Error.wrap(_v1.get_pointer(0))']
255
+ it "has the correct value for #post_conversion" do
256
+ _(builder.post_conversion).must_equal ["_v2 = GLib::Error.wrap(_v1.get_pointer(0))"]
261
257
  end
262
258
  end
263
259
 
264
- describe 'for :c' do
265
- describe 'with fixed size' do
260
+ describe "for :c" do
261
+ describe "with fixed size" do
266
262
  let(:arg_info) do
267
- get_introspection_data('GIMarshallingTests', 'array_fixed_out').args[0]
263
+ get_introspection_data("GIMarshallingTests", "array_fixed_out").args[0]
268
264
  end
269
265
 
270
- it 'has the correct value for #pre_conversion' do
271
- builder.pre_conversion.must_equal ['_v1 = FFI::MemoryPointer.new :pointer']
266
+ it "has the correct value for #pre_conversion" do
267
+ _(builder.pre_conversion).must_equal ["_v1 = FFI::MemoryPointer.new :pointer"]
272
268
  end
273
269
 
274
- it 'has the correct value for #post_conversion' do
275
- builder.post_conversion.must_equal ['_v2 = GirFFI::SizedArray.wrap(:gint32, 4, _v1.get_pointer(0))']
270
+ it "has the correct value for #post_conversion" do
271
+ _(builder.post_conversion).must_equal ["_v2 = GirFFI::SizedArray.wrap(:gint32, 4, _v1.get_pointer(0))"]
276
272
  end
277
273
  end
278
274
 
279
- describe 'with separate size parameter' do
275
+ describe "with separate size parameter" do
280
276
  let(:arg_info) do
281
- get_introspection_data('GIMarshallingTests', 'array_out').args[0]
277
+ get_introspection_data("GIMarshallingTests", "array_out").args[0]
282
278
  end
283
279
 
284
280
  let(:length_argument) { Object.new }
285
281
  before do
286
- allow(length_argument).to receive(:post_converted_name).and_return 'bar'
282
+ allow(length_argument).to receive(:post_converted_name).and_return "bar"
287
283
  builder.length_arg = length_argument
288
284
  end
289
285
 
290
- it 'has the correct value for #pre_conversion' do
291
- builder.pre_conversion.must_equal ['_v1 = FFI::MemoryPointer.new :pointer']
286
+ it "has the correct value for #pre_conversion" do
287
+ _(builder.pre_conversion).must_equal ["_v1 = FFI::MemoryPointer.new :pointer"]
292
288
  end
293
289
 
294
- it 'has the correct value for #post_conversion' do
295
- builder.post_conversion.must_equal ['_v2 = GirFFI::SizedArray.wrap(:gint32, bar, _v1.get_pointer(0))']
290
+ it "has the correct value for #post_conversion" do
291
+ _(builder.post_conversion).must_equal ["_v2 = GirFFI::SizedArray.wrap(:gint32, bar, _v1.get_pointer(0))"]
296
292
  end
297
293
  end
298
294
  end
299
295
 
300
- describe 'for :glist' do
296
+ describe "for :glist" do
301
297
  let(:arg_info) do
302
- get_introspection_data('GIMarshallingTests', 'glist_utf8_none_out').args[0]
298
+ get_introspection_data("GIMarshallingTests", "glist_utf8_none_out").args[0]
303
299
  end
304
300
 
305
- it 'has the correct value for #pre_conversion' do
306
- builder.pre_conversion.must_equal ['_v1 = FFI::MemoryPointer.new :pointer']
301
+ it "has the correct value for #pre_conversion" do
302
+ _(builder.pre_conversion).must_equal ["_v1 = FFI::MemoryPointer.new :pointer"]
307
303
  end
308
304
 
309
- it 'has the correct value for #post_conversion' do
310
- builder.post_conversion.must_equal ['_v2 = GLib::List.wrap(:utf8, _v1.get_pointer(0))']
305
+ it "has the correct value for #post_conversion" do
306
+ _(builder.post_conversion).must_equal ["_v2 = GLib::List.wrap(:utf8, _v1.get_pointer(0))"]
311
307
  end
312
308
  end
313
309
 
314
- describe 'for :gslist' do
310
+ describe "for :gslist" do
315
311
  let(:arg_info) do
316
- get_introspection_data('GIMarshallingTests', 'gslist_utf8_none_out').args[0]
312
+ get_introspection_data("GIMarshallingTests", "gslist_utf8_none_out").args[0]
317
313
  end
318
314
 
319
- it 'has the correct value for #pre_conversion' do
320
- builder.pre_conversion.must_equal ['_v1 = FFI::MemoryPointer.new :pointer']
315
+ it "has the correct value for #pre_conversion" do
316
+ _(builder.pre_conversion).must_equal ["_v1 = FFI::MemoryPointer.new :pointer"]
321
317
  end
322
318
 
323
- it 'has the correct value for #post_conversion' do
324
- builder.post_conversion.must_equal ['_v2 = GLib::SList.wrap(:utf8, _v1.get_pointer(0))']
319
+ it "has the correct value for #post_conversion" do
320
+ _(builder.post_conversion).must_equal ["_v2 = GLib::SList.wrap(:utf8, _v1.get_pointer(0))"]
325
321
  end
326
322
  end
327
323
 
328
- describe 'for :ghash' do
324
+ describe "for :ghash" do
329
325
  let(:arg_info) do
330
- get_introspection_data('GIMarshallingTests', 'ghashtable_utf8_none_out').args[0]
326
+ get_introspection_data("GIMarshallingTests", "ghashtable_utf8_none_out").args[0]
331
327
  end
332
328
 
333
- it 'has the correct value for #pre_conversion' do
334
- builder.pre_conversion.must_equal ['_v1 = FFI::MemoryPointer.new :pointer']
329
+ it "has the correct value for #pre_conversion" do
330
+ _(builder.pre_conversion).must_equal ["_v1 = FFI::MemoryPointer.new :pointer"]
335
331
  end
336
332
 
337
- it 'has the correct value for #post_conversion' do
338
- builder.post_conversion.must_equal ['_v2 = GLib::HashTable.wrap([:utf8, :utf8], _v1.get_pointer(0))']
333
+ it "has the correct value for #post_conversion" do
334
+ _(builder.post_conversion).must_equal ["_v2 = GLib::HashTable.wrap([:utf8, :utf8], _v1.get_pointer(0))"]
339
335
  end
340
336
  end
341
337
 
342
- describe 'for :utf8' do
343
- describe 'with full ownership transfer' do
338
+ describe "for :utf8" do
339
+ describe "with full ownership transfer" do
344
340
  let(:arg_info) do
345
- get_introspection_data('GIMarshallingTests', 'utf8_full_out').args[0]
341
+ get_introspection_data("GIMarshallingTests", "utf8_full_out").args[0]
346
342
  end
347
343
 
348
- it 'has the correct value for #pre_conversion' do
349
- builder.pre_conversion.must_equal ['_v1 = FFI::MemoryPointer.new :pointer']
344
+ it "has the correct value for #pre_conversion" do
345
+ _(builder.pre_conversion).must_equal ["_v1 = FFI::MemoryPointer.new :pointer"]
350
346
  end
351
347
 
352
- it 'has the correct value for #post_conversion' do
353
- builder.post_conversion.must_equal [
354
- '_v2 = GirFFI::AllocationHelper.free_after _v1.get_pointer(0), &:to_utf8'
348
+ it "has the correct value for #post_conversion" do
349
+ _(builder.post_conversion).must_equal [
350
+ "_v2 = GirFFI::AllocationHelper.free_after _v1.get_pointer(0), &:to_utf8"
355
351
  ]
356
352
  end
357
353
 
358
- it 'has the correct value for #return_value_name' do
354
+ it "has the correct value for #return_value_name" do
359
355
  builder.post_conversion
360
- builder.return_value_name.must_equal '_v2'
356
+ _(builder.return_value_name).must_equal "_v2"
361
357
  end
362
358
  end
363
359
 
364
- describe 'with no ownership transfer' do
360
+ describe "with no ownership transfer" do
365
361
  let(:arg_info) do
366
- get_introspection_data('GIMarshallingTests', 'utf8_none_out').args[0]
362
+ get_introspection_data("GIMarshallingTests", "utf8_none_out").args[0]
367
363
  end
368
364
 
369
- it 'has the correct value for #pre_conversion' do
370
- builder.pre_conversion.must_equal ['_v1 = FFI::MemoryPointer.new :pointer']
365
+ it "has the correct value for #pre_conversion" do
366
+ _(builder.pre_conversion).must_equal ["_v1 = FFI::MemoryPointer.new :pointer"]
371
367
  end
372
368
 
373
- it 'has the correct value for #post_conversion' do
374
- builder.post_conversion.must_equal ['_v2 = _v1.get_pointer(0).to_utf8']
369
+ it "has the correct value for #post_conversion" do
370
+ _(builder.post_conversion).must_equal ["_v2 = _v1.get_pointer(0).to_utf8"]
375
371
  end
376
372
  end
377
373
  end
378
374
 
379
- describe 'for :void' do
375
+ describe "for :void" do
380
376
  let(:function_info) do
381
- get_introspection_data('Everything', 'one_outparam_gpointer')
377
+ get_introspection_data("Everything", "one_outparam_gpointer")
382
378
  end
383
379
  let(:arg_info) { function_info.args[0] }
384
380
 
385
- before do
386
- skip unless function_info
387
- end
381
+ before { skip_below "1.47.1" }
388
382
 
389
- it 'has the correct value for #pre_conversion' do
390
- builder.pre_conversion.must_equal ['_v1 = FFI::MemoryPointer.new :pointer']
383
+ it "has the correct value for #pre_conversion" do
384
+ _(builder.pre_conversion).must_equal ["_v1 = FFI::MemoryPointer.new :pointer"]
391
385
  end
392
386
 
393
- it 'has the correct value for #post_conversion' do
394
- builder.post_conversion.must_equal ['_v2 = _v1.get_pointer(0)']
387
+ it "has the correct value for #post_conversion" do
388
+ _(builder.post_conversion).must_equal ["_v2 = _v1.get_pointer(0)"]
395
389
  end
396
390
  end
397
391
  end
398
392
 
399
- describe 'for an argument with direction :inout' do
400
- describe 'for :enum' do
393
+ describe "for an argument with direction :inout" do
394
+ describe "for :enum" do
401
395
  let(:arg_info) do
402
- get_introspection_data('GIMarshallingTests', 'enum_inout').args[0]
396
+ get_introspection_data("GIMarshallingTests", "enum_inout").args[0]
403
397
  end
404
398
 
405
- it 'has the correct value for #pre_conversion' do
406
- builder.pre_conversion.must_equal ['_v1 = FFI::MemoryPointer.new GIMarshallingTests::Enum',
407
- "GIMarshallingTests::Enum.copy_value_to_pointer(#{arg_info.name}, _v1)"]
399
+ it "has the correct value for #pre_conversion" do
400
+ _(builder.pre_conversion).must_equal ["_v1 = FFI::MemoryPointer.new GIMarshallingTests::Enum",
401
+ "GIMarshallingTests::Enum.copy_value_to_pointer(#{arg_info.name}, _v1)"]
408
402
  end
409
403
 
410
- it 'has the correct value for #post_conversion' do
411
- builder.post_conversion.must_equal ['_v2 = GIMarshallingTests::Enum.get_value_from_pointer(_v1, 0)']
404
+ it "has the correct value for #post_conversion" do
405
+ _(builder.post_conversion).must_equal ["_v2 = GIMarshallingTests::Enum.get_value_from_pointer(_v1, 0)"]
412
406
  end
413
407
  end
414
408
 
415
- describe 'for :flags' do
409
+ describe "for :flags" do
416
410
  let(:arg_info) do
417
- get_introspection_data('GIMarshallingTests', 'no_type_flags_inout').args[0]
411
+ get_introspection_data("GIMarshallingTests", "no_type_flags_inout").args[0]
418
412
  end
419
413
 
420
- it 'has the correct value for #pre_conversion' do
421
- builder.pre_conversion.
422
- must_equal ['_v1 = FFI::MemoryPointer.new GIMarshallingTests::NoTypeFlags',
414
+ it "has the correct value for #pre_conversion" do
415
+ _(builder.pre_conversion).
416
+ must_equal ["_v1 = FFI::MemoryPointer.new GIMarshallingTests::NoTypeFlags",
423
417
  "GIMarshallingTests::NoTypeFlags.copy_value_to_pointer(#{arg_info.name}, _v1)"]
424
418
  end
425
419
 
426
- it 'has the correct value for #post_conversion' do
427
- builder.post_conversion.must_equal ['_v2 = GIMarshallingTests::NoTypeFlags.get_value_from_pointer(_v1, 0)']
420
+ it "has the correct value for #post_conversion" do
421
+ _(builder.post_conversion).must_equal ["_v2 = GIMarshallingTests::NoTypeFlags.get_value_from_pointer(_v1, 0)"]
428
422
  end
429
423
  end
430
424
 
431
- describe 'for :gint32' do
425
+ describe "for :gint32" do
432
426
  let(:arg_info) do
433
- get_introspection_data('GIMarshallingTests', 'int32_inout_min_max').args[0]
427
+ get_introspection_data("GIMarshallingTests", "int32_inout_min_max").args[0]
434
428
  end
435
429
 
436
- it 'has the correct value for method_argument_name' do
437
- builder.method_argument_name.must_equal arg_info.name
430
+ it "has the correct value for method_argument_name" do
431
+ _(builder.method_argument_name).must_equal arg_info.name
438
432
  end
439
433
 
440
- it 'has the correct value for #pre_conversion' do
441
- builder.pre_conversion.must_equal ['_v1 = FFI::MemoryPointer.new :int32',
442
- "_v1.put_int32 0, #{arg_info.name}"]
434
+ it "has the correct value for #pre_conversion" do
435
+ _(builder.pre_conversion).must_equal ["_v1 = FFI::MemoryPointer.new :int32",
436
+ "_v1.put_int32 0, #{arg_info.name}"]
443
437
  end
444
438
 
445
- it 'has the correct value for #post_conversion' do
446
- builder.post_conversion.must_equal ['_v2 = _v1.get_int32(0)']
439
+ it "has the correct value for #post_conversion" do
440
+ _(builder.post_conversion).must_equal ["_v2 = _v1.get_int32(0)"]
447
441
  end
448
442
  end
449
443
 
450
- describe 'for an array length' do
444
+ describe "for an array length" do
451
445
  let(:function_info) do
452
- get_introspection_data('Regress', 'test_array_int_inout')
446
+ get_introspection_data("Regress", "test_array_int_inout")
453
447
  end
454
448
  let(:arg_info) { function_info.args[0] }
455
449
  let(:array_arg_info) { function_info.args[1] }
@@ -461,104 +455,104 @@ describe GirFFI::Builders::ArgumentBuilder do
461
455
  builder.array_arg = array_arg_builder
462
456
  end
463
457
 
464
- it 'has the correct value for #pre_conversion' do
465
- builder.pre_conversion.must_equal ['n_ints = ints.nil? ? 0 : ints.length',
466
- '_v1 = FFI::MemoryPointer.new :int32',
467
- '_v1.put_int32 0, n_ints']
458
+ it "has the correct value for #pre_conversion" do
459
+ _(builder.pre_conversion).must_equal ["n_ints = ints.nil? ? 0 : ints.length",
460
+ "_v1 = FFI::MemoryPointer.new :int32",
461
+ "_v1.put_int32 0, n_ints"]
468
462
  end
469
463
 
470
- it 'has the correct value for #post_conversion' do
471
- builder.post_conversion.must_equal ['_v2 = _v1.get_int32(0)']
464
+ it "has the correct value for #post_conversion" do
465
+ _(builder.post_conversion).must_equal ["_v2 = _v1.get_int32(0)"]
472
466
  end
473
467
  end
474
468
 
475
- describe 'for :strv' do
469
+ describe "for :strv" do
476
470
  let(:arg_info) do
477
- get_introspection_data('GIMarshallingTests', 'gstrv_inout').args[0]
471
+ get_introspection_data("GIMarshallingTests", "gstrv_inout").args[0]
478
472
  end
479
473
 
480
- it 'has the correct value for #pre_conversion' do
481
- builder.pre_conversion.must_equal ['_v1 = FFI::MemoryPointer.new :pointer',
482
- '_v1.put_pointer 0, GLib::Strv.from(g_strv)']
474
+ it "has the correct value for #pre_conversion" do
475
+ _(builder.pre_conversion).must_equal ["_v1 = FFI::MemoryPointer.new :pointer",
476
+ "_v1.put_pointer 0, GLib::Strv.from(g_strv)"]
483
477
  end
484
478
 
485
- it 'has the correct value for #post_conversion' do
486
- builder.post_conversion.must_equal ['_v2 = GLib::Strv.wrap(_v1.get_pointer(0))']
479
+ it "has the correct value for #post_conversion" do
480
+ _(builder.post_conversion).must_equal ["_v2 = GLib::Strv.wrap(_v1.get_pointer(0))"]
487
481
  end
488
482
  end
489
483
 
490
- describe 'for :ptr_array' do
484
+ describe "for :ptr_array" do
491
485
  let(:arg_info) do
492
- get_introspection_data('GIMarshallingTests', 'gptrarray_utf8_none_inout').args[0]
486
+ get_introspection_data("GIMarshallingTests", "gptrarray_utf8_none_inout").args[0]
493
487
  end
494
488
 
495
- it 'has the correct value for #pre_conversion' do
496
- builder.pre_conversion.must_equal ['_v1 = FFI::MemoryPointer.new :pointer',
497
- '_v1.put_pointer 0, GLib::PtrArray.from(:utf8, parray_)']
489
+ it "has the correct value for #pre_conversion" do
490
+ _(builder.pre_conversion).must_equal ["_v1 = FFI::MemoryPointer.new :pointer",
491
+ "_v1.put_pointer 0, GLib::PtrArray.from(:utf8, parray_)"]
498
492
  end
499
493
 
500
- it 'has the correct value for #post_conversion' do
501
- builder.post_conversion.must_equal ['_v2 = GLib::PtrArray.wrap(:utf8, _v1.get_pointer(0))']
494
+ it "has the correct value for #post_conversion" do
495
+ _(builder.post_conversion).must_equal ["_v2 = GLib::PtrArray.wrap(:utf8, _v1.get_pointer(0))"]
502
496
  end
503
497
  end
504
498
 
505
- describe 'for :utf8' do
499
+ describe "for :utf8" do
506
500
  let(:arg_info) do
507
- get_introspection_data('GIMarshallingTests', 'utf8_none_inout').args[0]
501
+ get_introspection_data("GIMarshallingTests", "utf8_none_inout").args[0]
508
502
  end
509
503
 
510
- it 'has the correct value for #pre_conversion' do
511
- builder.pre_conversion.must_equal ['_v1 = FFI::MemoryPointer.new :pointer',
512
- '_v1.put_pointer 0, GirFFI::InPointer.from_utf8(utf8)']
504
+ it "has the correct value for #pre_conversion" do
505
+ _(builder.pre_conversion).must_equal ["_v1 = FFI::MemoryPointer.new :pointer",
506
+ "_v1.put_pointer 0, GirFFI::InPointer.from_utf8(utf8)"]
513
507
  end
514
508
 
515
- it 'has the correct value for #post_conversion' do
516
- builder.post_conversion.must_equal ['_v2 = _v1.get_pointer(0).to_utf8']
509
+ it "has the correct value for #post_conversion" do
510
+ _(builder.post_conversion).must_equal ["_v2 = _v1.get_pointer(0).to_utf8"]
517
511
  end
518
512
  end
519
513
 
520
- describe 'for :struct' do
521
- describe 'with full ownership transfer' do
514
+ describe "for :struct" do
515
+ describe "with full ownership transfer" do
522
516
  let(:arg_info) do
523
- get_introspection_data('GIMarshallingTests', 'boxed_struct_inout').args[0]
517
+ get_introspection_data("GIMarshallingTests", "boxed_struct_inout").args[0]
524
518
  end
525
519
 
526
- it 'has the correct value for #pre_conversion' do
527
- builder.pre_conversion.must_equal [
528
- '_v1 = FFI::MemoryPointer.new :pointer',
529
- '_v1.put_pointer 0, GIMarshallingTests::BoxedStruct.copy_from(struct_)'
520
+ it "has the correct value for #pre_conversion" do
521
+ _(builder.pre_conversion).must_equal [
522
+ "_v1 = FFI::MemoryPointer.new :pointer",
523
+ "_v1.put_pointer 0, GIMarshallingTests::BoxedStruct.copy_from(struct_)"
530
524
  ]
531
525
  end
532
526
 
533
- it 'has the correct value for #post_conversion' do
534
- builder.post_conversion.
535
- must_equal ['_v2 = GIMarshallingTests::BoxedStruct.wrap_own(_v1.get_pointer(0))']
527
+ it "has the correct value for #post_conversion" do
528
+ _(builder.post_conversion).
529
+ must_equal ["_v2 = GIMarshallingTests::BoxedStruct.wrap_own(_v1.get_pointer(0))"]
536
530
  end
537
531
  end
538
532
  end
539
533
 
540
- describe 'for :c' do
541
- describe 'with fixed size' do
534
+ describe "for :c" do
535
+ describe "with fixed size" do
542
536
  let(:arg_info) do
543
- get_introspection_data('GIMarshallingTests', 'array_fixed_inout').args[0]
537
+ get_introspection_data("GIMarshallingTests", "array_fixed_inout").args[0]
544
538
  end
545
539
 
546
- it 'has the correct value for #pre_conversion' do
547
- builder.pre_conversion.must_equal [
540
+ it "has the correct value for #pre_conversion" do
541
+ _(builder.pre_conversion).must_equal [
548
542
  'GirFFI::ArgHelper.check_fixed_array_size 4, ints, "ints"',
549
- '_v1 = FFI::MemoryPointer.new :pointer',
550
- '_v1.put_pointer 0, GirFFI::SizedArray.from(:gint32, 4, ints)'
543
+ "_v1 = FFI::MemoryPointer.new :pointer",
544
+ "_v1.put_pointer 0, GirFFI::SizedArray.from(:gint32, 4, ints)"
551
545
  ]
552
546
  end
553
547
 
554
- it 'has the correct value for #post_conversion' do
555
- builder.post_conversion.must_equal ['_v2 = GirFFI::SizedArray.wrap(:gint32, 4, _v1.get_pointer(0))']
548
+ it "has the correct value for #post_conversion" do
549
+ _(builder.post_conversion).must_equal ["_v2 = GirFFI::SizedArray.wrap(:gint32, 4, _v1.get_pointer(0))"]
556
550
  end
557
551
  end
558
552
 
559
- describe 'with separate size parameter' do
553
+ describe "with separate size parameter" do
560
554
  let(:function_info) do
561
- get_introspection_data('Regress', 'test_array_int_inout')
555
+ get_introspection_data("Regress", "test_array_int_inout")
562
556
  end
563
557
  let(:length_arg_info) { function_info.args[0] }
564
558
  let(:arg_info) { function_info.args[1] }
@@ -570,87 +564,87 @@ describe GirFFI::Builders::ArgumentBuilder do
570
564
  builder.length_arg = length_arg_builder
571
565
  end
572
566
 
573
- it 'has the correct value for #pre_conversion' do
574
- builder.pre_conversion.must_equal [
575
- '_v1 = FFI::MemoryPointer.new :pointer',
576
- '_v1.put_pointer 0, GirFFI::SizedArray.copy_from(:gint32, -1, ints)'
567
+ it "has the correct value for #pre_conversion" do
568
+ _(builder.pre_conversion).must_equal [
569
+ "_v1 = FFI::MemoryPointer.new :pointer",
570
+ "_v1.put_pointer 0, GirFFI::SizedArray.copy_from(:gint32, -1, ints)"
577
571
  ]
578
572
  end
579
573
 
580
- it 'has the correct value for #post_conversion' do
581
- builder.post_conversion.must_equal ['_v3 = GirFFI::SizedArray.wrap(:gint32, _v2, _v1.get_pointer(0))']
574
+ it "has the correct value for #post_conversion" do
575
+ _(builder.post_conversion).must_equal ["_v3 = GirFFI::SizedArray.wrap(:gint32, _v2, _v1.get_pointer(0))"]
582
576
  end
583
577
  end
584
578
  end
585
579
  end
586
580
 
587
- describe 'for a skipped argument with direction :in' do
581
+ describe "for a skipped argument with direction :in" do
588
582
  let(:arg_info) do
589
- get_method_introspection_data('Regress', 'TestObj', 'skip_param').args[2]
583
+ get_method_introspection_data("Regress", "TestObj", "skip_param").args[2]
590
584
  end
591
585
 
592
- it 'has the correct value for method_argument_name' do
593
- builder.method_argument_name.must_be_nil
586
+ it "has the correct value for method_argument_name" do
587
+ _(builder.method_argument_name).must_be_nil
594
588
  end
595
589
 
596
- it 'has the correct value for #pre_conversion' do
597
- builder.pre_conversion.must_equal ['_v1 = 0']
590
+ it "has the correct value for #pre_conversion" do
591
+ _(builder.pre_conversion).must_equal ["_v1 = 0"]
598
592
  end
599
593
 
600
- it 'has the correct value for #post_conversion' do
601
- builder.post_conversion.must_equal []
594
+ it "has the correct value for #post_conversion" do
595
+ _(builder.post_conversion).must_equal []
602
596
  end
603
597
  end
604
598
 
605
- describe 'for a skipped argument with direction :inout' do
599
+ describe "for a skipped argument with direction :inout" do
606
600
  let(:arg_info) do
607
- get_method_introspection_data('Regress', 'TestObj', 'skip_inout_param').args[3]
601
+ get_method_introspection_data("Regress", "TestObj", "skip_inout_param").args[3]
608
602
  end
609
603
 
610
- it 'has the correct value for method_argument_name' do
611
- builder.method_argument_name.must_be_nil
604
+ it "has the correct value for method_argument_name" do
605
+ _(builder.method_argument_name).must_be_nil
612
606
  end
613
607
 
614
- it 'has the correct value for #pre_conversion' do
615
- builder.pre_conversion.must_equal ['_v1 = FFI::MemoryPointer.new :int32',
616
- '_v1.put_int32 0, 0']
608
+ it "has the correct value for #pre_conversion" do
609
+ _(builder.pre_conversion).must_equal ["_v1 = FFI::MemoryPointer.new :int32",
610
+ "_v1.put_int32 0, 0"]
617
611
  end
618
612
 
619
- it 'has the correct value for #post_conversion' do
620
- builder.post_conversion.must_equal []
613
+ it "has the correct value for #post_conversion" do
614
+ _(builder.post_conversion).must_equal []
621
615
  end
622
616
  end
623
617
 
624
- describe 'for a skipped argument with direction :out' do
618
+ describe "for a skipped argument with direction :out" do
625
619
  let(:arg_info) do
626
- get_method_introspection_data('Regress', 'TestObj', 'skip_out_param').args[1]
620
+ get_method_introspection_data("Regress", "TestObj", "skip_out_param").args[1]
627
621
  end
628
622
 
629
- it 'has the correct value for method_argument_name' do
630
- builder.method_argument_name.must_be_nil
623
+ it "has the correct value for method_argument_name" do
624
+ _(builder.method_argument_name).must_be_nil
631
625
  end
632
626
 
633
- it 'has the correct value for #pre_conversion' do
634
- builder.pre_conversion.must_equal ['_v1 = FFI::MemoryPointer.new :int32']
627
+ it "has the correct value for #pre_conversion" do
628
+ _(builder.pre_conversion).must_equal ["_v1 = FFI::MemoryPointer.new :int32"]
635
629
  end
636
630
 
637
- it 'has the correct value for #post_conversion' do
638
- builder.post_conversion.must_equal []
631
+ it "has the correct value for #post_conversion" do
632
+ _(builder.post_conversion).must_equal []
639
633
  end
640
634
  end
641
635
 
642
- describe 'for an argument with direction :error' do
636
+ describe "for an argument with direction :error" do
643
637
  let(:arg_info) { GirFFI::ErrorArgumentInfo.new }
644
638
 
645
- it 'has the correct value for #pre_conversion' do
646
- builder.pre_conversion.must_equal [
647
- '_v1 = FFI::MemoryPointer.new(:pointer).write_pointer nil'
639
+ it "has the correct value for #pre_conversion" do
640
+ _(builder.pre_conversion).must_equal [
641
+ "_v1 = FFI::MemoryPointer.new(:pointer).write_pointer nil"
648
642
  ]
649
643
  end
650
644
 
651
- it 'has the correct value for #post_conversion' do
652
- builder.post_conversion.must_equal [
653
- 'GirFFI::ArgHelper.check_error(_v1)'
645
+ it "has the correct value for #post_conversion" do
646
+ _(builder.post_conversion).must_equal [
647
+ "GirFFI::ArgHelper.check_error(_v1)"
654
648
  ]
655
649
  end
656
650
  end