gir_ffi 0.14.0 → 0.15.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (265) hide show
  1. checksums.yaml +4 -4
  2. data/Changelog.md +45 -0
  3. data/Gemfile +6 -4
  4. data/README.md +11 -10
  5. data/Rakefile +5 -5
  6. data/lib/ffi-glib.rb +16 -16
  7. data/lib/ffi-glib/array.rb +14 -4
  8. data/lib/ffi-glib/byte_array.rb +7 -2
  9. data/lib/ffi-glib/container_class_methods.rb +1 -1
  10. data/lib/ffi-glib/error.rb +1 -1
  11. data/lib/ffi-glib/hash_table.rb +3 -3
  12. data/lib/ffi-glib/list.rb +1 -1
  13. data/lib/ffi-glib/list_methods.rb +1 -1
  14. data/lib/ffi-glib/main_loop.rb +3 -3
  15. data/lib/ffi-glib/ptr_array.rb +30 -8
  16. data/lib/ffi-glib/s_list.rb +1 -1
  17. data/lib/ffi-glib/variant.rb +1 -1
  18. data/lib/ffi-gobject.rb +13 -13
  19. data/lib/ffi-gobject/object.rb +23 -32
  20. data/lib/ffi-gobject/param_spec.rb +1 -1
  21. data/lib/ffi-gobject/ruby_closure.rb +2 -2
  22. data/lib/ffi-gobject/value.rb +40 -29
  23. data/lib/ffi-gobject_introspection.rb +20 -20
  24. data/lib/ffi-gobject_introspection/gobject_type_init.rb +2 -2
  25. data/lib/ffi-gobject_introspection/i_arg_info.rb +2 -2
  26. data/lib/ffi-gobject_introspection/i_base_info.rb +27 -17
  27. data/lib/ffi-gobject_introspection/i_callable_info.rb +4 -4
  28. data/lib/ffi-gobject_introspection/i_constant_info.rb +2 -2
  29. data/lib/ffi-gobject_introspection/i_enum_info.rb +1 -0
  30. data/lib/ffi-gobject_introspection/i_field_info.rb +1 -1
  31. data/lib/ffi-gobject_introspection/i_function_info.rb +1 -1
  32. data/lib/ffi-gobject_introspection/i_interface_info.rb +1 -1
  33. data/lib/ffi-gobject_introspection/i_object_info.rb +2 -2
  34. data/lib/ffi-gobject_introspection/i_property_info.rb +2 -2
  35. data/lib/ffi-gobject_introspection/i_repository.rb +9 -6
  36. data/lib/ffi-gobject_introspection/i_struct_info.rb +2 -1
  37. data/lib/ffi-gobject_introspection/i_type_info.rb +13 -7
  38. data/lib/ffi-gobject_introspection/i_unresolved_info.rb +1 -1
  39. data/lib/ffi-gobject_introspection/i_vfunc_info.rb +1 -1
  40. data/lib/ffi-gobject_introspection/lib.rb +30 -19
  41. data/lib/ffi-gobject_introspection/strv.rb +1 -1
  42. data/lib/gir_ffi-base.rb +1 -1
  43. data/lib/gir_ffi-base/gobject.rb +26 -25
  44. data/lib/gir_ffi-base/gobject/lib.rb +3 -2
  45. data/lib/gir_ffi.rb +3 -3
  46. data/lib/gir_ffi/allocation_helper.rb +1 -1
  47. data/lib/gir_ffi/arg_helper.rb +4 -4
  48. data/lib/gir_ffi/{in_out_pointer.rb → array_element_convertor.rb} +16 -23
  49. data/lib/gir_ffi/boolean.rb +1 -1
  50. data/lib/gir_ffi/boxed_base.rb +1 -1
  51. data/lib/gir_ffi/builder.rb +18 -10
  52. data/lib/gir_ffi/builder_helper.rb +6 -1
  53. data/lib/gir_ffi/builders/argument_builder.rb +19 -19
  54. data/lib/gir_ffi/builders/argument_builder_collection.rb +2 -2
  55. data/lib/gir_ffi/builders/base_argument_builder.rb +1 -0
  56. data/lib/gir_ffi/builders/base_method_builder.rb +7 -7
  57. data/lib/gir_ffi/builders/base_return_value_builder.rb +1 -1
  58. data/lib/gir_ffi/builders/base_type_builder.rb +1 -1
  59. data/lib/gir_ffi/builders/c_to_ruby_convertor.rb +5 -5
  60. data/lib/gir_ffi/builders/callback_argument_builder.rb +8 -8
  61. data/lib/gir_ffi/builders/callback_builder.rb +16 -4
  62. data/lib/gir_ffi/builders/callback_return_value_builder.rb +2 -2
  63. data/lib/gir_ffi/builders/closure_argument_builder.rb +1 -1
  64. data/lib/gir_ffi/builders/closure_return_value_builder.rb +1 -1
  65. data/lib/gir_ffi/builders/constant_builder.rb +1 -1
  66. data/lib/gir_ffi/builders/constructor_builder.rb +9 -9
  67. data/lib/gir_ffi/builders/enum_builder.rb +16 -3
  68. data/lib/gir_ffi/builders/field_builder.rb +20 -18
  69. data/lib/gir_ffi/builders/flags_builder.rb +2 -2
  70. data/lib/gir_ffi/builders/full_c_to_ruby_convertor.rb +1 -1
  71. data/lib/gir_ffi/builders/function_builder.rb +11 -5
  72. data/lib/gir_ffi/builders/initializer_builder.rb +3 -3
  73. data/lib/gir_ffi/builders/initializer_return_value_builder.rb +2 -2
  74. data/lib/gir_ffi/builders/interface_builder.rb +2 -2
  75. data/lib/gir_ffi/builders/mapping_method_builder.rb +9 -9
  76. data/lib/gir_ffi/builders/marshalling_method_builder.rb +7 -7
  77. data/lib/gir_ffi/builders/method_template.rb +1 -1
  78. data/lib/gir_ffi/builders/module_builder.rb +7 -7
  79. data/lib/gir_ffi/builders/object_builder.rb +6 -6
  80. data/lib/gir_ffi/builders/property_argument_builder.rb +1 -1
  81. data/lib/gir_ffi/builders/property_builder.rb +13 -12
  82. data/lib/gir_ffi/builders/property_return_value_builder.rb +1 -1
  83. data/lib/gir_ffi/builders/registered_type_builder.rb +14 -5
  84. data/lib/gir_ffi/builders/return_value_builder.rb +4 -4
  85. data/lib/gir_ffi/builders/ruby_to_c_convertor.rb +6 -6
  86. data/lib/gir_ffi/builders/signal_closure_builder.rb +2 -2
  87. data/lib/gir_ffi/builders/struct_builder.rb +6 -4
  88. data/lib/gir_ffi/builders/struct_like.rb +1 -1
  89. data/lib/gir_ffi/builders/type_builder.rb +12 -12
  90. data/lib/gir_ffi/builders/unintrospectable_boxed_builder.rb +2 -2
  91. data/lib/gir_ffi/builders/unintrospectable_builder.rb +2 -2
  92. data/lib/gir_ffi/builders/union_builder.rb +4 -4
  93. data/lib/gir_ffi/builders/user_defined_builder.rb +2 -2
  94. data/lib/gir_ffi/builders/vfunc_argument_builder.rb +1 -1
  95. data/lib/gir_ffi/builders/vfunc_builder.rb +8 -8
  96. data/lib/gir_ffi/builders/with_layout.rb +2 -2
  97. data/lib/gir_ffi/callback_base.rb +4 -6
  98. data/lib/gir_ffi/class_base.rb +6 -5
  99. data/lib/gir_ffi/core.rb +19 -20
  100. data/lib/gir_ffi/enum_base.rb +1 -1
  101. data/lib/gir_ffi/enum_like_base.rb +2 -2
  102. data/lib/gir_ffi/error_argument_info.rb +2 -2
  103. data/lib/gir_ffi/error_type_info.rb +1 -1
  104. data/lib/gir_ffi/ffi_ext.rb +1 -1
  105. data/lib/gir_ffi/ffi_ext/pointer.rb +1 -1
  106. data/lib/gir_ffi/flags_base.rb +1 -1
  107. data/lib/gir_ffi/in_pointer.rb +10 -0
  108. data/lib/gir_ffi/info_ext.rb +15 -14
  109. data/lib/gir_ffi/info_ext/full_type_name.rb +3 -3
  110. data/lib/gir_ffi/info_ext/i_arg_info.rb +1 -1
  111. data/lib/gir_ffi/info_ext/i_callable_info.rb +1 -1
  112. data/lib/gir_ffi/info_ext/i_callback_info.rb +1 -1
  113. data/lib/gir_ffi/info_ext/i_field_info.rb +1 -1
  114. data/lib/gir_ffi/info_ext/i_function_info.rb +1 -1
  115. data/lib/gir_ffi/info_ext/i_property_info.rb +2 -2
  116. data/lib/gir_ffi/info_ext/i_registered_type_info.rb +4 -5
  117. data/lib/gir_ffi/info_ext/i_signal_info.rb +7 -3
  118. data/lib/gir_ffi/info_ext/i_type_info.rb +48 -26
  119. data/lib/gir_ffi/info_ext/i_unresolved_info.rb +1 -1
  120. data/lib/gir_ffi/info_ext/i_value_info.rb +25 -0
  121. data/lib/gir_ffi/info_ext/i_vfunc_info.rb +2 -2
  122. data/lib/gir_ffi/info_ext/safe_constant_name.rb +8 -8
  123. data/lib/gir_ffi/info_ext/safe_function_name.rb +2 -2
  124. data/lib/gir_ffi/interface_base.rb +3 -3
  125. data/lib/gir_ffi/lib_c.rb +1 -1
  126. data/lib/gir_ffi/method_stubber.rb +1 -1
  127. data/lib/gir_ffi/module_base.rb +1 -1
  128. data/lib/gir_ffi/object_base.rb +3 -4
  129. data/lib/gir_ffi/receiver_argument_info.rb +1 -1
  130. data/lib/gir_ffi/receiver_type_info.rb +2 -2
  131. data/lib/gir_ffi/registered_type_base.rb +1 -1
  132. data/lib/gir_ffi/sized_array.rb +4 -2
  133. data/lib/gir_ffi/struct.rb +1 -1
  134. data/lib/gir_ffi/struct_base.rb +1 -1
  135. data/lib/gir_ffi/type_map.rb +2 -23
  136. data/lib/gir_ffi/unintrospectable_boxed_info.rb +2 -2
  137. data/lib/gir_ffi/unintrospectable_type_info.rb +5 -1
  138. data/lib/gir_ffi/union.rb +1 -1
  139. data/lib/gir_ffi/union_base.rb +1 -1
  140. data/lib/gir_ffi/user_defined_object_info.rb +6 -2
  141. data/lib/gir_ffi/user_defined_property_info.rb +33 -33
  142. data/lib/gir_ffi/version.rb +1 -1
  143. data/tasks/test.rake +3 -2
  144. data/test/base_test_helper.rb +16 -9
  145. data/test/ffi-glib/array_test.rb +71 -56
  146. data/test/ffi-glib/byte_array_test.rb +13 -7
  147. data/test/ffi-glib/bytes_test.rb +24 -19
  148. data/test/ffi-glib/closure_test.rb +11 -11
  149. data/test/ffi-glib/destroy_notify_test.rb +6 -6
  150. data/test/ffi-glib/hash_table_test.rb +27 -27
  151. data/test/ffi-glib/list_test.rb +22 -22
  152. data/test/ffi-glib/main_loop_test.rb +12 -12
  153. data/test/ffi-glib/ptr_array_test.rb +39 -39
  154. data/test/ffi-glib/ruby_closure_test.rb +10 -10
  155. data/test/ffi-glib/s_list_test.rb +20 -20
  156. data/test/ffi-glib/strv_test.rb +19 -19
  157. data/test/ffi-glib/variant_test.rb +5 -5
  158. data/test/ffi-gobject/gobject_test.rb +48 -44
  159. data/test/ffi-gobject/object_class_test.rb +8 -8
  160. data/test/ffi-gobject/object_test.rb +51 -68
  161. data/test/ffi-gobject/param_spec_test.rb +12 -12
  162. data/test/ffi-gobject/value_test.rb +145 -125
  163. data/test/ffi-gobject_introspection/gobject_type_init_test.rb +9 -9
  164. data/test/ffi-gobject_introspection/i_base_info_test.rb +15 -16
  165. data/test/ffi-gobject_introspection/i_constant_info_test.rb +9 -13
  166. data/test/ffi-gobject_introspection/i_enum_info_test.rb +7 -7
  167. data/test/ffi-gobject_introspection/i_function_info_test.rb +1 -1
  168. data/test/ffi-gobject_introspection/i_interface_info_test.rb +10 -10
  169. data/test/ffi-gobject_introspection/i_object_info_test.rb +23 -23
  170. data/test/ffi-gobject_introspection/i_property_info_test.rb +19 -19
  171. data/test/ffi-gobject_introspection/i_registered_type_info_test.rb +10 -10
  172. data/test/ffi-gobject_introspection/i_repository_test.rb +34 -34
  173. data/test/ffi-gobject_introspection/i_struct_info_test.rb +10 -10
  174. data/test/ffi-gobject_introspection/i_type_info_test.rb +12 -15
  175. data/test/ffi-gobject_introspection/i_union_info_test.rb +7 -7
  176. data/test/ffi-gobject_introspection/i_vfunc_info_test.rb +16 -16
  177. data/test/ffi-gobject_introspection/lib_test.rb +3 -3
  178. data/test/ffi-gobject_introspection/strv_test.rb +9 -9
  179. data/test/ffi-gobject_test.rb +47 -45
  180. data/test/gir_ffi/allocation_helper_test.rb +13 -13
  181. data/test/gir_ffi/arg_helper_test.rb +71 -65
  182. data/test/gir_ffi/boolean_test.rb +20 -20
  183. data/test/gir_ffi/boxed_base_test.rb +18 -18
  184. data/test/gir_ffi/builder_test.rb +81 -213
  185. data/test/gir_ffi/builders/argument_builder_test.rb +321 -287
  186. data/test/gir_ffi/builders/base_argument_builder_test.rb +1 -1
  187. data/test/gir_ffi/builders/callback_argument_builder_test.rb +57 -56
  188. data/test/gir_ffi/builders/callback_builder_test.rb +71 -72
  189. data/test/gir_ffi/builders/callback_return_value_builder_test.rb +40 -41
  190. data/test/gir_ffi/builders/constant_builder_test.rb +1 -1
  191. data/test/gir_ffi/builders/constructor_builder_test.rb +12 -10
  192. data/test/gir_ffi/builders/enum_builder_test.rb +12 -11
  193. data/test/gir_ffi/builders/field_builder_test.rb +48 -42
  194. data/test/gir_ffi/builders/function_builder_test.rb +256 -224
  195. data/test/gir_ffi/builders/initializer_builder_test.rb +16 -14
  196. data/test/gir_ffi/builders/interface_builder_test.rb +9 -9
  197. data/test/gir_ffi/builders/module_builder_test.rb +18 -18
  198. data/test/gir_ffi/builders/object_builder_test.rb +41 -41
  199. data/test/gir_ffi/builders/property_builder_test.rb +94 -94
  200. data/test/gir_ffi/builders/registered_type_builder_test.rb +35 -11
  201. data/test/gir_ffi/builders/return_value_builder_test.rb +227 -223
  202. data/test/gir_ffi/builders/signal_closure_builder_test.rb +124 -113
  203. data/test/gir_ffi/builders/struct_builder_test.rb +38 -35
  204. data/test/gir_ffi/builders/unintrospectable_boxed_builder_test.rb +8 -14
  205. data/test/gir_ffi/builders/unintrospectable_builder_test.rb +34 -23
  206. data/test/gir_ffi/builders/union_builder_test.rb +12 -15
  207. data/test/gir_ffi/builders/user_defined_builder_test.rb +152 -148
  208. data/test/gir_ffi/builders/vfunc_argument_builder_test.rb +46 -40
  209. data/test/gir_ffi/builders/vfunc_builder_test.rb +149 -157
  210. data/test/gir_ffi/callback_base_test.rb +9 -9
  211. data/test/gir_ffi/class_base_test.rb +56 -53
  212. data/test/gir_ffi/core_test.rb +36 -35
  213. data/test/gir_ffi/enum_base_test.rb +19 -19
  214. data/test/gir_ffi/error_type_info_test.rb +23 -23
  215. data/test/gir_ffi/ffi_ext/pointer_test.rb +9 -7
  216. data/test/gir_ffi/g_type_test.rb +11 -11
  217. data/test/gir_ffi/in_pointer_test.rb +70 -50
  218. data/test/gir_ffi/info_ext/i_callable_info_test.rb +5 -5
  219. data/test/gir_ffi/info_ext/i_callback_info_test.rb +6 -5
  220. data/test/gir_ffi/info_ext/i_field_info_test.rb +6 -6
  221. data/test/gir_ffi/info_ext/i_function_info_test.rb +17 -17
  222. data/test/gir_ffi/info_ext/i_signal_info_test.rb +8 -8
  223. data/test/gir_ffi/info_ext/i_type_info_test.rb +231 -216
  224. data/test/gir_ffi/info_ext/i_unresolved_info_test.rb +4 -4
  225. data/test/gir_ffi/info_ext/safe_constant_name_test.rb +8 -8
  226. data/test/gir_ffi/info_ext/safe_function_name_test.rb +8 -8
  227. data/test/gir_ffi/interface_base_test.rb +8 -8
  228. data/test/gir_ffi/method_stubber_test.rb +21 -19
  229. data/test/gir_ffi/object_base_test.rb +23 -23
  230. data/test/gir_ffi/object_store_test.rb +13 -13
  231. data/test/gir_ffi/receiver_argument_info_test.rb +15 -15
  232. data/test/gir_ffi/sized_array_test.rb +68 -68
  233. data/test/gir_ffi/struct_base_test.rb +8 -8
  234. data/test/gir_ffi/struct_like_base_test.rb +64 -64
  235. data/test/gir_ffi/type_map_test.rb +8 -8
  236. data/test/gir_ffi/unintrospectable_type_info_test.rb +33 -33
  237. data/test/gir_ffi/union_base_test.rb +8 -8
  238. data/test/gir_ffi/user_defined_object_info_test.rb +34 -34
  239. data/test/gir_ffi/user_defined_property_info_test.rb +16 -16
  240. data/test/gir_ffi/variable_name_generator_test.rb +8 -8
  241. data/test/gir_ffi/version_test.rb +4 -4
  242. data/test/gir_ffi/zero_terminated_test.rb +34 -34
  243. data/test/gir_ffi_test_helper.rb +3 -3
  244. data/test/integration/callback_exceptions_test.rb +17 -21
  245. data/test/integration/derived_classes_test.rb +14 -13
  246. data/test/integration/generated_everything_test.rb +225 -224
  247. data/test/integration/generated_gimarshallingtests_test.rb +1174 -1060
  248. data/test/integration/generated_gio_test.rb +36 -36
  249. data/test/integration/generated_glib_test.rb +4 -6
  250. data/test/integration/generated_gobject_test.rb +43 -35
  251. data/test/integration/generated_gst_test.rb +20 -16
  252. data/test/integration/generated_gtk_source_test.rb +9 -15
  253. data/test/integration/generated_gtop_test.rb +8 -15
  254. data/test/integration/generated_pango_ft2_test.rb +2 -2
  255. data/test/integration/generated_pango_test.rb +4 -4
  256. data/test/integration/generated_regress_test.rb +1858 -1632
  257. data/test/integration/generated_secret_test.rb +8 -11
  258. data/test/integration/generated_utility_test.rb +81 -81
  259. data/test/integration/generated_warnlib_test.rb +17 -21
  260. data/test/integration/method_lookup_test.rb +6 -6
  261. data/test/introspection_test_helper.rb +49 -7
  262. data/test/minitest/stats_plugin.rb +1 -1
  263. metadata +21 -23
  264. data/lib/ffi-glib/array_methods.rb +0 -16
  265. data/test/gir_ffi/in_out_pointer_test.rb +0 -56
@@ -1,60 +1,60 @@
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 :Gio
6
6
  GirFFI.setup :Gst
7
7
 
8
8
  describe GirFFI::Builders::UnintrospectableBuilder do
9
- describe 'building the GLocalFile type' do
9
+ describe "building the GLocalFile type" do
10
10
  before do
11
- Gio.file_new_for_path '/'
11
+ Gio.file_new_for_path "/"
12
12
 
13
- @gtype = GObject.type_from_name 'GLocalFile'
13
+ @gtype = GObject.type_from_name "GLocalFile"
14
14
  @info = GirFFI::UnintrospectableTypeInfo.new(@gtype)
15
15
  @bldr = GirFFI::Builders::UnintrospectableBuilder.new(@info)
16
16
  @klass = @bldr.build_class
17
17
  end
18
18
 
19
- it 'builds a class' do
19
+ it "builds a class" do
20
20
  assert_instance_of Class, @klass
21
21
  end
22
22
 
23
- it 'builds a class derived from GObject::Object' do
23
+ it "builds a class derived from GObject::Object" do
24
24
  assert_includes @klass.registered_ancestors, GObject::Object
25
25
  end
26
26
 
27
- it 'builds a class derived from Gio::File' do
27
+ it "builds a class derived from Gio::File" do
28
28
  assert_includes @klass.registered_ancestors, Gio::File
29
29
  end
30
30
 
31
- it 'returns the same class when built again' do
31
+ it "returns the same class when built again" do
32
32
  other_bldr = GirFFI::Builders::UnintrospectableBuilder.new(@info)
33
33
  other_klass = other_bldr.build_class
34
34
 
35
35
  assert_equal @klass, other_klass
36
36
  end
37
37
 
38
- describe 'its #find_signal method' do
38
+ describe "its #find_signal method" do
39
39
  it "returns nil for a signal that doesn't exist" do
40
- @bldr.find_signal('foo').must_be_nil
40
+ _(@bldr.find_signal("foo")).must_be_nil
41
41
  end
42
42
 
43
- it 'finds signals in ancestor classes' do
44
- signal = @bldr.find_signal 'notify'
45
- signal.name.must_equal 'notify'
43
+ it "finds signals in ancestor classes" do
44
+ signal = @bldr.find_signal "notify"
45
+ _(signal.name).must_equal "notify"
46
46
  end
47
47
  end
48
48
 
49
- describe '#object_class_struct' do
50
- it 'returns the parent class struct' do
51
- @bldr.object_class_struct.must_equal GObject::ObjectClass
49
+ describe "#object_class_struct" do
50
+ it "returns the parent class struct" do
51
+ _(@bldr.object_class_struct).must_equal GObject::ObjectClass
52
52
  end
53
53
  end
54
54
  end
55
55
 
56
- describe 'building the GstFakeSink type' do
57
- let(:instance) { Gst::ElementFactory.make('fakesink', 'sink') }
56
+ describe "building the GstFakeSink type" do
57
+ let(:instance) { Gst::ElementFactory.make("fakesink", "sink") }
58
58
  let(:sink_class) { instance.class }
59
59
  let(:builder) { sink_class.gir_ffi_builder }
60
60
 
@@ -62,11 +62,22 @@ describe GirFFI::Builders::UnintrospectableBuilder do
62
62
  Gst.init []
63
63
  end
64
64
 
65
- describe 'its #find_signal method' do
66
- it 'finds signals that are not defined in the GIR' do
67
- signal = builder.find_signal 'handoff'
68
- signal.wont_be_nil
69
- signal.name.must_equal 'handoff'
65
+ describe "its #find_signal method" do
66
+ it "finds signals that are not defined in the GIR" do
67
+ signal = builder.find_signal "handoff"
68
+ _(signal).wont_be_nil
69
+ _(signal.name).must_equal "handoff"
70
+ end
71
+ end
72
+
73
+ describe "its #find_property method" do
74
+ it "returns nil for a property that doesn't exist" do
75
+ _(builder.find_property("foo")).must_be_nil
76
+ end
77
+
78
+ it "finds properies in ancestor classes" do
79
+ property = builder.find_property "name"
80
+ _(property.name).must_equal "name"
70
81
  end
71
82
  end
72
83
  end
@@ -1,31 +1,28 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'gir_ffi_test_helper'
3
+ require "gir_ffi_test_helper"
4
4
 
5
5
  describe GirFFI::Builders::UnionBuilder do
6
- let(:union_info) { get_introspection_data('GObject', 'TypeCValue') }
6
+ let(:union_info) { get_introspection_data("Regress", "FooBUnion") }
7
7
  let(:builder) { GirFFI::Builders::UnionBuilder.new union_info }
8
8
 
9
- describe '#setup_instance_method' do
9
+ describe "#setup_instance_method" do
10
10
  it "returns nil looking for a method that doesn't exist" do
11
- builder.setup_instance_method('blub').must_be_nil
11
+ _(builder.setup_instance_method("blub")).must_be_nil
12
12
  end
13
13
  end
14
14
 
15
- describe '#layout_specification' do
16
- it 'returns the correct layout for GObject::TypeCValue' do
17
- long_type = FFI.type_size(:long) == 8 ? :int64 : :int32
18
- builder.layout_specification.must_equal [:v_int, :int32, 0,
19
- :v_long, long_type, 0,
20
- :v_int64, :int64, 0,
21
- :v_double, :double, 0,
22
- :v_pointer, :pointer, 0]
15
+ describe "#layout_specification" do
16
+ it "returns the correct layout for Regress::FooBUnion" do
17
+ _(builder.layout_specification).must_equal [:type, :int32, 0,
18
+ :v, :double, 0,
19
+ :rect, :pointer, 0]
23
20
  end
24
21
  end
25
22
 
26
- describe '#layout_superclass' do
27
- it 'returns GirFFI::Union' do
28
- builder.layout_superclass.must_equal GirFFI::Union
23
+ describe "#layout_superclass" do
24
+ it "returns GirFFI::Union" do
25
+ _(builder.layout_superclass).must_equal GirFFI::Union
29
26
  end
30
27
  end
31
28
  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
  GirFFI.setup :GIMarshallingTests
6
6
  GirFFI.setup :Regress
@@ -13,392 +13,396 @@ describe GirFFI::Builders::UserDefinedBuilder do
13
13
  let(:builder) { GirFFI::Builders::UserDefinedBuilder.new info }
14
14
  let(:info) { GirFFI::UserDefinedObjectInfo.new derived_class }
15
15
 
16
- describe '#build_class' do
16
+ describe "#build_class" do
17
17
  before do
18
18
  builder.build_class
19
19
  end
20
20
 
21
- describe 'with type info containing one integer property' do
21
+ describe "with type info containing one integer property" do
22
22
  let(:info) do
23
23
  GirFFI::UserDefinedObjectInfo.new derived_class do |it|
24
- it.install_property GObject.param_spec_int('foo-bar', 'foo bar',
25
- 'The Foo Bar Property',
24
+ it.install_property GObject.param_spec_int("foo-bar", "foo bar",
25
+ "The Foo Bar Property",
26
26
  10, 20, 15,
27
27
  readable: true, writable: true)
28
28
  end
29
29
  end
30
30
 
31
- it 'registers a type that is bigger than the parent' do
31
+ it "registers a type that is bigger than the parent" do
32
32
  gtype = derived_class.gtype
33
33
  q = GObject.type_query gtype
34
- q.instance_size.must_be :>, GIMarshallingTests::Object::Struct.size
34
+ _(q.instance_size).must_be :>, GIMarshallingTests::Object::Struct.size
35
35
  end
36
36
 
37
37
  it "gives the type's Struct fields for the parent and the property" do
38
- derived_class::Struct.members.must_equal [:parent, :foo_bar]
38
+ _(derived_class::Struct.members).must_equal [:parent, :foo_bar]
39
39
  end
40
40
 
41
- it 'creates accessor functions for the property' do
41
+ it "creates accessor functions for the property" do
42
42
  obj = derived_class.new
43
43
  obj.foo_bar = 13
44
- obj.foo_bar.must_equal 13
44
+ _(obj.foo_bar).must_equal 13
45
45
  end
46
46
 
47
- it 'makes the property retrievable using #get_property' do
47
+ it "makes the property retrievable using #get_property" do
48
48
  obj = derived_class.new
49
49
  obj.foo_bar = 13
50
- obj.get_property('foo-bar').must_equal 13
50
+ _(obj.get_property("foo-bar")).must_equal 13
51
51
  end
52
52
 
53
- it 'makes the property settable using #set_property' do
53
+ it "makes the property settable using #set_property" do
54
54
  obj = derived_class.new
55
- obj.set_property('foo-bar', 20)
56
- obj.foo_bar.must_equal 20
55
+ obj.set_property("foo-bar", 20)
56
+ _(obj.foo_bar).must_equal 20
57
57
  end
58
58
 
59
- it 'keeps parent properties accessible through their accessors' do
59
+ it "keeps parent properties accessible through their accessors" do
60
60
  obj = derived_class.new
61
61
  obj.int = 24
62
- obj.int.must_equal 24
62
+ _(obj.int).must_equal 24
63
63
  end
64
64
 
65
- it 'keeps parent properties accessible through get_property and set_property' do
65
+ it "keeps parent properties accessible through get_property and set_property" do
66
66
  obj = derived_class.new
67
- obj.set_property('int', 24)
68
- obj.get_property('int').must_equal 24
67
+ obj.set_property("int", 24)
68
+ _(obj.get_property("int")).must_equal 24
69
69
  end
70
70
  end
71
71
 
72
- describe 'with type info containing properties of several different types' do
72
+ describe "with type info containing properties of several different types" do
73
73
  let(:info) do
74
74
  GirFFI::UserDefinedObjectInfo.new derived_class do |it|
75
- it.install_property GObject.param_spec_string('string-prop', 'string property',
76
- 'The String Property',
77
- 'this is the default value',
75
+ it.install_property GObject.param_spec_string("string-prop", "string property",
76
+ "The String Property",
77
+ "this is the default value",
78
78
  readable: true, writable: true)
79
- it.install_property GObject.param_spec_int('int-prop', 'integer property',
80
- 'The Integer Property',
79
+ it.install_property GObject.param_spec_int("int-prop", "integer property",
80
+ "The Integer Property",
81
81
  10, 20, 15,
82
82
  readable: true, writable: true)
83
- it.install_property GObject.param_spec_long('long-prop', 'long property',
84
- 'The Long Property',
83
+ it.install_property GObject.param_spec_long("long-prop", "long property",
84
+ "The Long Property",
85
85
  10.0, 50.0, 42.0,
86
86
  readable: true, writable: true)
87
87
  end
88
88
  end
89
89
 
90
- it 'registers a type of the proper size' do
90
+ it "registers a type of the proper size" do
91
91
  expected_size = derived_class::Struct.size
92
92
  gtype = derived_class.gtype
93
93
  q = GObject.type_query gtype
94
- q.instance_size.must_equal expected_size
94
+ _(q.instance_size).must_equal expected_size
95
95
  end
96
96
 
97
- it "gives the type's Struct fields for the parent and the properties with the correct offsets" do
97
+ it "creates fields for the parents and properties in the type's Struct" do
98
98
  offsets = derived_class::Struct.offsets
99
99
  alignment = derived_class::Struct.alignment
100
- alignment.must_equal 8 # TODO: Fix tests for platforms where this fails.
101
- offsets.must_equal [[:parent, 0], [:string_prop, 32], [:int_prop, 40], [:long_prop, 48]]
100
+ _(alignment).must_equal 8 # TODO: Fix tests for platforms where this fails.
101
+ _(offsets).must_equal [[:parent, 0],
102
+ [:string_prop, 32],
103
+ [:int_prop, 40],
104
+ [:long_prop, 48]]
102
105
  end
103
106
 
104
- it 'creates accessor functions for the string property' do
107
+ it "creates accessor functions for the string property" do
105
108
  obj = derived_class.new
106
- obj.string_prop = 'hello!'
107
- obj.string_prop.must_equal 'hello!'
109
+ obj.string_prop = "hello!"
110
+ _(obj.string_prop).must_equal "hello!"
108
111
  end
109
112
 
110
- it 'creates accessor functions for the integer property' do
113
+ it "creates accessor functions for the integer property" do
111
114
  obj = derived_class.new
112
115
  obj.int_prop = 13
113
- obj.int_prop.must_equal 13
116
+ _(obj.int_prop).must_equal 13
114
117
  end
115
118
  end
116
119
 
117
- describe 'with a boxed property' do
120
+ describe "with a boxed property" do
118
121
  let(:boxed_gtype) { GIMarshallingTests::BoxedStruct.gtype }
119
122
  let(:info) do
120
123
  GirFFI::UserDefinedObjectInfo.new derived_class do |it|
121
- it.install_property GObject.param_spec_boxed('boxed-prop', 'boxed property',
122
- 'The Boxed Property',
124
+ it.install_property GObject.param_spec_boxed("boxed-prop", "boxed property",
125
+ "The Boxed Property",
123
126
  boxed_gtype,
124
127
  readable: true, writable: true)
125
128
  end
126
129
  end
127
130
 
128
- it 'registers a type of the proper size' do
131
+ it "registers a type of the proper size" do
129
132
  expected_size = derived_class::Struct.size
130
133
  gtype = derived_class.gtype
131
134
  q = GObject.type_query gtype
132
- q.instance_size.must_equal expected_size
135
+ _(q.instance_size).must_equal expected_size
133
136
  end
134
137
 
135
138
  it "gives the type's Struct fields for the parent and the property" do
136
- derived_class::Struct.members.must_equal [:parent, :boxed_prop]
139
+ _(derived_class::Struct.members).must_equal [:parent, :boxed_prop]
137
140
  end
138
141
 
139
- it 'creates accessor functions for the property' do
142
+ it "creates accessor functions for the property" do
140
143
  obj = derived_class.new
141
144
  boxed = GIMarshallingTests::BoxedStruct.new
142
145
  boxed.long_ = 423
143
146
  obj.boxed_prop = boxed
144
- obj.boxed_prop.long_.must_equal 423
147
+ _(obj.boxed_prop.long_).must_equal 423
145
148
  end
146
149
  end
147
150
 
148
- describe 'with an object property' do
151
+ describe "with an object property" do
149
152
  let(:object_gtype) { GIMarshallingTests::Object.gtype }
150
153
  let(:info) do
151
154
  GirFFI::UserDefinedObjectInfo.new derived_class do |it|
152
- it.install_property GObject.param_spec_object('object-prop', 'object property',
153
- 'The Object Property',
155
+ it.install_property GObject.param_spec_object("object-prop", "object property",
156
+ "The Object Property",
154
157
  object_gtype,
155
158
  readable: true, writable: true)
156
159
  end
157
160
  end
158
161
 
159
- it 'registers a type of the proper size' do
162
+ it "registers a type of the proper size" do
160
163
  expected_size = derived_class::Struct.size
161
164
  gtype = derived_class.gtype
162
165
  q = GObject.type_query gtype
163
- q.instance_size.must_equal expected_size
166
+ _(q.instance_size).must_equal expected_size
164
167
  end
165
168
 
166
169
  it "gives the type's Struct fields for the parent and the property" do
167
- derived_class::Struct.members.must_equal [:parent, :object_prop]
170
+ _(derived_class::Struct.members).must_equal [:parent, :object_prop]
168
171
  end
169
172
 
170
- it 'creates accessor functions for the property' do
173
+ it "creates accessor functions for the property" do
171
174
  obj = derived_class.new
172
175
  object = GIMarshallingTests::Object.new 42
173
176
  object.int = 423
174
177
  obj.object_prop = object
175
- obj.object_prop.int.must_equal 423
178
+ _(obj.object_prop.int).must_equal 423
176
179
  end
177
180
 
178
- it 'allows clearing the property throught the setter method' do
181
+ it "allows clearing the property throught the setter method" do
179
182
  obj = derived_class.new
180
183
  obj.object_prop = nil
181
- obj.object_prop.must_be_nil
184
+ _(obj.object_prop).must_be_nil
182
185
  end
183
186
 
184
- it 'handles reference counting correctly when using the accessor' do
187
+ it "handles reference counting correctly when using the accessor" do
185
188
  obj = derived_class.new
186
189
  object = GIMarshallingTests::Object.new 42
187
190
  obj.object_prop = object
188
- object_ref_count(object).must_equal 2
191
+ _(object_ref_count(object)).must_equal 2
189
192
  end
190
193
 
191
- it 'handles reference counting correctly when using the set_property method' do
194
+ it "handles reference counting correctly when using the set_property method" do
192
195
  obj = derived_class.new
193
196
  object = GIMarshallingTests::Object.new 42
194
197
 
195
- object_ref_count(object).must_equal 1
196
- obj.set_property('object_prop', object)
197
- object_ref_count(object).must_equal 4 # Due to extra Value#set_value + Value#get_value
198
+ _(object_ref_count(object)).must_equal 1
199
+ obj.set_property("object_prop", object)
200
+ # Expect 4 due to extra Value#set_value + Value#get_value
201
+ _(object_ref_count(object)).must_equal 4
198
202
  end
199
203
  end
200
204
 
201
- describe 'with a boolean property' do
205
+ describe "with a boolean property" do
202
206
  let(:object_gtype) { GIMarshallingTests::Object.gtype }
203
207
  let(:info) do
204
208
  GirFFI::UserDefinedObjectInfo.new derived_class do |it|
205
- it.install_property GObject.param_spec_boolean('the-prop', 'the property',
206
- 'The Property',
209
+ it.install_property GObject.param_spec_boolean("the-prop", "the property",
210
+ "The Property",
207
211
  true,
208
212
  readable: true, writable: true)
209
213
  end
210
214
  end
211
215
 
212
- it 'creates accessor functions for the property' do
216
+ it "creates accessor functions for the property" do
213
217
  obj = derived_class.new
214
218
  obj.the_prop = true
215
- obj.the_prop.must_equal true
219
+ _(obj.the_prop).must_equal true
216
220
  end
217
221
  end
218
222
 
219
- describe 'with a char property' do
223
+ describe "with a char property" do
220
224
  let(:object_gtype) { GIMarshallingTests::Object.gtype }
221
225
  let(:info) do
222
226
  GirFFI::UserDefinedObjectInfo.new derived_class do |it|
223
- it.install_property GObject.param_spec_char('the-prop', 'the property',
224
- 'The Property',
227
+ it.install_property GObject.param_spec_char("the-prop", "the property",
228
+ "The Property",
225
229
  -20, 100, 15,
226
230
  readable: true, writable: true)
227
231
  end
228
232
  end
229
233
 
230
- it 'creates accessor functions for the property' do
234
+ it "creates accessor functions for the property" do
231
235
  obj = derived_class.new
232
236
  obj.the_prop = -13
233
- obj.the_prop.must_equal(-13)
237
+ _(obj.the_prop).must_equal(-13)
234
238
  end
235
239
  end
236
240
 
237
- describe 'with a uchar property' do
241
+ describe "with a uchar property" do
238
242
  let(:object_gtype) { GIMarshallingTests::Object.gtype }
239
243
  let(:info) do
240
244
  GirFFI::UserDefinedObjectInfo.new derived_class do |it|
241
- it.install_property GObject.param_spec_uchar('the-prop', 'the property',
242
- 'The Property',
245
+ it.install_property GObject.param_spec_uchar("the-prop", "the property",
246
+ "The Property",
243
247
  10, 100, 15,
244
248
  readable: true, writable: true)
245
249
  end
246
250
  end
247
251
 
248
- it 'creates accessor functions for the property' do
252
+ it "creates accessor functions for the property" do
249
253
  obj = derived_class.new
250
254
  obj.the_prop = 13
251
- obj.the_prop.must_equal 13
255
+ _(obj.the_prop).must_equal 13
252
256
  end
253
257
  end
254
258
 
255
- describe 'with a uint property' do
259
+ describe "with a uint property" do
256
260
  let(:object_gtype) { GIMarshallingTests::Object.gtype }
257
261
  let(:info) do
258
262
  GirFFI::UserDefinedObjectInfo.new derived_class do |it|
259
- it.install_property GObject.param_spec_uint('the-prop', 'the property',
260
- 'The Property',
263
+ it.install_property GObject.param_spec_uint("the-prop", "the property",
264
+ "The Property",
261
265
  10, 100, 15,
262
266
  readable: true, writable: true)
263
267
  end
264
268
  end
265
269
 
266
- it 'creates accessor functions for the property' do
270
+ it "creates accessor functions for the property" do
267
271
  obj = derived_class.new
268
272
  obj.the_prop = 423
269
- obj.the_prop.must_equal 423
273
+ _(obj.the_prop).must_equal 423
270
274
  end
271
275
  end
272
276
 
273
- describe 'with a ulong property' do
277
+ describe "with a ulong property" do
274
278
  let(:object_gtype) { GIMarshallingTests::Object.gtype }
275
279
  let(:info) do
276
280
  GirFFI::UserDefinedObjectInfo.new derived_class do |it|
277
- it.install_property GObject.param_spec_ulong('the-prop', 'the property',
278
- 'The Property',
281
+ it.install_property GObject.param_spec_ulong("the-prop", "the property",
282
+ "The Property",
279
283
  10, 100, 15,
280
284
  readable: true, writable: true)
281
285
  end
282
286
  end
283
287
 
284
- it 'creates accessor functions for the property' do
288
+ it "creates accessor functions for the property" do
285
289
  obj = derived_class.new
286
290
  obj.the_prop = 423_432
287
- obj.the_prop.must_equal 423_432
291
+ _(obj.the_prop).must_equal 423_432
288
292
  end
289
293
  end
290
294
 
291
- describe 'with a int64 property' do
295
+ describe "with a int64 property" do
292
296
  let(:object_gtype) { GIMarshallingTests::Object.gtype }
293
297
  let(:info) do
294
298
  GirFFI::UserDefinedObjectInfo.new derived_class do |it|
295
- it.install_property GObject.param_spec_int64('the-prop', 'the property',
296
- 'The Property',
299
+ it.install_property GObject.param_spec_int64("the-prop", "the property",
300
+ "The Property",
297
301
  10, 100, 15,
298
302
  readable: true, writable: true)
299
303
  end
300
304
  end
301
305
 
302
- it 'creates accessor functions for the property' do
306
+ it "creates accessor functions for the property" do
303
307
  obj = derived_class.new
304
308
  obj.the_prop = -423_432
305
- obj.the_prop.must_equal(-423_432)
309
+ _(obj.the_prop).must_equal(-423_432)
306
310
  end
307
311
  end
308
312
 
309
- describe 'with a uint64 property' do
313
+ describe "with a uint64 property" do
310
314
  let(:object_gtype) { GIMarshallingTests::Object.gtype }
311
315
  let(:info) do
312
316
  GirFFI::UserDefinedObjectInfo.new derived_class do |it|
313
- it.install_property GObject.param_spec_uint64('the-prop', 'the property',
314
- 'The Property',
317
+ it.install_property GObject.param_spec_uint64("the-prop", "the property",
318
+ "The Property",
315
319
  10, 100, 15,
316
320
  readable: true, writable: true)
317
321
  end
318
322
  end
319
323
 
320
- it 'creates accessor functions for the property' do
324
+ it "creates accessor functions for the property" do
321
325
  obj = derived_class.new
322
326
  obj.the_prop = 423_432
323
- obj.the_prop.must_equal 423_432
327
+ _(obj.the_prop).must_equal 423_432
324
328
  end
325
329
  end
326
330
 
327
- describe 'with a float property' do
331
+ describe "with a float property" do
328
332
  let(:object_gtype) { GIMarshallingTests::Object.gtype }
329
333
  let(:info) do
330
334
  GirFFI::UserDefinedObjectInfo.new derived_class do |it|
331
- it.install_property GObject.param_spec_float('the-prop', 'the property',
332
- 'The Property',
335
+ it.install_property GObject.param_spec_float("the-prop", "the property",
336
+ "The Property",
333
337
  10.0, 100.0, 15.0,
334
338
  readable: true, writable: true)
335
339
  end
336
340
  end
337
341
 
338
- it 'creates accessor functions for the property' do
342
+ it "creates accessor functions for the property" do
339
343
  obj = derived_class.new
340
344
  obj.the_prop = 42.23
341
- obj.the_prop.must_be_within_epsilon 42.23
345
+ _(obj.the_prop).must_be_within_epsilon 42.23
342
346
  end
343
347
  end
344
348
 
345
- describe 'with a double property' do
349
+ describe "with a double property" do
346
350
  let(:object_gtype) { GIMarshallingTests::Object.gtype }
347
351
  let(:info) do
348
352
  GirFFI::UserDefinedObjectInfo.new derived_class do |it|
349
- it.install_property GObject.param_spec_double('the-prop', 'the property',
350
- 'The Property',
353
+ it.install_property GObject.param_spec_double("the-prop", "the property",
354
+ "The Property",
351
355
  10.0, 100.0, 15.0,
352
356
  readable: true, writable: true)
353
357
  end
354
358
  end
355
359
 
356
- it 'creates accessor functions for the property' do
360
+ it "creates accessor functions for the property" do
357
361
  obj = derived_class.new
358
362
  obj.the_prop = 42.23
359
- obj.the_prop.must_equal 42.23
363
+ _(obj.the_prop).must_equal 42.23
360
364
  end
361
365
  end
362
366
 
363
- describe 'with an enum property' do
367
+ describe "with an enum property" do
364
368
  let(:object_gtype) { GIMarshallingTests::Object.gtype }
365
369
  let(:info) do
366
370
  GirFFI::UserDefinedObjectInfo.new derived_class do |it|
367
- prop = GObject.param_spec_enum('the-prop', 'the property',
368
- 'The Property',
371
+ prop = GObject.param_spec_enum("the-prop", "the property",
372
+ "The Property",
369
373
  GIMarshallingTests::GEnum.gtype, 0,
370
374
  readable: true, writable: true)
371
375
  it.install_property prop
372
376
  end
373
377
  end
374
378
 
375
- it 'creates accessor functions for the property' do
379
+ it "creates accessor functions for the property" do
376
380
  obj = derived_class.new
377
381
  obj.the_prop = :value2
378
- obj.the_prop.must_equal :value2
382
+ _(obj.the_prop).must_equal :value2
379
383
  end
380
384
  end
381
385
 
382
- describe 'with a flags property' do
386
+ describe "with a flags property" do
383
387
  let(:object_gtype) { GIMarshallingTests::Object.gtype }
384
388
  let(:info) do
385
389
  GirFFI::UserDefinedObjectInfo.new derived_class do |it|
386
- prop = GObject.param_spec_flags('the-prop', 'the property',
387
- 'The Property',
390
+ prop = GObject.param_spec_flags("the-prop", "the property",
391
+ "The Property",
388
392
  GIMarshallingTests::Flags.gtype, 0,
389
393
  readable: true, writable: true)
390
394
  it.install_property prop
391
395
  end
392
396
  end
393
397
 
394
- it 'creates accessor functions for the property' do
398
+ it "creates accessor functions for the property" do
395
399
  obj = derived_class.new
396
400
  obj.the_prop = { value2: true }
397
- obj.the_prop.must_equal value2: true
401
+ _(obj.the_prop).must_equal value2: true
398
402
  end
399
403
  end
400
404
 
401
- describe 'when deriving from a class with hidden struct size' do
405
+ describe "when deriving from a class with hidden struct size" do
402
406
  let(:parent_class) { Regress::TestInheritDrawable }
403
407
  let(:parent_size) do
404
408
  GObject.type_query(parent_class.gtype).instance_size
@@ -408,39 +412,39 @@ describe GirFFI::Builders::UserDefinedBuilder do
408
412
  end
409
413
  let(:info) do
410
414
  GirFFI::UserDefinedObjectInfo.new derived_class do |it|
411
- it.install_property GObject.param_spec_int('int-prop', 'integer property',
412
- 'Integer Property',
415
+ it.install_property GObject.param_spec_int("int-prop", "integer property",
416
+ "Integer Property",
413
417
  10, 20, 15,
414
418
  readable: true, writable: true)
415
419
  end
416
420
  end
417
421
 
418
- it 'registers a type that is bigger than the parent' do
422
+ it "registers a type that is bigger than the parent" do
419
423
  class_size = GObject.type_query(derived_class.gtype).instance_size
420
- class_size.must_be :>, parent_size
424
+ _(class_size).must_be :>, parent_size
421
425
  end
422
426
 
423
- it 'leaves enough space in derived struct layout' do
427
+ it "leaves enough space in derived struct layout" do
424
428
  struct_size = derived_class::Struct.size
425
- struct_size.must_be :>, parent_size
429
+ _(struct_size).must_be :>, parent_size
426
430
  end
427
431
  end
428
432
 
429
- describe 'with type info containing an overridden g_name' do
433
+ describe "with type info containing an overridden g_name" do
430
434
  let(:info) do
431
435
  GirFFI::UserDefinedObjectInfo.new derived_class do |it|
432
436
  it.g_name = "OtherName#{Sequence.next}"
433
437
  end
434
438
  end
435
439
 
436
- it 'registers a type under the overridden name' do
440
+ it "registers a type under the overridden name" do
437
441
  registered_name = GObject.type_name(derived_class.gtype)
438
- registered_name.must_equal info.g_name
439
- registered_name.wont_equal derived_class.name
442
+ _(registered_name).must_equal info.g_name
443
+ _(registered_name).wont_equal derived_class.name
440
444
  end
441
445
  end
442
446
 
443
- describe 'with type info containing a vfunc' do
447
+ describe "with type info containing a vfunc" do
444
448
  let(:info) do
445
449
  GirFFI::UserDefinedObjectInfo.new derived_class do |it|
446
450
  it.install_vfunc_implementation :method_int8_in, proc { |instance, in_|
@@ -449,14 +453,14 @@ describe GirFFI::Builders::UserDefinedBuilder do
449
453
  end
450
454
  end
451
455
 
452
- it 'allows the vfunc to be called through its invoker' do
456
+ it "allows the vfunc to be called through its invoker" do
453
457
  obj = derived_class.new
454
458
  obj.method_int8_in 12
455
- obj.int.must_equal 12
459
+ _(obj.int).must_equal 12
456
460
  end
457
461
  end
458
462
 
459
- describe 'when using a default vfunc implementation' do
463
+ describe "when using a default vfunc implementation" do
460
464
  let(:base_class) { Regress::TestObj }
461
465
  let(:info) do
462
466
  GirFFI::UserDefinedObjectInfo.new derived_class do |it|
@@ -472,13 +476,13 @@ describe GirFFI::Builders::UserDefinedBuilder do
472
476
  end
473
477
  end
474
478
 
475
- it 'allows the vfunc to be called through its invoker' do
479
+ it "allows the vfunc to be called through its invoker" do
476
480
  obj = derived_class.new
477
- obj.do_matrix('bar').must_equal 44
481
+ _(obj.do_matrix("bar")).must_equal 44
478
482
  end
479
483
  end
480
484
 
481
- describe 'with type info containing a vfunc from an included Interface' do
485
+ describe "with type info containing a vfunc from an included Interface" do
482
486
  let(:info) do
483
487
  derived_class.class_eval { include GIMarshallingTests::Interface }
484
488
  GirFFI::UserDefinedObjectInfo.new derived_class do |it|
@@ -487,38 +491,38 @@ describe GirFFI::Builders::UserDefinedBuilder do
487
491
  end
488
492
  end
489
493
 
490
- it 'marks the type as conforming to the included Interface' do
494
+ it "marks the type as conforming to the included Interface" do
491
495
  iface_gtype = GIMarshallingTests::Interface.gtype
492
- GObject.type_interfaces(derived_class.gtype).to_a.must_equal [iface_gtype]
496
+ _(GObject.type_interfaces(derived_class.gtype).to_a).must_equal [iface_gtype]
493
497
  end
494
498
 
495
- it 'allows the vfunc to be called through its invoker' do
499
+ it "allows the vfunc to be called through its invoker" do
496
500
  obj = derived_class.new
497
501
  obj.test_int8_in 12
498
- obj.int.must_equal 12
502
+ _(obj.int).must_equal 12
499
503
  end
500
504
  end
501
505
 
502
- it 'keeps the gtype for an already registered class' do
506
+ it "keeps the gtype for an already registered class" do
503
507
  gtype = derived_class.gtype
504
508
  other_builder = GirFFI::Builders::UserDefinedBuilder.new info
505
509
  other_class = other_builder.build_class
506
- other_class.gtype.must_equal gtype
510
+ _(other_class.gtype).must_equal gtype
507
511
  end
508
512
 
509
- it 'creates a class with a new GType' do
510
- derived_class.gtype.wont_equal GIMarshallingTests::Object.gtype
513
+ it "creates a class with a new GType" do
514
+ _(derived_class.gtype).wont_equal GIMarshallingTests::Object.gtype
511
515
  end
512
516
 
513
- it 'makes the registered class return objects with the correct GType' do
517
+ it "makes the registered class return objects with the correct GType" do
514
518
  obj = derived_class.new
515
- GObject.type_from_instance(obj).must_equal derived_class.gtype
519
+ _(GObject.type_from_instance(obj)).must_equal derived_class.gtype
516
520
  end
517
521
  end
518
522
 
519
- describe '#object_class_struct' do
520
- it 'returns the parent class struct' do
521
- builder.object_class_struct.must_equal GIMarshallingTests::ObjectClass
523
+ describe "#object_class_struct" do
524
+ it "returns the parent class struct" do
525
+ _(builder.object_class_struct).must_equal GIMarshallingTests::ObjectClass
522
526
  end
523
527
  end
524
528
  end