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,23 +1,23 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'introspection_test_helper'
3
+ require "introspection_test_helper"
4
4
 
5
5
  describe GObjectIntrospection::IStructInfo do
6
- let(:object_info) { get_introspection_data('GObject', 'Closure') }
6
+ let(:object_info) { get_introspection_data("GObject", "Closure") }
7
7
 
8
- describe '#find_method' do
9
- it 'finds a method by name string' do
10
- object_info.find_method('new_simple').wont_be_nil
8
+ describe "#find_method" do
9
+ it "finds a method by name string" do
10
+ _(object_info.find_method("new_simple")).wont_be_nil
11
11
  end
12
12
 
13
- it 'finds a method by name symbol' do
14
- object_info.find_method(:new_simple).wont_be_nil
13
+ it "finds a method by name symbol" do
14
+ _(object_info.find_method(:new_simple)).wont_be_nil
15
15
  end
16
16
  end
17
17
 
18
- describe '#type_name' do
19
- it 'returns the correct name' do
20
- object_info.type_name.must_equal 'GClosure'
18
+ describe "#type_name" do
19
+ it "returns the correct name" do
20
+ _(object_info.type_name).must_equal "GClosure"
21
21
  end
22
22
  end
23
23
  end
@@ -1,32 +1,29 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'introspection_test_helper'
3
+ require "introspection_test_helper"
4
4
 
5
5
  describe GObjectIntrospection::ITypeInfo do
6
- describe '#name?' do
7
- let(:object_info) { get_introspection_data('GIMarshallingTests', 'Object') }
8
- let(:vfunc_info) { object_info.find_vfunc('vfunc_array_out_parameter') }
6
+ describe "#name?" do
7
+ let(:object_info) { get_introspection_data("GIMarshallingTests", "Object") }
8
+ let(:vfunc_info) { object_info.find_vfunc("vfunc_array_out_parameter") }
9
9
  let(:arg_info) { vfunc_info.args[0] }
10
10
  let(:type_info) { arg_info.argument_type }
11
11
 
12
- it 'raises an error' do
13
- skip unless vfunc_info
14
- proc do
15
- type_info.name
16
- end.must_raise RuntimeError
12
+ it "raises an error" do
13
+ _(proc { type_info.name }).must_raise RuntimeError
17
14
  end
18
15
  end
19
16
 
20
- describe '#interface' do
21
- describe 'for unresolvable interface types' do
22
- let(:function_info) { get_introspection_data 'GObject', 'signal_set_va_marshaller' }
17
+ describe "#interface" do
18
+ describe "for unresolvable interface types" do
19
+ let(:function_info) { get_introspection_data "GObject", "signal_set_va_marshaller" }
23
20
  let(:argument_info) { function_info.args.last }
24
21
  let(:type_info) { argument_info.argument_type }
25
22
 
26
- it 'returns an IUnresolvableInfo object' do
23
+ it "returns an IUnresolvableInfo object" do
27
24
  result = type_info.interface
28
- result.info_type.must_equal :unresolved
29
- result.must_be_kind_of GObjectIntrospection::IUnresolvedInfo
25
+ _(result.info_type).must_equal :unresolved
26
+ _(result).must_be_kind_of GObjectIntrospection::IUnresolvedInfo
30
27
  end
31
28
  end
32
29
  end
@@ -1,17 +1,17 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'introspection_test_helper'
3
+ require "introspection_test_helper"
4
4
 
5
5
  describe GObjectIntrospection::IUnionInfo do
6
- let(:object_info) { get_introspection_data('GLib', 'Mutex') }
6
+ let(:object_info) { get_introspection_data("GLib", "Mutex") }
7
7
 
8
- describe '#find_method' do
9
- it 'finds a method by name string' do
10
- object_info.find_method('clear').wont_be_nil
8
+ describe "#find_method" do
9
+ it "finds a method by name string" do
10
+ _(object_info.find_method("clear")).wont_be_nil
11
11
  end
12
12
 
13
- it 'finds a method by name symbol' do
14
- object_info.find_method(:clear).wont_be_nil
13
+ it "finds a method by name symbol" do
14
+ _(object_info.find_method(:clear)).wont_be_nil
15
15
  end
16
16
  end
17
17
  end
@@ -1,41 +1,41 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'introspection_test_helper'
3
+ require "introspection_test_helper"
4
4
 
5
5
  describe GObjectIntrospection::IVFuncInfo do
6
6
  let(:vfunc_info) do
7
- get_vfunc_introspection_data 'GIMarshallingTests', 'Object', 'method_int8_in'
7
+ get_vfunc_introspection_data "GIMarshallingTests", "Object", "method_int8_in"
8
8
  end
9
9
 
10
10
  let(:throwing_vfunc_info) do
11
- get_vfunc_introspection_data 'GIMarshallingTests', 'Object', 'vfunc_meth_with_err'
11
+ get_vfunc_introspection_data "GIMarshallingTests", "Object", "vfunc_meth_with_err"
12
12
  end
13
13
 
14
14
  let(:vfunc_info_with_different_invoker) do
15
- get_vfunc_introspection_data 'Regress', 'TestObj', 'matrix'
15
+ get_vfunc_introspection_data "Regress", "TestObj", "matrix"
16
16
  end
17
17
 
18
- describe '#throws?' do
19
- it 'returns false if there is no error argument' do
20
- vfunc_info.wont_be :throws?
18
+ describe "#throws?" do
19
+ it "returns false if there is no error argument" do
20
+ _(vfunc_info).wont_be :throws?
21
21
  end
22
22
 
23
- it 'returns true if there is and error argument' do
24
- throwing_vfunc_info.must_be :throws?
23
+ it "returns true if there is and error argument" do
24
+ _(throwing_vfunc_info).must_be :throws?
25
25
  end
26
26
  end
27
27
 
28
- describe '#invoker' do
29
- it 'returns nil if no invoker method is present' do
30
- throwing_vfunc_info.invoker.must_be_nil
28
+ describe "#invoker" do
29
+ it "returns nil if no invoker method is present" do
30
+ _(throwing_vfunc_info.invoker).must_be_nil
31
31
  end
32
32
 
33
- it 'returns info for the invoker method if present' do
34
- vfunc_info.invoker.name.must_equal 'method_int8_in'
33
+ it "returns info for the invoker method if present" do
34
+ _(vfunc_info.invoker.name).must_equal "method_int8_in"
35
35
  end
36
36
 
37
- it 'returns the correct invoker even if named differently' do
38
- vfunc_info_with_different_invoker.invoker.name.must_equal 'do_matrix'
37
+ it "returns the correct invoker even if named differently" do
38
+ _(vfunc_info_with_different_invoker.invoker.name).must_equal "do_matrix"
39
39
  end
40
40
  end
41
41
  end
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'introspection_test_helper'
3
+ require "introspection_test_helper"
4
4
 
5
5
  describe GObjectIntrospection::Lib::GIArgument do
6
- describe 'its member :v_ssize' do
7
- it 'is signed' do
6
+ describe "its member :v_ssize" do
7
+ it "is signed" do
8
8
  gia = GObjectIntrospection::Lib::GIArgument.new
9
9
  gia[:v_int64] = -1
10
10
  assert_equal(-1, gia[:v_ssize])
@@ -1,23 +1,23 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'base_test_helper'
3
+ require "base_test_helper"
4
4
 
5
5
  describe GObjectIntrospection::Strv do
6
- it 'wraps a pointer' do
6
+ it "wraps a pointer" do
7
7
  strv = GObjectIntrospection::Strv.new :some_pointer
8
8
  assert_equal :some_pointer, strv.to_ptr
9
9
  end
10
10
 
11
- describe '::wrap' do
12
- it 'takes a pointer and returns a GObjectIntrospection::Strv wrapping it' do
11
+ describe "::wrap" do
12
+ it "takes a pointer and returns a GObjectIntrospection::Strv wrapping it" do
13
13
  strv = GObjectIntrospection::Strv.wrap :some_pointer
14
14
  assert_instance_of GObjectIntrospection::Strv, strv
15
15
  assert_equal :some_pointer, strv.to_ptr
16
16
  end
17
17
  end
18
18
 
19
- describe '#each' do
20
- it 'yields each string element' do
19
+ describe "#each" do
20
+ it "yields each string element" do
21
21
  ary = %w(one two three)
22
22
  ptrs = ary.map { |a| FFI::MemoryPointer.from_string(a) }
23
23
  ptrs << nil
@@ -32,7 +32,7 @@ describe GObjectIntrospection::Strv do
32
32
  assert_equal %w(one two three), arr
33
33
  end
34
34
 
35
- it 'yields zero times for a Strv wrapping a null pointer' do
35
+ it "yields zero times for a Strv wrapping a null pointer" do
36
36
  strv = GObjectIntrospection::Strv.new FFI::Pointer.new(0)
37
37
  strv.each do |_str|
38
38
  flunk
@@ -40,7 +40,7 @@ describe GObjectIntrospection::Strv do
40
40
  end
41
41
  end
42
42
 
43
- it 'includes Enumerable' do
44
- GObjectIntrospection::Strv.must_include Enumerable
43
+ it "includes Enumerable" do
44
+ _(GObjectIntrospection::Strv).must_include Enumerable
45
45
  end
46
46
  end
@@ -1,34 +1,34 @@
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 GObject do
6
6
  before do
7
7
  GirFFI.setup :Regress
8
8
  end
9
9
 
10
- describe '::signal_emit' do
11
- it 'emits a signal' do
10
+ describe "::signal_emit" do
11
+ it "emits a signal" do
12
12
  a = 1
13
13
  o = Regress::TestSubObj.new
14
14
  prc = proc { a = 2 }
15
15
  callback = GObject::Callback.from prc
16
- ::GObject::Lib.g_signal_connect_data o, 'test', callback, nil, nil, 0
17
- GObject.signal_emit o, 'test'
16
+ ::GObject::Lib.g_signal_connect_data o, "test", callback, nil, nil, 0
17
+ GObject.signal_emit o, "test"
18
18
  assert_equal 2, a
19
19
  end
20
20
 
21
- it 'handles return values' do
21
+ it "handles return values" do
22
22
  s = Gio::SocketService.new
23
23
 
24
24
  argtypes = [:pointer, :pointer, :pointer, :pointer]
25
25
  callback = FFI::Function.new(:bool, argtypes) { |_a, _b, _c, _d| true }
26
- ::GObject::Lib.g_signal_connect_data s, 'incoming', callback, nil, nil, 0
27
- rv = GObject.signal_emit s, 'incoming'
26
+ ::GObject::Lib.g_signal_connect_data s, "incoming", callback, nil, nil, 0
27
+ rv = GObject.signal_emit s, "incoming"
28
28
  assert_equal true, rv
29
29
  end
30
30
 
31
- it 'passes in extra arguments' do
31
+ it "passes in extra arguments" do
32
32
  o = Regress::TestSubObj.new
33
33
  sb = Regress::TestSimpleBoxedA.new
34
34
  sb.some_int8 = 31
@@ -40,79 +40,79 @@ describe GObject do
40
40
  callback = FFI::Function.new(:void, argtypes) do |_a, b, _c|
41
41
  b2 = b
42
42
  end
43
- ::GObject::Lib.g_signal_connect_data o, 'test-with-static-scope-arg', callback, nil, nil, 0
44
- GObject.signal_emit o, 'test-with-static-scope-arg', sb
43
+ ::GObject::Lib.g_signal_connect_data o, "test-with-static-scope-arg", callback, nil, nil, 0
44
+ GObject.signal_emit o, "test-with-static-scope-arg", sb
45
45
 
46
46
  sb2 = Regress::TestSimpleBoxedA.wrap b2
47
47
  assert sb.equals(sb2)
48
48
  end
49
49
 
50
- it 'allows specifying signal detail' do
50
+ it "allows specifying signal detail" do
51
51
  a = 1
52
52
  o = Regress::TestSubObj.new
53
53
 
54
54
  callback = FFI::Function.new(:void, [:pointer, :pointer, :pointer]) { a = 2 }
55
- ::GObject::Lib.g_signal_connect_data o, 'notify::detail', callback, nil, nil, 0
55
+ ::GObject::Lib.g_signal_connect_data o, "notify::detail", callback, nil, nil, 0
56
56
 
57
- GObject.signal_emit o, 'notify::detail'
57
+ GObject.signal_emit o, "notify::detail"
58
58
 
59
- a.must_equal 2
59
+ _(a).must_equal 2
60
60
  end
61
61
  end
62
62
 
63
- describe '::signal_connect' do
64
- it 'installs a signal handler' do
63
+ describe "::signal_connect" do
64
+ it "installs a signal handler" do
65
65
  a = 1
66
66
  o = Regress::TestSubObj.new
67
- GObject.signal_connect(o, 'test') { a = 2 }
68
- GObject.signal_emit o, 'test'
67
+ GObject.signal_connect(o, "test") { a = 2 }
68
+ GObject.signal_emit o, "test"
69
69
  assert_equal 2, a
70
70
  end
71
71
 
72
- it 'passes user data to handler' do
72
+ it "passes user data to handler" do
73
73
  a = 1
74
74
  o = Regress::TestSubObj.new
75
- GObject.signal_connect(o, 'test', 2) { |_i, d| a = d }
76
- GObject.signal_emit o, 'test'
75
+ GObject.signal_connect(o, "test", 2) { |_i, d| a = d }
76
+ GObject.signal_emit o, "test"
77
77
  assert_equal 2, a
78
78
  end
79
79
 
80
- it 'passes object to handler' do
80
+ it "passes object to handler" do
81
81
  o = Regress::TestSubObj.new
82
82
  o2 = nil
83
- GObject.signal_connect(o, 'test') { |i, _d| o2 = i }
84
- GObject.signal_emit o, 'test'
83
+ GObject.signal_connect(o, "test") { |i, _d| o2 = i }
84
+ GObject.signal_emit o, "test"
85
85
  assert_instance_of Regress::TestSubObj, o2
86
86
  assert_equal o.to_ptr, o2.to_ptr
87
87
  end
88
88
 
89
- it 'does not allow connecting an invalid signal' do
89
+ it "does not allow connecting an invalid signal" do
90
90
  o = Regress::TestSubObj.new
91
- proc { GObject.signal_connect(o, 'not-really-a-signal') {} }.
91
+ _(proc { GObject.signal_connect(o, "not-really-a-signal") {} }).
92
92
  must_raise GirFFI::SignalNotFoundError
93
93
  end
94
94
 
95
- it 'handles return values' do
95
+ it "handles return values" do
96
96
  s = Gio::SocketService.new
97
- GObject.signal_connect(s, 'incoming') { true }
98
- rv = GObject.signal_emit s, 'incoming'
97
+ GObject.signal_connect(s, "incoming") { true }
98
+ rv = GObject.signal_emit s, "incoming"
99
99
  assert_equal true, rv
100
100
  end
101
101
 
102
- it 'requires a block' do
102
+ it "requires a block" do
103
103
  o = Regress::TestSubObj.new
104
- proc { GObject.signal_connect o, 'test' }.must_raise ArgumentError
104
+ _(proc { GObject.signal_connect o, "test" }).must_raise ArgumentError
105
105
  end
106
106
 
107
- it 'allows specifying signal detail' do
107
+ it "allows specifying signal detail" do
108
108
  a = 1
109
109
  o = Regress::TestSubObj.new
110
- GObject.signal_connect(o, 'notify::detail', 2) { |_i, _, d| a = d }
111
- GObject.signal_emit o, 'notify::detail'
110
+ GObject.signal_connect(o, "notify::detail", 2) { |_i, _, d| a = d }
111
+ GObject.signal_emit o, "notify::detail"
112
112
  assert_equal 2, a
113
113
  end
114
114
 
115
- describe 'connecting a signal with extra arguments' do
115
+ describe "connecting a signal with extra arguments" do
116
116
  before do
117
117
  @a = nil
118
118
  @b = 2
@@ -121,30 +121,30 @@ describe GObject do
121
121
  sb = Regress::TestSimpleBoxedA.new
122
122
  sb.some_int = 23
123
123
 
124
- GObject.signal_connect(o, 'test-with-static-scope-arg', 2) do |_instance, object, user_data|
124
+ GObject.signal_connect(o, "test-with-static-scope-arg", 2) do |_instance, object, user_data|
125
125
  @a = user_data
126
126
  @b = object
127
127
  end
128
- GObject.signal_emit o, 'test-with-static-scope-arg', sb
128
+ GObject.signal_emit o, "test-with-static-scope-arg", sb
129
129
  end
130
130
 
131
- it 'passes on the user data argument' do
131
+ it "passes on the user data argument" do
132
132
  assert_equal 2, @a
133
133
  end
134
134
 
135
- it 'passes on the extra arguments' do
135
+ it "passes on the extra arguments" do
136
136
  assert_instance_of Regress::TestSimpleBoxedA, @b
137
137
  assert_equal 23, @b.some_int
138
138
  end
139
139
  end
140
140
  end
141
141
 
142
- describe '::signal_connect_after' do
143
- it 'installs a signal handler' do
142
+ describe "::signal_connect_after" do
143
+ it "installs a signal handler" do
144
144
  a = 1
145
145
  o = Regress::TestSubObj.new
146
- GObject.signal_connect_after(o, 'test') { a = 2 }
147
- GObject.signal_emit o, 'test'
146
+ GObject.signal_connect_after(o, "test") { a = 2 }
147
+ GObject.signal_emit o, "test"
148
148
  assert_equal 2, a
149
149
  end
150
150
  end
@@ -1,36 +1,36 @@
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::AllocationHelper do
6
- describe '.free_after' do
6
+ describe ".free_after" do
7
7
  before do
8
8
  allow(GirFFI::LibC).to receive(:free)
9
9
  end
10
10
 
11
- it 'frees the passed-in pointer' do
12
- ptr = double('pointer', null?: false)
11
+ it "frees the passed-in pointer" do
12
+ ptr = double("pointer", null?: false)
13
13
  GirFFI::AllocationHelper.free_after(ptr) {}
14
14
  expect(GirFFI::LibC).to have_received(:free).with(ptr)
15
15
  end
16
16
 
17
- it 'does not free a passed-in null pointer' do
18
- ptr = double('pointer', null?: true)
17
+ it "does not free a passed-in null pointer" do
18
+ ptr = double("pointer", null?: true)
19
19
  GirFFI::AllocationHelper.free_after(ptr) {}
20
20
  expect(GirFFI::LibC).not_to have_received(:free)
21
21
  end
22
22
 
23
- it 'yields ptr to the block' do
24
- ptr = double('pointer', null?: false)
23
+ it "yields ptr to the block" do
24
+ ptr = double("pointer", null?: false)
25
25
  foo = nil
26
26
  GirFFI::AllocationHelper.free_after(ptr) { |it| foo = it }
27
- foo.must_equal ptr
27
+ _(foo).must_equal ptr
28
28
  end
29
29
 
30
- it 'returns the result of the block' do
31
- ptr = double('pointer', null?: false)
32
- result = GirFFI::AllocationHelper.free_after(ptr) { 'bar' }
33
- result.must_equal 'bar'
30
+ it "returns the result of the block" do
31
+ ptr = double("pointer", null?: false)
32
+ result = GirFFI::AllocationHelper.free_after(ptr) { "bar" }
33
+ _(result).must_equal "bar"
34
34
  end
35
35
  end
36
36
  end