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,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'gir_ffi_test_helper'
3
+ require "gir_ffi_test_helper"
4
4
 
5
5
  GirFFI.setup :Regress
6
6
 
@@ -13,20 +13,20 @@ describe GirFFI::InfoExt::ISignalInfo do
13
13
  end
14
14
  let(:signal_info) { signal_class.new }
15
15
 
16
- describe '#arguments_to_gvalues' do
16
+ describe "#arguments_to_gvalues" do
17
17
  let(:object) { Regress::TestSubObj.new }
18
18
  let(:boxed) { Regress::TestSimpleBoxedA.const_return }
19
- let(:signal_info) { Regress::TestSubObj.find_signal 'test-with-static-scope-arg' }
19
+ let(:signal_info) { Regress::TestSubObj.find_signal "test-with-static-scope-arg" }
20
20
  let(:result) { signal_info.arguments_to_gvalues(object, [boxed]) }
21
21
 
22
- it 'correctly wraps :object' do
23
- result[0].get_value.must_equal object
22
+ it "correctly wraps :object" do
23
+ _(result[0].get_value).must_equal object
24
24
  end
25
25
 
26
- it 'correctly wraps :struct' do
26
+ it "correctly wraps :struct" do
27
27
  result_boxed = result[1].get_value
28
- result_boxed.some_int8.must_equal boxed.some_int8
29
- result_boxed.some_int.must_equal boxed.some_int
28
+ _(result_boxed.some_int8).must_equal boxed.some_int8
29
+ _(result_boxed.some_int).must_equal boxed.some_int
30
30
  end
31
31
  end
32
32
  end
@@ -1,6 +1,6 @@
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::InfoExt::ITypeInfo do
6
6
  let(:info_class) do
@@ -16,15 +16,15 @@ describe GirFFI::InfoExt::ITypeInfo do
16
16
  let(:iface_info) { Object.new }
17
17
 
18
18
  let(:callback_type_info) do
19
- get_introspection_data('Regress', 'test_callback').args[0].argument_type
19
+ get_introspection_data("Regress", "test_callback").args[0].argument_type
20
20
  end
21
21
  let(:ghash_type_info) do
22
- get_introspection_data('Regress',
23
- 'test_ghash_nested_everything_return').return_type
22
+ get_introspection_data("Regress",
23
+ "test_ghash_nested_everything_return").return_type
24
24
  end
25
25
 
26
- describe '#to_ffi_type' do
27
- it 'returns an array with elements subtype and size for type :array' do
26
+ describe "#to_ffi_type" do
27
+ it "returns an array with elements subtype and size for type :array" do
28
28
  expect(type_info).to receive(:pointer?).and_return false
29
29
  allow(type_info).to receive(:tag).and_return :array
30
30
  expect(type_info).to receive(:array_fixed_size).and_return 2
@@ -36,7 +36,7 @@ describe GirFFI::InfoExt::ITypeInfo do
36
36
  assert_equal [:foo, 2], result
37
37
  end
38
38
 
39
- describe 'for an :interface type' do
39
+ describe "for an :interface type" do
40
40
  before do
41
41
  allow(type_info).to receive(:interface).and_return iface_info
42
42
  allow(type_info).to receive(:tag).and_return :interface
@@ -46,13 +46,13 @@ describe GirFFI::InfoExt::ITypeInfo do
46
46
  it "maps a the interface's ffi_type" do
47
47
  allow(iface_info).to receive(:to_ffi_type).and_return :foo
48
48
 
49
- type_info.to_ffi_type.must_equal :foo
49
+ _(type_info.to_ffi_type).must_equal :foo
50
50
  end
51
51
  end
52
52
  end
53
53
 
54
- describe '#element_type' do
55
- it 'returns the element type for lists' do
54
+ describe "#element_type" do
55
+ it "returns the element type for lists" do
56
56
  allow(elmtype_info).to receive(:tag).and_return :foo
57
57
  expect(elmtype_info).to receive(:pointer?).and_return false
58
58
 
@@ -60,10 +60,10 @@ describe GirFFI::InfoExt::ITypeInfo do
60
60
  expect(type_info).to receive(:param_type).with(0).and_return elmtype_info
61
61
 
62
62
  result = type_info.element_type
63
- result.must_equal :foo
63
+ _(result).must_equal :foo
64
64
  end
65
65
 
66
- it 'returns the key and value types for ghashes' do
66
+ it "returns the key and value types for ghashes" do
67
67
  allow(keytype_info).to receive(:tag).and_return :foo
68
68
  expect(keytype_info).to receive(:pointer?).and_return false
69
69
  allow(valtype_info).to receive(:tag).and_return :bar
@@ -74,17 +74,17 @@ describe GirFFI::InfoExt::ITypeInfo do
74
74
  expect(type_info).to receive(:param_type).with(1).and_return valtype_info
75
75
 
76
76
  result = type_info.element_type
77
- result.must_equal [:foo, :bar]
77
+ _(result).must_equal [:foo, :bar]
78
78
  end
79
79
 
80
- it 'returns nil for other types' do
80
+ it "returns nil for other types" do
81
81
  expect(type_info).to receive(:tag).and_return :foo
82
82
 
83
83
  result = type_info.element_type
84
- result.must_be_nil
84
+ _(result).must_be_nil
85
85
  end
86
86
 
87
- it 'returns [:pointer, :void] if the element type is a pointer with tag :void' do
87
+ it "returns [:pointer, :void] if the element type is a pointer with tag :void" do
88
88
  allow(elmtype_info).to receive(:tag_or_class).and_return [:pointer, :void]
89
89
 
90
90
  expect(type_info).to receive(:tag).and_return :glist
@@ -94,100 +94,100 @@ describe GirFFI::InfoExt::ITypeInfo do
94
94
  end
95
95
  end
96
96
 
97
- describe '#flattened_tag' do
98
- describe 'for a simple type' do
99
- it 'returns the type tag' do
97
+ describe "#flattened_tag" do
98
+ describe "for a simple type" do
99
+ it "returns the type tag" do
100
100
  allow(type_info).to receive(:tag).and_return :uint32
101
101
 
102
- type_info.flattened_tag.must_equal :uint32
102
+ _(type_info.flattened_tag).must_equal :uint32
103
103
  end
104
104
  end
105
105
 
106
- describe 'for a zero-terminated array' do
106
+ describe "for a zero-terminated array" do
107
107
  before do
108
108
  allow(type_info).to receive(:tag).and_return :array
109
109
  allow(type_info).to receive(:param_type).with(0).and_return elmtype_info
110
110
  allow(type_info).to receive(:zero_terminated?).and_return true
111
111
  end
112
112
 
113
- describe 'of utf8' do
114
- it 'returns :strv' do
113
+ describe "of utf8" do
114
+ it "returns :strv" do
115
115
  allow(elmtype_info).to receive(:tag).and_return :utf8
116
116
  allow(elmtype_info).to receive(:pointer?).and_return true
117
117
 
118
- type_info.flattened_tag.must_equal :strv
118
+ _(type_info.flattened_tag).must_equal :strv
119
119
  end
120
120
  end
121
121
 
122
- describe 'of filename' do
123
- it 'returns :strv' do
122
+ describe "of filename" do
123
+ it "returns :strv" do
124
124
  allow(elmtype_info).to receive(:tag).and_return :filename
125
125
  allow(elmtype_info).to receive(:pointer?).and_return true
126
126
 
127
- type_info.flattened_tag.must_equal :strv
127
+ _(type_info.flattened_tag).must_equal :strv
128
128
  end
129
129
  end
130
130
 
131
- describe 'of another type' do
132
- it 'returns :zero_terminated' do
131
+ describe "of another type" do
132
+ it "returns :zero_terminated" do
133
133
  allow(elmtype_info).to receive(:tag).and_return :foo
134
134
  allow(elmtype_info).to receive(:pointer?).and_return false
135
135
 
136
- type_info.flattened_tag.must_equal :zero_terminated
136
+ _(type_info.flattened_tag).must_equal :zero_terminated
137
137
  end
138
138
  end
139
139
  end
140
140
 
141
- describe 'for a fixed length c-like array' do
142
- it 'returns :c' do
141
+ describe "for a fixed length c-like array" do
142
+ it "returns :c" do
143
143
  expect(type_info).to receive(:tag).and_return :array
144
144
  expect(type_info).to receive(:zero_terminated?).and_return false
145
145
  expect(type_info).to receive(:array_type).and_return :c
146
146
 
147
- type_info.flattened_tag.must_equal :c
147
+ _(type_info.flattened_tag).must_equal :c
148
148
  end
149
149
  end
150
150
 
151
- describe 'for a GLib array' do
152
- it 'returns :c' do
151
+ describe "for a GLib array" do
152
+ it "returns :c" do
153
153
  expect(type_info).to receive(:tag).and_return :array
154
154
  expect(type_info).to receive(:zero_terminated?).and_return false
155
155
  expect(type_info).to receive(:array_type).and_return :array
156
156
 
157
- type_info.flattened_tag.must_equal :array
157
+ _(type_info.flattened_tag).must_equal :array
158
158
  end
159
159
  end
160
160
  end
161
161
 
162
- describe '#tag_or_class' do
163
- describe 'for a simple type' do
162
+ describe "#tag_or_class" do
163
+ describe "for a simple type" do
164
164
  it "returns the type's tag" do
165
165
  allow(type_info).to receive(:tag).and_return :foo
166
166
  expect(type_info).to receive(:pointer?).and_return false
167
167
 
168
- type_info.tag_or_class.must_equal :foo
168
+ _(type_info.tag_or_class).must_equal :foo
169
169
  end
170
170
  end
171
171
 
172
- describe 'for utf8 strings' do
173
- it 'returns the tag :utf8' do
172
+ describe "for utf8 strings" do
173
+ it "returns the tag :utf8" do
174
174
  allow(type_info).to receive(:tag).and_return :utf8
175
175
  expect(type_info).to receive(:pointer?).and_return true
176
176
 
177
- type_info.tag_or_class.must_equal :utf8
177
+ _(type_info.tag_or_class).must_equal :utf8
178
178
  end
179
179
  end
180
180
 
181
- describe 'for filename strings' do
182
- it 'returns the tag :filename' do
181
+ describe "for filename strings" do
182
+ it "returns the tag :filename" do
183
183
  allow(type_info).to receive(:tag).and_return :filename
184
184
  expect(type_info).to receive(:pointer?).and_return true
185
185
 
186
- type_info.tag_or_class.must_equal :filename
186
+ _(type_info.tag_or_class).must_equal :filename
187
187
  end
188
188
  end
189
189
 
190
- describe 'for an interface class' do
190
+ describe "for an interface class" do
191
191
  let(:interface) { Object.new }
192
192
 
193
193
  before do
@@ -198,58 +198,58 @@ describe GirFFI::InfoExt::ITypeInfo do
198
198
  expect(GirFFI::Builder).to receive(:build_class).with(iface_info).and_return interface
199
199
  end
200
200
 
201
- describe 'when the interface type is :enum' do
202
- it 'returns the built interface module' do
201
+ describe "when the interface type is :enum" do
202
+ it "returns the built interface module" do
203
203
  allow(iface_info).to receive(:info_type).and_return :enum
204
204
 
205
- type_info.tag_or_class.must_equal interface
205
+ _(type_info.tag_or_class).must_equal interface
206
206
  end
207
207
  end
208
208
 
209
- describe 'when the interface type is :object' do
210
- it 'returns the built interface class' do
209
+ describe "when the interface type is :object" do
210
+ it "returns the built interface class" do
211
211
  allow(iface_info).to receive(:info_type).and_return :object
212
212
 
213
- type_info.tag_or_class.must_equal interface
213
+ _(type_info.tag_or_class).must_equal interface
214
214
  end
215
215
  end
216
216
 
217
- describe 'when the interface type is :struct' do
218
- it 'returns the built interface class' do
217
+ describe "when the interface type is :struct" do
218
+ it "returns the built interface class" do
219
219
  allow(iface_info).to receive(:info_type).and_return :struct
220
220
 
221
- type_info.tag_or_class.must_equal interface
221
+ _(type_info.tag_or_class).must_equal interface
222
222
  end
223
223
  end
224
224
  end
225
225
 
226
- describe 'for a callback' do
226
+ describe "for a callback" do
227
227
  it "returns the callback's wrapper class" do
228
- callback_type_info.tag_or_class.must_equal Regress::TestCallback
228
+ _(callback_type_info.tag_or_class).must_equal Regress::TestCallback
229
229
  end
230
230
  end
231
231
 
232
- describe 'for a pointer to simple type :foo' do
233
- it 'returns [:pointer, :foo]' do
232
+ describe "for a pointer to simple type :foo" do
233
+ it "returns [:pointer, :foo]" do
234
234
  allow(type_info).to receive(:tag).and_return :foo
235
235
  expect(type_info).to receive(:pointer?).and_return true
236
236
 
237
- type_info.tag_or_class.must_equal [:pointer, :foo]
237
+ _(type_info.tag_or_class).must_equal [:pointer, :foo]
238
238
  end
239
239
  end
240
240
 
241
- describe 'for a pointer to :void' do
242
- it 'returns [:pointer, :void]' do
241
+ describe "for a pointer to :void" do
242
+ it "returns [:pointer, :void]" do
243
243
  allow(type_info).to receive(:tag).and_return :void
244
244
  allow(type_info).to receive(:pointer?).and_return true
245
245
 
246
- type_info.tag_or_class.must_equal [:pointer, :void]
246
+ _(type_info.tag_or_class).must_equal [:pointer, :void]
247
247
  end
248
248
  end
249
249
 
250
- describe 'for a complex nested hash type' do
251
- it 'returns a representeation of the nested structure' do
252
- ghash_type_info.tag_or_class.must_equal(
250
+ describe "for a complex nested hash type" do
251
+ it "returns a representeation of the nested structure" do
252
+ _(ghash_type_info.tag_or_class).must_equal(
253
253
  [:pointer,
254
254
  [:ghash,
255
255
  :utf8,
@@ -259,34 +259,34 @@ describe GirFFI::InfoExt::ITypeInfo do
259
259
  end
260
260
  end
261
261
 
262
- describe '#to_callback_ffi_type' do
263
- describe 'for an :interface argument' do
262
+ describe "#to_callback_ffi_type" do
263
+ describe "for an :interface argument" do
264
264
  before do
265
265
  allow(type_info).to receive(:interface).and_return iface_info
266
266
  allow(type_info).to receive(:tag).and_return :interface
267
267
  allow(type_info).to receive(:pointer?).and_return false
268
268
  end
269
269
 
270
- it 'delegates to interface info' do
270
+ it "delegates to interface info" do
271
271
  allow(iface_info).to receive(:to_callback_ffi_type).and_return :some_ffi_type
272
272
 
273
- type_info.to_callback_ffi_type.must_equal :some_ffi_type
273
+ _(type_info.to_callback_ffi_type).must_equal :some_ffi_type
274
274
  end
275
275
  end
276
276
  end
277
277
 
278
- describe '#extra_conversion_arguments' do
279
- describe 'for normal types' do
278
+ describe "#extra_conversion_arguments" do
279
+ describe "for normal types" do
280
280
  before do
281
281
  allow(type_info).to receive(:tag).and_return :foo
282
282
  end
283
283
 
284
- it 'returns an empty array' do
285
- type_info.extra_conversion_arguments.must_equal []
284
+ it "returns an empty array" do
285
+ _(type_info.extra_conversion_arguments).must_equal []
286
286
  end
287
287
  end
288
288
 
289
- describe 'for a fixed-size array' do
289
+ describe "for a fixed-size array" do
290
290
  before do
291
291
  allow(type_info).to receive(:tag).and_return :array
292
292
  allow(type_info).to receive(:zero_terminated?).and_return false
@@ -297,12 +297,12 @@ describe GirFFI::InfoExt::ITypeInfo do
297
297
  allow(elmtype_info).to receive(:tag_or_class).and_return :foo
298
298
  end
299
299
 
300
- it 'returns an array containing the element type' do
301
- type_info.extra_conversion_arguments.must_equal [:foo, 3]
300
+ it "returns an array containing the element type" do
301
+ _(type_info.extra_conversion_arguments).must_equal [:foo, 3]
302
302
  end
303
303
  end
304
304
 
305
- describe 'for a zero-terminated array' do
305
+ describe "for a zero-terminated array" do
306
306
  before do
307
307
  allow(type_info).to receive(:tag).and_return :array
308
308
  allow(type_info).to receive(:zero_terminated?).and_return true
@@ -311,12 +311,12 @@ describe GirFFI::InfoExt::ITypeInfo do
311
311
  allow(elmtype_info).to receive(:tag_or_class).and_return :foo
312
312
  end
313
313
 
314
- it 'returns an array containing the element type' do
315
- type_info.extra_conversion_arguments.must_equal [:foo]
314
+ it "returns an array containing the element type" do
315
+ _(type_info.extra_conversion_arguments).must_equal [:foo]
316
316
  end
317
317
  end
318
318
 
319
- describe 'for a GArray' do
319
+ describe "for a GArray" do
320
320
  before do
321
321
  allow(type_info).to receive(:tag).and_return :array
322
322
  allow(type_info).to receive(:zero_terminated?).and_return false
@@ -326,12 +326,12 @@ describe GirFFI::InfoExt::ITypeInfo do
326
326
  allow(elmtype_info).to receive(:tag_or_class).and_return :foo
327
327
  end
328
328
 
329
- it 'returns an array containing the element type' do
330
- type_info.extra_conversion_arguments.must_equal [:foo]
329
+ it "returns an array containing the element type" do
330
+ _(type_info.extra_conversion_arguments).must_equal [:foo]
331
331
  end
332
332
  end
333
333
 
334
- describe 'for a GHashTable' do
334
+ describe "for a GHashTable" do
335
335
  before do
336
336
  allow(type_info).to receive(:tag).and_return :ghash
337
337
  allow(type_info).to receive(:param_type).with(0).and_return keytype_info
@@ -341,12 +341,12 @@ describe GirFFI::InfoExt::ITypeInfo do
341
341
  allow(valtype_info).to receive(:tag_or_class).and_return :bar
342
342
  end
343
343
 
344
- it 'returns an array containing the element type pair' do
345
- type_info.extra_conversion_arguments.must_equal [[:foo, :bar]]
344
+ it "returns an array containing the element type pair" do
345
+ _(type_info.extra_conversion_arguments).must_equal [[:foo, :bar]]
346
346
  end
347
347
  end
348
348
 
349
- describe 'for a GList' do
349
+ describe "for a GList" do
350
350
  before do
351
351
  allow(type_info).to receive(:tag).and_return :glist
352
352
 
@@ -354,12 +354,12 @@ describe GirFFI::InfoExt::ITypeInfo do
354
354
  allow(elmtype_info).to receive(:tag_or_class).and_return :foo
355
355
  end
356
356
 
357
- it 'returns an array containing the element type' do
358
- type_info.extra_conversion_arguments.must_equal [:foo]
357
+ it "returns an array containing the element type" do
358
+ _(type_info.extra_conversion_arguments).must_equal [:foo]
359
359
  end
360
360
  end
361
361
 
362
- describe 'for a GSList' do
362
+ describe "for a GSList" do
363
363
  before do
364
364
  allow(type_info).to receive(:tag).and_return :gslist
365
365
 
@@ -367,12 +367,12 @@ describe GirFFI::InfoExt::ITypeInfo do
367
367
  allow(elmtype_info).to receive(:tag_or_class).and_return :foo
368
368
  end
369
369
 
370
- it 'returns an array containing the element type' do
371
- type_info.extra_conversion_arguments.must_equal [:foo]
370
+ it "returns an array containing the element type" do
371
+ _(type_info.extra_conversion_arguments).must_equal [:foo]
372
372
  end
373
373
  end
374
374
 
375
- describe 'for a GPtrArray' do
375
+ describe "for a GPtrArray" do
376
376
  before do
377
377
  allow(type_info).to receive(:tag).and_return :array
378
378
  allow(type_info).to receive(:zero_terminated?).and_return false
@@ -382,313 +382,327 @@ describe GirFFI::InfoExt::ITypeInfo do
382
382
  allow(elmtype_info).to receive(:tag_or_class).and_return :foo
383
383
  end
384
384
 
385
- it 'returns an array containing the element type' do
386
- type_info.extra_conversion_arguments.must_equal [:foo]
385
+ it "returns an array containing the element type" do
386
+ _(type_info.extra_conversion_arguments).must_equal [:foo]
387
387
  end
388
388
  end
389
389
 
390
- describe 'for a :callback' do
390
+ describe "for a :callback" do
391
391
  before do
392
- allow(interface_type_info = Object.new).to receive(:namespace).and_return 'Bar'
393
- allow(interface_type_info).to receive(:name).and_return 'Foo'
392
+ allow(interface_type_info = Object.new).to receive(:namespace).and_return "Bar"
393
+ allow(interface_type_info).to receive(:name).and_return "Foo"
394
394
 
395
395
  allow(type_info).to receive(:tag).and_return :callback
396
396
  allow(type_info).to receive(:interface).and_return interface_type_info
397
397
  end
398
398
 
399
- it 'returns an empty array' do
400
- type_info.extra_conversion_arguments.must_equal []
399
+ it "returns an empty array" do
400
+ _(type_info.extra_conversion_arguments).must_equal []
401
401
  end
402
402
  end
403
403
  end
404
404
 
405
- describe '#argument_class_name' do
405
+ describe "#argument_class_name" do
406
406
  before do
407
407
  allow(type_info).to receive(:tag).and_return tag
408
408
  end
409
409
 
410
- describe 'for :gint32' do
410
+ describe "for :gint32" do
411
411
  let(:tag) { :gint32 }
412
412
 
413
- it 'is nil' do
414
- type_info.argument_class_name.must_be_nil
413
+ it "is nil" do
414
+ _(type_info.argument_class_name).must_be_nil
415
415
  end
416
416
  end
417
417
 
418
- describe 'for interfaces' do
418
+ describe "for interfaces" do
419
419
  let(:tag) { :interface }
420
420
 
421
421
  before do
422
422
  allow(type_info).to receive(:interface).and_return iface_info
423
423
  allow(iface_info).to receive(:info_type).and_return interface_type
424
- allow(iface_info).to receive(:full_type_name).and_return 'Bar::Foo'
424
+ allow(iface_info).to receive(:full_type_name).and_return "Bar::Foo"
425
425
  end
426
426
 
427
- describe 'for :struct' do
427
+ describe "for :struct" do
428
428
  let(:interface_type) { :struct }
429
- it 'equals the struct class name' do
430
- type_info.argument_class_name.must_equal 'Bar::Foo'
429
+ it "equals the struct class name" do
430
+ _(type_info.argument_class_name).must_equal "Bar::Foo"
431
431
  end
432
432
  end
433
433
 
434
- describe 'for :union' do
434
+ describe "for :union" do
435
435
  let(:interface_type) { :union }
436
- it 'equals the union class name' do
437
- type_info.argument_class_name.must_equal 'Bar::Foo'
436
+ it "equals the union class name" do
437
+ _(type_info.argument_class_name).must_equal "Bar::Foo"
438
438
  end
439
439
  end
440
440
 
441
- describe 'for :interface' do
441
+ describe "for :interface" do
442
442
  let(:interface_type) { :interface }
443
443
 
444
- it 'equals the interface module name' do
445
- type_info.argument_class_name.must_equal 'Bar::Foo'
444
+ it "equals the interface module name" do
445
+ _(type_info.argument_class_name).must_equal "Bar::Foo"
446
446
  end
447
447
  end
448
448
 
449
- describe 'for :object' do
449
+ describe "for :object" do
450
450
  let(:interface_type) { :object }
451
451
 
452
- it 'equals the object class name' do
453
- type_info.argument_class_name.must_equal 'Bar::Foo'
452
+ it "equals the object class name" do
453
+ _(type_info.argument_class_name).must_equal "Bar::Foo"
454
454
  end
455
455
  end
456
456
 
457
- describe 'for :callback' do
457
+ describe "for :callback" do
458
458
  let(:interface_type) { :callback }
459
459
 
460
- it 'equals the callback type name' do
461
- type_info.argument_class_name.must_equal 'Bar::Foo'
460
+ it "equals the callback type name" do
461
+ _(type_info.argument_class_name).must_equal "Bar::Foo"
462
462
  end
463
463
  end
464
464
  end
465
465
 
466
- describe 'for :strv' do
466
+ describe "for :strv" do
467
467
  let(:tag) { :strv }
468
468
 
469
- it 'equals GLib::Strv' do
470
- type_info.argument_class_name.must_equal 'GLib::Strv'
469
+ it "equals GLib::Strv" do
470
+ _(type_info.argument_class_name).must_equal "GLib::Strv"
471
471
  end
472
472
  end
473
473
 
474
- describe 'for arrays' do
474
+ describe "for arrays" do
475
475
  let(:tag) { :array }
476
476
  before do
477
477
  allow(type_info).to receive(:param_type).with(0).and_return elmtype_info
478
478
  allow(elmtype_info).to receive(:tag_or_class).and_return :foo
479
479
  end
480
480
 
481
- describe 'for :zero_terminated' do
481
+ describe "for :zero_terminated" do
482
482
  before do
483
483
  allow(type_info).to receive(:zero_terminated?).and_return true
484
484
  end
485
485
 
486
- it 'equals GirFFI::ZeroTerminated' do
487
- type_info.argument_class_name.must_equal 'GirFFI::ZeroTerminated'
486
+ it "equals GirFFI::ZeroTerminated" do
487
+ _(type_info.argument_class_name).must_equal "GirFFI::ZeroTerminated"
488
488
  end
489
489
  end
490
490
 
491
- describe 'for :byte_array' do
491
+ describe "for :byte_array" do
492
492
  before do
493
493
  allow(type_info).to receive(:zero_terminated?).and_return false
494
494
  allow(type_info).to receive(:array_type).and_return :byte_array
495
495
  end
496
496
 
497
- it 'equals GLib::ByteArray' do
498
- type_info.argument_class_name.must_equal 'GLib::ByteArray'
497
+ it "equals GLib::ByteArray" do
498
+ _(type_info.argument_class_name).must_equal "GLib::ByteArray"
499
499
  end
500
500
  end
501
501
 
502
- describe 'for :ptr_array' do
502
+ describe "for :ptr_array" do
503
503
  before do
504
504
  allow(type_info).to receive(:zero_terminated?).and_return false
505
505
  allow(type_info).to receive(:array_type).and_return :ptr_array
506
506
  end
507
507
 
508
- it 'equals GLib::PtrArray' do
509
- type_info.argument_class_name.must_equal 'GLib::PtrArray'
508
+ it "equals GLib::PtrArray" do
509
+ _(type_info.argument_class_name).must_equal "GLib::PtrArray"
510
510
  end
511
511
  end
512
512
 
513
- describe 'for :array' do
513
+ describe "for :array" do
514
514
  before do
515
515
  allow(type_info).to receive(:zero_terminated?).and_return false
516
516
  allow(type_info).to receive(:array_type).and_return :array
517
517
  end
518
518
 
519
- it 'equals GLib::Array' do
520
- type_info.argument_class_name.must_equal 'GLib::Array'
519
+ it "equals GLib::Array" do
520
+ _(type_info.argument_class_name).must_equal "GLib::Array"
521
521
  end
522
522
  end
523
523
  end
524
524
 
525
- describe 'for :glist' do
525
+ describe "for :glist" do
526
526
  let(:tag) { :glist }
527
527
 
528
- it 'equals GLib::List' do
529
- type_info.argument_class_name.must_equal 'GLib::List'
528
+ it "equals GLib::List" do
529
+ _(type_info.argument_class_name).must_equal "GLib::List"
530
530
  end
531
531
  end
532
532
 
533
- describe 'for :gslist' do
533
+ describe "for :gslist" do
534
534
  let(:tag) { :gslist }
535
535
 
536
- it 'equals GLib::SList' do
537
- type_info.argument_class_name.must_equal 'GLib::SList'
536
+ it "equals GLib::SList" do
537
+ _(type_info.argument_class_name).must_equal "GLib::SList"
538
538
  end
539
539
  end
540
540
 
541
- describe 'for :ghash' do
541
+ describe "for :ghash" do
542
542
  let(:tag) { :ghash }
543
543
 
544
- it 'equals GLib::HashTable' do
545
- type_info.argument_class_name.must_equal 'GLib::HashTable'
544
+ it "equals GLib::HashTable" do
545
+ _(type_info.argument_class_name).must_equal "GLib::HashTable"
546
546
  end
547
547
  end
548
548
 
549
- describe 'for :error' do
549
+ describe "for :error" do
550
550
  let(:tag) { :error }
551
551
 
552
- it 'equals GLib::Error' do
553
- type_info.argument_class_name.must_equal 'GLib::Error'
552
+ it "equals GLib::Error" do
553
+ _(type_info.argument_class_name).must_equal "GLib::Error"
554
554
  end
555
555
  end
556
556
  end
557
557
 
558
- describe '#gtype' do
558
+ describe "#gtype" do
559
559
  before do
560
560
  allow(type_info).to receive(:tag).and_return tag
561
561
  allow(type_info).to receive(:pointer?).and_return pointer?
562
562
  end
563
563
 
564
- describe 'for :void' do
565
- let(:tag) { :void }
564
+ describe "for non-pointers" do
566
565
  let(:pointer?) { false }
566
+ describe "for :void" do
567
+ let(:tag) { :void }
567
568
 
568
- it 'equals the none type' do
569
- GObject.type_name(type_info.gtype).must_equal 'void'
569
+ it "equals the none type" do
570
+ _(GObject.type_name(type_info.gtype)).must_equal "void"
571
+ end
570
572
  end
571
- end
572
573
 
573
- describe 'for :void pointer' do
574
- let(:tag) { :void }
575
- let(:pointer?) { true }
574
+ describe "for :gboolean" do
575
+ let(:tag) { :gboolean }
576
576
 
577
- it 'equals the none type' do
578
- GObject.type_name(type_info.gtype).must_equal 'gpointer'
577
+ it "equals the gboolean type" do
578
+ _(GObject.type_name(type_info.gtype)).must_equal "gboolean"
579
+ end
579
580
  end
580
- end
581
581
 
582
- describe 'for :gboolean' do
583
- let(:tag) { :gboolean }
584
- let(:pointer?) { false }
582
+ describe "for :gint32" do
583
+ let(:tag) { :gint32 }
585
584
 
586
- it 'equals the gboolean type' do
587
- GObject.type_name(type_info.gtype).must_equal 'gboolean'
585
+ it "equals the gint type" do
586
+ _(GObject.type_name(type_info.gtype)).must_equal "gint"
587
+ end
588
588
  end
589
- end
590
589
 
591
- describe 'for :gint32' do
592
- let(:tag) { :gint32 }
593
- let(:pointer?) { false }
590
+ describe "for :gint64" do
591
+ let(:tag) { :gint64 }
594
592
 
595
- it 'equals the gint type' do
596
- GObject.type_name(type_info.gtype).must_equal 'gint'
593
+ it "equals the gint64 type" do
594
+ _(GObject.type_name(type_info.gtype)).must_equal "gint64"
595
+ end
597
596
  end
598
- end
599
597
 
600
- describe 'for :gint64' do
601
- let(:tag) { :gint64 }
602
- let(:pointer?) { false }
598
+ describe "for :guint64" do
599
+ let(:tag) { :guint64 }
603
600
 
604
- it 'equals the gint64 type' do
605
- GObject.type_name(type_info.gtype).must_equal 'gint64'
601
+ it "equals the guint64 type" do
602
+ _(GObject.type_name(type_info.gtype)).must_equal "guint64"
603
+ end
606
604
  end
607
605
  end
608
606
 
609
- describe 'for :guint64' do
610
- let(:tag) { :guint64 }
611
- let(:pointer?) { false }
607
+ describe "for pointers" do
608
+ let(:pointer?) { true }
609
+
610
+ describe "to :void" do
611
+ let(:tag) { :void }
612
612
 
613
- it 'equals the guint64 type' do
614
- GObject.type_name(type_info.gtype).must_equal 'guint64'
613
+ it "equals the gpointer type" do
614
+ _(GObject.type_name(type_info.gtype)).must_equal "gpointer"
615
+ end
615
616
  end
616
- end
617
617
 
618
- describe 'for pointer to :utf8' do
619
- let(:tag) { :utf8 }
620
- let(:pointer?) { true }
618
+ describe "to :utf8" do
619
+ let(:tag) { :utf8 }
621
620
 
622
- it 'equals the gchararray type' do
623
- GObject.type_name(type_info.gtype).must_equal 'gchararray'
621
+ it "equals the gchararray type" do
622
+ _(GObject.type_name(type_info.gtype)).must_equal "gchararray"
623
+ end
624
624
  end
625
- end
626
625
 
627
- describe 'for pointer to :ghash' do
628
- let(:tag) { :ghash }
629
- let(:pointer?) { true }
626
+ describe "to :ghash" do
627
+ let(:tag) { :ghash }
630
628
 
631
- it 'equals the GHashTable type' do
632
- GObject.type_name(type_info.gtype).must_equal 'GHashTable'
629
+ it "equals the GHashTable type" do
630
+ _(GObject.type_name(type_info.gtype)).must_equal "GHashTable"
631
+ end
633
632
  end
634
- end
635
633
 
636
- describe 'for pointer to :glist' do
637
- let(:tag) { :glist }
638
- let(:pointer?) { true }
634
+ describe "to :glist" do
635
+ let(:tag) { :glist }
639
636
 
640
- it 'equals the pointer type' do
641
- GObject.type_name(type_info.gtype).must_equal 'gpointer'
637
+ it "equals the pointer type" do
638
+ _(GObject.type_name(type_info.gtype)).must_equal "gpointer"
639
+ end
640
+ end
641
+
642
+ describe "to :error" do
643
+ let(:tag) { :error }
644
+
645
+ it "equals the gpointer type" do
646
+ _(GObject.type_name(type_info.gtype)).must_equal "gpointer"
647
+ end
648
+ end
649
+
650
+ describe "to :guint32" do
651
+ let(:tag) { :guint32 }
652
+
653
+ it "equals the gpointer type" do
654
+ _(GObject.type_name(type_info.gtype)).must_equal "gpointer"
655
+ end
642
656
  end
643
657
  end
644
658
 
645
- describe 'for arrays' do
659
+ describe "for arrays" do
646
660
  let(:tag) { :array }
647
661
  let(:pointer?) { true }
648
662
 
649
- describe 'for pointer to GArray' do
663
+ describe "for pointer to GArray" do
650
664
  before do
651
665
  allow(type_info).to receive(:zero_terminated?).and_return false
652
666
  allow(type_info).to receive(:array_type).and_return :array
653
667
  end
654
668
 
655
- it 'equals the GArray type' do
656
- GObject.type_name(type_info.gtype).must_equal 'GArray'
669
+ it "equals the GArray type" do
670
+ _(GObject.type_name(type_info.gtype)).must_equal "GArray"
657
671
  end
658
672
  end
659
673
 
660
- describe 'for a C array' do
674
+ describe "for a C array" do
661
675
  before do
662
676
  allow(type_info).to receive(:zero_terminated?).and_return false
663
677
  allow(type_info).to receive(:array_type).and_return :c
664
678
  end
665
679
 
666
- it 'equals the gpointer type' do
667
- GObject.type_name(type_info.gtype).must_equal 'gpointer'
680
+ it "equals the gpointer type" do
681
+ _(GObject.type_name(type_info.gtype)).must_equal "gpointer"
668
682
  end
669
683
  end
670
684
 
671
- describe 'for a zero-terminated array' do
685
+ describe "for a zero-terminated array" do
672
686
  before do
673
687
  allow(type_info).to receive(:param_type).with(0).and_return elmtype_info
674
688
  allow(type_info).to receive(:zero_terminated?).and_return true
675
689
  end
676
690
 
677
- describe 'of utf8' do
678
- it 'equals the GStrv type' do
691
+ describe "of utf8" do
692
+ it "equals the GStrv type" do
679
693
  allow(elmtype_info).to receive(:tag).and_return :utf8
680
694
  allow(elmtype_info).to receive(:pointer?).and_return true
681
695
 
682
- GObject.type_name(type_info.gtype).must_equal 'GStrv'
696
+ _(GObject.type_name(type_info.gtype)).must_equal "GStrv"
683
697
  end
684
698
  end
685
699
 
686
- describe 'of filename' do
687
- it 'equals the GStrv type' do
700
+ describe "of filename" do
701
+ it "equals the GStrv type" do
688
702
  allow(elmtype_info).to receive(:tag).and_return :filename
689
703
  allow(elmtype_info).to receive(:pointer?).and_return true
690
704
 
691
- GObject.type_name(type_info.gtype).must_equal 'GStrv'
705
+ _(GObject.type_name(type_info.gtype)).must_equal "GStrv"
692
706
  end
693
707
  end
694
708
  end