gir_ffi 0.9.2 → 0.9.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (278) hide show
  1. checksums.yaml +4 -4
  2. data/Changelog.md +7 -0
  3. data/Gemfile +2 -1
  4. data/README.md +6 -0
  5. data/TODO.md +1 -0
  6. data/examples/clutter.rb +106 -0
  7. data/examples/main_loop.rb +0 -8
  8. data/lib/ffi-glib/array.rb +1 -0
  9. data/lib/ffi-glib/array_methods.rb +1 -0
  10. data/lib/ffi-glib/byte_array.rb +1 -0
  11. data/lib/ffi-glib/bytes.rb +1 -0
  12. data/lib/ffi-glib/container_class_methods.rb +1 -0
  13. data/lib/ffi-glib/destroy_notify.rb +1 -0
  14. data/lib/ffi-glib/error.rb +1 -0
  15. data/lib/ffi-glib/hash_table.rb +2 -1
  16. data/lib/ffi-glib/iconv.rb +1 -0
  17. data/lib/ffi-glib/list.rb +1 -0
  18. data/lib/ffi-glib/list_methods.rb +1 -0
  19. data/lib/ffi-glib/main_loop.rb +1 -0
  20. data/lib/ffi-glib/ptr_array.rb +1 -0
  21. data/lib/ffi-glib/s_list.rb +1 -0
  22. data/lib/ffi-glib/strv.rb +1 -0
  23. data/lib/ffi-glib/variant.rb +1 -0
  24. data/lib/ffi-glib.rb +1 -0
  25. data/lib/ffi-gobject/base.rb +1 -0
  26. data/lib/ffi-gobject/closure.rb +1 -0
  27. data/lib/ffi-gobject/initially_unowned.rb +1 -0
  28. data/lib/ffi-gobject/object.rb +1 -0
  29. data/lib/ffi-gobject/object_class.rb +1 -0
  30. data/lib/ffi-gobject/ruby_closure.rb +1 -0
  31. data/lib/ffi-gobject/value.rb +1 -0
  32. data/lib/ffi-gobject.rb +1 -0
  33. data/lib/ffi-gobject_introspection/g_error.rb +1 -0
  34. data/lib/ffi-gobject_introspection/i_arg_info.rb +1 -0
  35. data/lib/ffi-gobject_introspection/i_base_info.rb +1 -0
  36. data/lib/ffi-gobject_introspection/i_callable_info.rb +5 -0
  37. data/lib/ffi-gobject_introspection/i_callback_info.rb +1 -0
  38. data/lib/ffi-gobject_introspection/i_constant_info.rb +1 -0
  39. data/lib/ffi-gobject_introspection/i_enum_info.rb +1 -0
  40. data/lib/ffi-gobject_introspection/i_field_info.rb +3 -2
  41. data/lib/ffi-gobject_introspection/i_flags_info.rb +1 -0
  42. data/lib/ffi-gobject_introspection/i_function_info.rb +7 -7
  43. data/lib/ffi-gobject_introspection/i_interface_info.rb +1 -0
  44. data/lib/ffi-gobject_introspection/i_object_info.rb +1 -0
  45. data/lib/ffi-gobject_introspection/i_property_info.rb +5 -4
  46. data/lib/ffi-gobject_introspection/i_registered_type_info.rb +1 -0
  47. data/lib/ffi-gobject_introspection/i_repository.rb +1 -0
  48. data/lib/ffi-gobject_introspection/i_signal_info.rb +1 -0
  49. data/lib/ffi-gobject_introspection/i_struct_info.rb +1 -0
  50. data/lib/ffi-gobject_introspection/i_type_info.rb +1 -0
  51. data/lib/ffi-gobject_introspection/i_union_info.rb +1 -0
  52. data/lib/ffi-gobject_introspection/i_unresolved_info.rb +1 -0
  53. data/lib/ffi-gobject_introspection/i_value_info.rb +1 -0
  54. data/lib/ffi-gobject_introspection/i_vfunc_info.rb +1 -0
  55. data/lib/ffi-gobject_introspection/lib.rb +27 -10
  56. data/lib/ffi-gobject_introspection.rb +1 -0
  57. data/lib/gir_ffi/allocation_helper.rb +1 -0
  58. data/lib/gir_ffi/arg_helper.rb +1 -0
  59. data/lib/gir_ffi/boxed_base.rb +1 -0
  60. data/lib/gir_ffi/builder.rb +1 -0
  61. data/lib/gir_ffi/builder_helper.rb +1 -0
  62. data/lib/gir_ffi/builders/argument_builder.rb +18 -6
  63. data/lib/gir_ffi/builders/argument_builder_collection.rb +24 -12
  64. data/lib/gir_ffi/builders/base_argument_builder.rb +1 -0
  65. data/lib/gir_ffi/builders/base_method_builder.rb +33 -9
  66. data/lib/gir_ffi/builders/base_type_builder.rb +1 -0
  67. data/lib/gir_ffi/builders/boxed_builder.rb +1 -0
  68. data/lib/gir_ffi/builders/c_to_ruby_convertor.rb +1 -0
  69. data/lib/gir_ffi/builders/callback_argument_builder.rb +5 -0
  70. data/lib/gir_ffi/builders/callback_builder.rb +2 -5
  71. data/lib/gir_ffi/builders/callback_return_value_builder.rb +1 -0
  72. data/lib/gir_ffi/builders/closure_argument_builder.rb +1 -0
  73. data/lib/gir_ffi/builders/closure_convertor.rb +1 -0
  74. data/lib/gir_ffi/builders/closure_return_value_builder.rb +1 -0
  75. data/lib/gir_ffi/builders/closure_to_pointer_convertor.rb +1 -0
  76. data/lib/gir_ffi/builders/constant_builder.rb +1 -0
  77. data/lib/gir_ffi/builders/constructor_builder.rb +2 -0
  78. data/lib/gir_ffi/builders/enum_builder.rb +2 -1
  79. data/lib/gir_ffi/builders/field_builder.rb +2 -0
  80. data/lib/gir_ffi/builders/flags_builder.rb +2 -1
  81. data/lib/gir_ffi/builders/full_c_to_ruby_convertor.rb +1 -0
  82. data/lib/gir_ffi/builders/function_builder.rb +2 -3
  83. data/lib/gir_ffi/builders/initializer_builder.rb +2 -3
  84. data/lib/gir_ffi/builders/initializer_return_value_builder.rb +1 -0
  85. data/lib/gir_ffi/builders/interface_builder.rb +1 -0
  86. data/lib/gir_ffi/builders/mapping_method_builder.rb +15 -37
  87. data/lib/gir_ffi/builders/marshalling_method_builder.rb +9 -26
  88. data/lib/gir_ffi/builders/method_template.rb +4 -3
  89. data/lib/gir_ffi/builders/module_builder.rb +2 -1
  90. data/lib/gir_ffi/builders/null_argument_builder.rb +1 -0
  91. data/lib/gir_ffi/builders/null_class_builder.rb +1 -0
  92. data/lib/gir_ffi/builders/null_convertor.rb +1 -0
  93. data/lib/gir_ffi/builders/null_return_value_builder.rb +1 -0
  94. data/lib/gir_ffi/builders/object_builder.rb +1 -0
  95. data/lib/gir_ffi/builders/property_builder.rb +1 -0
  96. data/lib/gir_ffi/builders/registered_type_builder.rb +1 -0
  97. data/lib/gir_ffi/builders/return_value_builder.rb +1 -0
  98. data/lib/gir_ffi/builders/ruby_to_c_convertor.rb +1 -0
  99. data/lib/gir_ffi/builders/signal_closure_builder.rb +2 -7
  100. data/lib/gir_ffi/builders/struct_builder.rb +1 -0
  101. data/lib/gir_ffi/builders/type_builder.rb +1 -0
  102. data/lib/gir_ffi/builders/unintrospectable_boxed_builder.rb +1 -0
  103. data/lib/gir_ffi/builders/unintrospectable_builder.rb +1 -0
  104. data/lib/gir_ffi/builders/union_builder.rb +1 -0
  105. data/lib/gir_ffi/builders/user_defined_builder.rb +1 -0
  106. data/lib/gir_ffi/builders/vfunc_argument_builder.rb +1 -0
  107. data/lib/gir_ffi/builders/vfunc_builder.rb +2 -9
  108. data/lib/gir_ffi/builders/with_layout.rb +1 -0
  109. data/lib/gir_ffi/callback_base.rb +1 -0
  110. data/lib/gir_ffi/class_base.rb +1 -0
  111. data/lib/gir_ffi/core.rb +1 -0
  112. data/lib/gir_ffi/enum_base.rb +1 -0
  113. data/lib/gir_ffi/error_argument_info.rb +1 -0
  114. data/lib/gir_ffi/error_type_info.rb +1 -0
  115. data/lib/gir_ffi/ffi_ext/pointer.rb +1 -0
  116. data/lib/gir_ffi/ffi_ext.rb +1 -0
  117. data/lib/gir_ffi/field_argument_info.rb +1 -0
  118. data/lib/gir_ffi/flags_base.rb +1 -0
  119. data/lib/gir_ffi/g_type.rb +1 -0
  120. data/lib/gir_ffi/glib_error.rb +1 -0
  121. data/lib/gir_ffi/in_out_pointer.rb +1 -0
  122. data/lib/gir_ffi/in_pointer.rb +1 -0
  123. data/lib/gir_ffi/info_ext/full_type_name.rb +1 -0
  124. data/lib/gir_ffi/info_ext/i_arg_info.rb +1 -0
  125. data/lib/gir_ffi/info_ext/i_callable_info.rb +1 -0
  126. data/lib/gir_ffi/info_ext/i_callback_info.rb +1 -0
  127. data/lib/gir_ffi/info_ext/i_field_info.rb +1 -0
  128. data/lib/gir_ffi/info_ext/i_function_info.rb +1 -0
  129. data/lib/gir_ffi/info_ext/i_property_info.rb +1 -0
  130. data/lib/gir_ffi/info_ext/i_registered_type_info.rb +1 -0
  131. data/lib/gir_ffi/info_ext/i_signal_info.rb +1 -0
  132. data/lib/gir_ffi/info_ext/i_type_info.rb +1 -1
  133. data/lib/gir_ffi/info_ext/i_unresolved_info.rb +1 -0
  134. data/lib/gir_ffi/info_ext/i_vfunc_info.rb +1 -0
  135. data/lib/gir_ffi/info_ext/safe_constant_name.rb +1 -0
  136. data/lib/gir_ffi/info_ext/safe_function_name.rb +1 -0
  137. data/lib/gir_ffi/info_ext.rb +1 -0
  138. data/lib/gir_ffi/interface_base.rb +1 -0
  139. data/lib/gir_ffi/lib_c.rb +1 -0
  140. data/lib/gir_ffi/method_stubber.rb +1 -0
  141. data/lib/gir_ffi/module_base.rb +1 -0
  142. data/lib/gir_ffi/object_base.rb +1 -0
  143. data/lib/gir_ffi/object_store.rb +1 -0
  144. data/lib/gir_ffi/property_not_found_error.rb +1 -0
  145. data/lib/gir_ffi/receiver_argument_info.rb +1 -0
  146. data/lib/gir_ffi/receiver_type_info.rb +1 -0
  147. data/lib/gir_ffi/registered_type_base.rb +1 -0
  148. data/lib/gir_ffi/return_value_info.rb +1 -0
  149. data/lib/gir_ffi/signal_not_found_error.rb +1 -0
  150. data/lib/gir_ffi/sized_array.rb +1 -0
  151. data/lib/gir_ffi/struct_base.rb +1 -0
  152. data/lib/gir_ffi/type_base.rb +1 -0
  153. data/lib/gir_ffi/type_map.rb +1 -0
  154. data/lib/gir_ffi/unintrospectable_signal_info.rb +1 -0
  155. data/lib/gir_ffi/unintrospectable_type_info.rb +1 -0
  156. data/lib/gir_ffi/union_base.rb +1 -0
  157. data/lib/gir_ffi/user_data_argument_info.rb +1 -0
  158. data/lib/gir_ffi/user_data_type_info.rb +1 -0
  159. data/lib/gir_ffi/user_defined_property_info.rb +1 -0
  160. data/lib/gir_ffi/user_defined_type_info.rb +1 -0
  161. data/lib/gir_ffi/variable_name_generator.rb +1 -0
  162. data/lib/gir_ffi/version.rb +1 -1
  163. data/lib/gir_ffi/vfunc_implementation.rb +1 -0
  164. data/lib/gir_ffi/zero_terminated.rb +1 -0
  165. data/lib/gir_ffi-base/glib/boolean.rb +1 -0
  166. data/lib/gir_ffi-base/glib/strv.rb +1 -0
  167. data/lib/gir_ffi-base/gobject/lib.rb +1 -0
  168. data/lib/gir_ffi-base/gobject.rb +1 -0
  169. data/lib/gir_ffi-base.rb +1 -0
  170. data/lib/gir_ffi.rb +1 -0
  171. data/test/base_test_helper.rb +1 -0
  172. data/test/ffi-glib/array_test.rb +1 -0
  173. data/test/ffi-glib/byte_array_test.rb +1 -0
  174. data/test/ffi-glib/bytes_test.rb +1 -0
  175. data/test/ffi-glib/destroy_notify_test.rb +1 -0
  176. data/test/ffi-glib/hash_table_test.rb +1 -0
  177. data/test/ffi-glib/iconv_test.rb +1 -0
  178. data/test/ffi-glib/list_test.rb +1 -0
  179. data/test/ffi-glib/main_loop_test.rb +1 -0
  180. data/test/ffi-glib/ptr_array_test.rb +1 -0
  181. data/test/ffi-glib/ruby_closure_test.rb +1 -0
  182. data/test/ffi-glib/s_list_test.rb +1 -0
  183. data/test/ffi-glib/strv_test.rb +1 -0
  184. data/test/ffi-glib/variant_test.rb +1 -0
  185. data/test/ffi-gobject/gobject_test.rb +1 -0
  186. data/test/ffi-gobject/object_class_test.rb +1 -0
  187. data/test/ffi-gobject/object_test.rb +1 -0
  188. data/test/ffi-gobject/value_test.rb +1 -0
  189. data/test/ffi-gobject_introspection/i_base_info_test.rb +1 -0
  190. data/test/ffi-gobject_introspection/i_constant_info_test.rb +1 -0
  191. data/test/ffi-gobject_introspection/i_enum_info_test.rb +1 -0
  192. data/test/ffi-gobject_introspection/i_function_info_test.rb +1 -0
  193. data/test/ffi-gobject_introspection/i_interface_info_test.rb +1 -0
  194. data/test/ffi-gobject_introspection/i_object_info_test.rb +1 -0
  195. data/test/ffi-gobject_introspection/i_property_info_test.rb +1 -0
  196. data/test/ffi-gobject_introspection/i_registered_type_info_test.rb +1 -0
  197. data/test/ffi-gobject_introspection/i_repository_test.rb +1 -0
  198. data/test/ffi-gobject_introspection/i_struct_info_test.rb +1 -0
  199. data/test/ffi-gobject_introspection/i_type_info_test.rb +1 -0
  200. data/test/ffi-gobject_introspection/i_union_info_test.rb +1 -0
  201. data/test/ffi-gobject_introspection/lib_test.rb +1 -0
  202. data/test/ffi-gobject_test.rb +1 -0
  203. data/test/gir_ffi/arg_helper_test.rb +1 -0
  204. data/test/gir_ffi/builder_test.rb +1 -0
  205. data/test/gir_ffi/builders/argument_builder_test.rb +17 -0
  206. data/test/gir_ffi/builders/base_argument_builder_test.rb +1 -0
  207. data/test/gir_ffi/builders/callback_argument_builder_test.rb +1 -0
  208. data/test/gir_ffi/builders/callback_builder_test.rb +1 -0
  209. data/test/gir_ffi/builders/callback_return_value_builder_test.rb +1 -0
  210. data/test/gir_ffi/builders/constant_builder_test.rb +1 -0
  211. data/test/gir_ffi/builders/constructor_builder_test.rb +1 -0
  212. data/test/gir_ffi/builders/enum_builder_test.rb +1 -0
  213. data/test/gir_ffi/builders/field_builder_test.rb +1 -0
  214. data/test/gir_ffi/builders/function_builder_test.rb +30 -1
  215. data/test/gir_ffi/builders/initializer_builder_test.rb +1 -0
  216. data/test/gir_ffi/builders/interface_builder_test.rb +1 -0
  217. data/test/gir_ffi/builders/module_builder_test.rb +1 -0
  218. data/test/gir_ffi/builders/object_builder_test.rb +1 -0
  219. data/test/gir_ffi/builders/property_builder_test.rb +1 -0
  220. data/test/gir_ffi/builders/registered_type_builder_test.rb +1 -0
  221. data/test/gir_ffi/builders/return_value_builder_test.rb +1 -0
  222. data/test/gir_ffi/builders/signal_closure_builder_test.rb +1 -0
  223. data/test/gir_ffi/builders/struct_builder_test.rb +1 -0
  224. data/test/gir_ffi/builders/unintrospectable_boxed_builder_test.rb +1 -0
  225. data/test/gir_ffi/builders/unintrospectable_builder_test.rb +1 -0
  226. data/test/gir_ffi/builders/union_builder_test.rb +1 -0
  227. data/test/gir_ffi/builders/user_defined_builder_test.rb +1 -0
  228. data/test/gir_ffi/builders/vfunc_builder_test.rb +1 -0
  229. data/test/gir_ffi/callback_base_test.rb +1 -0
  230. data/test/gir_ffi/class_base_test.rb +1 -0
  231. data/test/gir_ffi/error_type_info_test.rb +1 -0
  232. data/test/gir_ffi/ffi_ext/pointer_test.rb +1 -0
  233. data/test/gir_ffi/g_type_test.rb +1 -0
  234. data/test/gir_ffi/in_out_pointer_test.rb +1 -0
  235. data/test/gir_ffi/in_pointer_test.rb +1 -0
  236. data/test/gir_ffi/info_ext/i_callable_info_test.rb +1 -0
  237. data/test/gir_ffi/info_ext/i_callback_info_test.rb +1 -0
  238. data/test/gir_ffi/info_ext/i_field_info_test.rb +1 -0
  239. data/test/gir_ffi/info_ext/i_function_info_test.rb +1 -0
  240. data/test/gir_ffi/info_ext/i_signal_info_test.rb +1 -0
  241. data/test/gir_ffi/info_ext/i_type_info_test.rb +1 -0
  242. data/test/gir_ffi/info_ext/i_unresolved_info_test.rb +1 -0
  243. data/test/gir_ffi/info_ext/safe_constant_name_test.rb +1 -0
  244. data/test/gir_ffi/info_ext/safe_function_name_test.rb +1 -0
  245. data/test/gir_ffi/interface_base_test.rb +1 -0
  246. data/test/gir_ffi/method_stubber_test.rb +1 -0
  247. data/test/gir_ffi/object_base_test.rb +1 -0
  248. data/test/gir_ffi/sized_array_test.rb +1 -0
  249. data/test/gir_ffi/type_map_test.rb +1 -0
  250. data/test/gir_ffi/unintrospectable_type_info_test.rb +1 -0
  251. data/test/gir_ffi/user_defined_property_info_test.rb +1 -0
  252. data/test/gir_ffi/user_defined_type_info_test.rb +1 -0
  253. data/test/gir_ffi/variable_name_generator_test.rb +1 -0
  254. data/test/gir_ffi/version_test.rb +1 -0
  255. data/test/gir_ffi/zero_terminated_test.rb +1 -0
  256. data/test/gir_ffi-base/glib/boolean_test.rb +2 -1
  257. data/test/gir_ffi-base/glib/strv_test.rb +1 -0
  258. data/test/gir_ffi_test.rb +1 -0
  259. data/test/gir_ffi_test_helper.rb +1 -0
  260. data/test/integration/callback_exceptions_test.rb +1 -0
  261. data/test/integration/derived_classes_test.rb +1 -0
  262. data/test/integration/generated_everything_test.rb +1 -0
  263. data/test/integration/generated_gimarshallingtests_test.rb +1 -0
  264. data/test/integration/generated_gio_test.rb +1 -0
  265. data/test/integration/generated_glib_test.rb +1 -0
  266. data/test/integration/generated_gobject_test.rb +1 -0
  267. data/test/integration/generated_gst_test.rb +1 -0
  268. data/test/integration/generated_gtop_test.rb +1 -0
  269. data/test/integration/generated_pango_ft2_test.rb +1 -0
  270. data/test/integration/generated_pango_test.rb +1 -0
  271. data/test/integration/generated_regress_test.rb +2 -2
  272. data/test/integration/generated_secret_test.rb +1 -0
  273. data/test/integration/generated_warnlib_test.rb +1 -0
  274. data/test/integration/method_lookup_test.rb +1 -0
  275. data/test/introspection_test_helper.rb +1 -0
  276. data/test/minitest/stats_plugin.rb +1 -0
  277. metadata +19 -19
  278. data/lib/gir_ffi/builders/error_argument_builder.rb +0 -34
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'introspection_test_helper'
2
3
 
3
4
  describe GObjectIntrospection::IInterfaceInfo do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'introspection_test_helper'
2
3
 
3
4
  describe GObjectIntrospection::IObjectInfo do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'introspection_test_helper'
2
3
 
3
4
  describe GObjectIntrospection::IPropertyInfo do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'introspection_test_helper'
2
3
 
3
4
  describe GObjectIntrospection::IRegisteredTypeInfo do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'introspection_test_helper'
2
3
 
3
4
  describe GObjectIntrospection::IRepository do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'introspection_test_helper'
2
3
 
3
4
  describe GObjectIntrospection::IStructInfo do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'introspection_test_helper'
2
3
 
3
4
  describe GObjectIntrospection::ITypeInfo do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'introspection_test_helper'
2
3
 
3
4
  describe GObjectIntrospection::IUnionInfo do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'introspection_test_helper'
2
3
 
3
4
  describe GObjectIntrospection::Lib::GIArgument do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gir_ffi_test_helper'
2
3
 
3
4
  describe GObject do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gir_ffi_test_helper'
2
3
 
3
4
  describe GirFFI::ArgHelper do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gir_ffi_test_helper'
2
3
 
3
4
  GirFFI.setup :Regress
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gir_ffi_test_helper'
2
3
 
3
4
  describe GirFFI::Builders::ArgumentBuilder do
@@ -528,4 +529,20 @@ describe GirFFI::Builders::ArgumentBuilder do
528
529
  builder.post_conversion.must_equal []
529
530
  end
530
531
  end
532
+
533
+ describe 'for an argument with direction :error' do
534
+ let(:arg_info) { GirFFI::ErrorArgumentInfo.new }
535
+
536
+ it 'has the correct value for #pre_conversion' do
537
+ builder.pre_conversion.must_equal [
538
+ '_v1 = FFI::MemoryPointer.new(:pointer).write_pointer nil'
539
+ ]
540
+ end
541
+
542
+ it 'has the correct value for #post_conversion' do
543
+ builder.post_conversion.must_equal [
544
+ 'GirFFI::ArgHelper.check_error(_v1)'
545
+ ]
546
+ end
547
+ end
531
548
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gir_ffi_test_helper'
2
3
 
3
4
  describe GirFFI::Builders::BaseArgumentBuilder do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gir_ffi_test_helper'
2
3
 
3
4
  describe GirFFI::Builders::CallbackArgumentBuilder do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gir_ffi_test_helper'
2
3
 
3
4
  describe GirFFI::Builders::CallbackBuilder do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gir_ffi_test_helper'
2
3
 
3
4
  describe GirFFI::Builders::CallbackReturnValueBuilder do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gir_ffi_test_helper'
2
3
 
3
4
  describe GirFFI::Builders::ConstantBuilder do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gir_ffi_test_helper'
2
3
 
3
4
  describe GirFFI::Builders::ConstructorBuilder do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gir_ffi_test_helper'
2
3
 
3
4
  describe GirFFI::Builders::EnumBuilder do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gir_ffi_test_helper'
2
3
 
3
4
  describe GirFFI::Builders::FieldBuilder do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gir_ffi_test_helper'
2
3
 
3
4
  describe GirFFI::Builders::FunctionBuilder do
@@ -109,7 +110,7 @@ describe GirFFI::Builders::FunctionBuilder do
109
110
  let(:function_info) { get_introspection_data 'Regress', 'test_array_int_null_in' }
110
111
  it 'builds correct definition' do
111
112
  code.must_equal <<-CODE.reset_indentation
112
- def self.test_array_int_null_in(arr)
113
+ def self.test_array_int_null_in(arr = nil)
113
114
  len = arr.nil? ? 0 : arr.length
114
115
  _v1 = len
115
116
  _v2 = GirFFI::SizedArray.from(:gint32, -1, arr)
@@ -252,5 +253,33 @@ describe GirFFI::Builders::FunctionBuilder do
252
253
  CODE
253
254
  end
254
255
  end
256
+
257
+ describe 'for functions with an allow-none ingoing parameter' do
258
+ let(:function_info) { get_introspection_data 'Regress', 'test_utf8_null_in' }
259
+ it 'builds correct definition with default parameter value' do
260
+ code.must_equal <<-CODE.reset_indentation
261
+ def self.test_utf8_null_in(in_ = nil)
262
+ _v1 = GirFFI::InPointer.from(:utf8, in_)
263
+ Regress::Lib.regress_test_utf8_null_in _v1
264
+ end
265
+ CODE
266
+ end
267
+ end
268
+
269
+ describe 'for functions where some allow-none cannot be honored' do
270
+ let(:function_info) { get_method_introspection_data 'GObject', 'Closure', 'invoke' }
271
+ it 'builds correct definition with default parameter value on the later arguments' do
272
+ code.must_equal <<-CODE.reset_indentation
273
+ def invoke(return_value, param_values, invocation_hint = nil)
274
+ _v1 = GObject::Value.from(return_value)
275
+ n_param_values = param_values.nil? ? 0 : param_values.length
276
+ _v2 = n_param_values
277
+ _v3 = GirFFI::InPointer.from(:void, invocation_hint)
278
+ _v4 = GirFFI::SizedArray.from(GObject::Value, -1, param_values)
279
+ GObject::Lib.g_closure_invoke self, _v1, _v2, _v4, _v3
280
+ end
281
+ CODE
282
+ end
283
+ end
255
284
  end
256
285
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gir_ffi_test_helper'
2
3
 
3
4
  describe GirFFI::Builders::InitializerBuilder do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gir_ffi_test_helper'
2
3
 
3
4
  describe GirFFI::Builders::InterfaceBuilder do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gir_ffi_test_helper'
2
3
 
3
4
  describe GirFFI::Builders::ModuleBuilder do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gir_ffi_test_helper'
2
3
 
3
4
  describe GirFFI::Builders::ObjectBuilder do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gir_ffi_test_helper'
2
3
 
3
4
  describe GirFFI::Builders::PropertyBuilder do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gir_ffi_test_helper'
2
3
 
3
4
  GirFFI.setup :Regress
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gir_ffi_test_helper'
2
3
 
3
4
  describe GirFFI::Builders::ReturnValueBuilder do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gir_ffi_test_helper'
2
3
 
3
4
  describe GirFFI::Builders::SignalClosureBuilder do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gir_ffi_test_helper'
2
3
 
3
4
  describe GirFFI::Builders::StructBuilder do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gir_ffi_test_helper'
2
3
 
3
4
  GirFFI.setup :GIMarshallingTests
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gir_ffi_test_helper'
2
3
 
3
4
  GirFFI.setup :Gio
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gir_ffi_test_helper'
2
3
 
3
4
  describe GirFFI::Builders::UnionBuilder do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gir_ffi_test_helper'
2
3
 
3
4
  GirFFI.setup :GIMarshallingTests
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gir_ffi_test_helper'
2
3
 
3
4
  describe GirFFI::Builders::VFuncBuilder do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gir_ffi_test_helper'
2
3
 
3
4
  describe GirFFI::CallbackBase do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gir_ffi_test_helper'
2
3
 
3
4
  describe GirFFI::ClassBase do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gir_ffi_test_helper'
2
3
  require 'gir_ffi/error_type_info'
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gir_ffi_test_helper'
2
3
 
3
4
  describe GirFFI::FFIExt::Pointer do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gir_ffi_test_helper'
2
3
 
3
4
  require 'gir_ffi/g_type'
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gir_ffi_test_helper'
2
3
 
3
4
  describe GirFFI::InOutPointer do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gir_ffi_test_helper'
2
3
 
3
4
  require 'gir_ffi/in_pointer'
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gir_ffi_test_helper'
2
3
 
3
4
  describe GirFFI::InfoExt::ICallableInfo do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gir_ffi_test_helper'
2
3
 
3
4
  describe GirFFI::InfoExt::ICallbackInfo do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gir_ffi_test_helper'
2
3
 
3
4
  describe GirFFI::InfoExt::IFieldInfo do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gir_ffi_test_helper'
2
3
 
3
4
  describe GirFFI::InfoExt::IFunctionInfo do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gir_ffi_test_helper'
2
3
 
3
4
  GirFFI.setup :Regress
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gir_ffi_test_helper'
2
3
 
3
4
  describe GirFFI::InfoExt::ITypeInfo do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gir_ffi_test_helper'
2
3
 
3
4
  describe GirFFI::InfoExt::IUnresolvedInfo do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gir_ffi_test_helper'
2
3
 
3
4
  describe GirFFI::InfoExt::SafeConstantName do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gir_ffi_test_helper'
2
3
 
3
4
  describe GirFFI::InfoExt::SafeFunctionName do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gir_ffi_test_helper'
2
3
 
3
4
  describe GirFFI::InterfaceBase do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gir_ffi_test_helper'
2
3
 
3
4
  describe GirFFI::MethodStubber do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gir_ffi_test_helper'
2
3
 
3
4
  GirFFI.setup :Regress
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gir_ffi_test_helper'
2
3
 
3
4
  describe GirFFI::SizedArray do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gir_ffi_test_helper'
2
3
 
3
4
  describe GirFFI::TypeMap do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gir_ffi_test_helper'
2
3
  require 'gir_ffi/unintrospectable_type_info'
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gir_ffi_test_helper'
2
3
  require 'gir_ffi/user_defined_property_info'
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gir_ffi_test_helper'
2
3
  require 'gir_ffi/user_defined_type_info'
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gir_ffi_test_helper'
2
3
 
3
4
  require 'gir_ffi/variable_name_generator'
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gir_ffi_test_helper'
2
3
 
3
4
  describe GirFFI::VERSION do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gir_ffi_test_helper'
2
3
 
3
4
  describe GirFFI::ZeroTerminated do
@@ -1,4 +1,5 @@
1
- require 'gir_ffi_test_helper'
1
+ # frozen_string_literal: true
2
+ require 'base_test_helper'
2
3
 
3
4
  describe GLib::Boolean do
4
5
  it 'has the same native size as an int' do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'base_test_helper'
2
3
 
3
4
  describe GLib::Strv do
data/test/gir_ffi_test.rb CHANGED
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gir_ffi_test_helper'
2
3
 
3
4
  GirFFI.setup :GIMarshallingTests
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'introspection_test_helper'
2
3
 
3
4
  require 'gir_ffi'
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gir_ffi_test_helper'
2
3
 
3
4
  GirFFI.setup :Regress
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gir_ffi_test_helper'
2
3
 
3
4
  GirFFI.setup :Regress
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gir_ffi_test_helper'
2
3
 
3
4
  GirFFI.setup :Everything
@@ -1,4 +1,5 @@
1
1
  # coding: utf-8
2
+ # frozen_string_literal: true
2
3
  require 'gir_ffi_test_helper'
3
4
 
4
5
  require 'gir_ffi'
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gir_ffi_test_helper'
2
3
 
3
4
  GirFFI.setup :Gio
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gir_ffi_test_helper'
2
3
 
3
4
  # Tests generated classes, methods and functions in the GLib namespace.
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gir_ffi_test_helper'
2
3
 
3
4
  GirFFI.setup :Regress
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gir_ffi_test_helper'
2
3
 
3
4
  GirFFI.setup :Gst
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gir_ffi_test_helper'
2
3
 
3
4
  # Tests generated methods and functions in the GTop namespace. This namespace
@@ -1,4 +1,5 @@
1
1
  # coding: utf-8
2
+ # frozen_string_literal: true
2
3
  require 'gir_ffi_test_helper'
3
4
 
4
5
  GirFFI.setup :PangoFT2
@@ -1,4 +1,5 @@
1
1
  # coding: utf-8
2
+ # frozen_string_literal: true
2
3
  require 'gir_ffi_test_helper'
3
4
 
4
5
  GirFFI.setup :Pango
@@ -1,4 +1,5 @@
1
1
  # coding: utf-8
2
+ # frozen_string_literal: true
2
3
  require 'gir_ffi_test_helper'
3
4
 
4
5
  GirFFI.setup :Regress
@@ -2483,7 +2484,7 @@ describe Regress do
2483
2484
 
2484
2485
  result.size.must_equal 2
2485
2486
 
2486
- result.each do|o|
2487
+ result.each do |o|
2487
2488
  assert_instance_of Regress::TestObj, o
2488
2489
  assert_equal gtype, GObject.type_from_instance(o)
2489
2490
  end
@@ -3308,7 +3309,6 @@ describe Regress do
3308
3309
 
3309
3310
  it 'has a working function #test_versioning' do
3310
3311
  skip unless get_introspection_data 'Regress', 'test_versioning'
3311
- # TODO: Provide versioning info to the end user
3312
3312
  Regress.test_versioning
3313
3313
  pass
3314
3314
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gir_ffi_test_helper'
2
3
 
3
4
  describe 'The generated Secret module' do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gir_ffi_test_helper'
2
3
 
3
4
  describe 'The generated WarnLib module' do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'gir_ffi_test_helper'
2
3
 
3
4
  # Tests how methods are looked up and generated on first use.
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'base_test_helper'
2
3
 
3
4
  require 'ffi-gobject_introspection'
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Minitest
2
3
  class StatsReporter < AbstractReporter
3
4
  def initialize(_options)