gir_ffi 0.7.7 → 0.7.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (135) hide show
  1. checksums.yaml +4 -4
  2. data/Changelog.md +9 -0
  3. data/lib/ffi-glib/array.rb +1 -1
  4. data/lib/ffi-glib/error.rb +1 -2
  5. data/lib/ffi-glib/hash_table.rb +2 -2
  6. data/lib/ffi-glib/variant.rb +1 -1
  7. data/lib/ffi-gobject/base.rb +23 -23
  8. data/lib/ffi-gobject/object.rb +7 -3
  9. data/lib/ffi-gobject/value.rb +6 -1
  10. data/lib/ffi-gobject.rb +9 -6
  11. data/lib/ffi-gobject_introspection/i_base_info.rb +3 -3
  12. data/lib/ffi-gobject_introspection/i_constant_info.rb +1 -1
  13. data/lib/ffi-gobject_introspection/i_repository.rb +4 -1
  14. data/lib/ffi-gobject_introspection/i_type_info.rb +1 -1
  15. data/lib/ffi-gobject_introspection/i_unresolved_info.rb +7 -0
  16. data/lib/ffi-gobject_introspection/lib.rb +1 -1
  17. data/lib/gir_ffi/builders/argument_builder.rb +1 -1
  18. data/lib/gir_ffi/builders/c_to_ruby_convertor.rb +37 -29
  19. data/lib/gir_ffi/builders/callback_argument_builder.rb +57 -27
  20. data/lib/gir_ffi/builders/closure_convertor.rb +12 -8
  21. data/lib/gir_ffi/builders/closure_to_pointer_convertor.rb +12 -8
  22. data/lib/gir_ffi/builders/constructor_result_convertor.rb +11 -7
  23. data/lib/gir_ffi/builders/field_builder.rb +1 -1
  24. data/lib/gir_ffi/builders/function_builder.rb +1 -1
  25. data/lib/gir_ffi/builders/mapping_method_builder.rb +1 -1
  26. data/lib/gir_ffi/builders/marshalling_method_builder.rb +2 -2
  27. data/lib/gir_ffi/builders/method_template.rb +1 -1
  28. data/lib/gir_ffi/builders/null_convertor.rb +11 -7
  29. data/lib/gir_ffi/builders/property_builder.rb +1 -1
  30. data/lib/gir_ffi/builders/ruby_to_c_convertor.rb +17 -13
  31. data/lib/gir_ffi/error_argument_info.rb +1 -1
  32. data/lib/gir_ffi/ffi_ext/pointer.rb +1 -1
  33. data/lib/gir_ffi/info_ext/i_unresolved_info.rb +12 -0
  34. data/lib/gir_ffi/info_ext/safe_constant_name.rb +2 -2
  35. data/lib/gir_ffi/info_ext/safe_function_name.rb +1 -1
  36. data/lib/gir_ffi/info_ext.rb +1 -0
  37. data/lib/gir_ffi/module_base.rb +1 -1
  38. data/lib/gir_ffi/receiver_argument_info.rb +15 -12
  39. data/lib/gir_ffi/user_data_argument_info.rb +17 -15
  40. data/lib/gir_ffi/user_data_type_info.rb +14 -12
  41. data/lib/gir_ffi/version.rb +1 -1
  42. data/lib/gir_ffi-base/gobject/lib.rb +1 -1
  43. data/test/base_test_helper.rb +15 -15
  44. data/test/ffi-glib/array_test.rb +38 -38
  45. data/test/ffi-glib/byte_array_test.rb +6 -7
  46. data/test/ffi-glib/bytes_test.rb +9 -9
  47. data/test/ffi-glib/hash_table_test.rb +26 -23
  48. data/test/ffi-glib/iconv_test.rb +5 -5
  49. data/test/ffi-glib/list_test.rb +16 -16
  50. data/test/ffi-glib/main_loop_test.rb +6 -6
  51. data/test/ffi-glib/ptr_array_test.rb +45 -45
  52. data/test/ffi-glib/ruby_closure_test.rb +6 -6
  53. data/test/ffi-glib/s_list_test.rb +15 -15
  54. data/test/ffi-glib/strv_test.rb +21 -21
  55. data/test/ffi-glib/variant_test.rb +4 -4
  56. data/test/ffi-gobject/gobject_test.rb +35 -35
  57. data/test/ffi-gobject/object_class_test.rb +1 -1
  58. data/test/ffi-gobject/object_test.rb +29 -6
  59. data/test/ffi-gobject/value_test.rb +66 -52
  60. data/test/ffi-gobject_introspection/i_base_info_test.rb +10 -11
  61. data/test/ffi-gobject_introspection/i_constant_info_test.rb +6 -6
  62. data/test/ffi-gobject_introspection/i_enum_info_test.rb +4 -5
  63. data/test/ffi-gobject_introspection/i_function_info_test.rb +0 -2
  64. data/test/ffi-gobject_introspection/i_object_info_test.rb +5 -5
  65. data/test/ffi-gobject_introspection/i_registered_type_info_test.rb +9 -8
  66. data/test/ffi-gobject_introspection/i_repository_test.rb +16 -16
  67. data/test/ffi-gobject_introspection/i_type_info_test.rb +16 -2
  68. data/test/ffi-gobject_introspection/lib_test.rb +2 -2
  69. data/test/ffi-gobject_test.rb +50 -40
  70. data/test/gir_ffi/arg_helper_test.rb +5 -5
  71. data/test/gir_ffi/builder_test.rb +41 -41
  72. data/test/gir_ffi/builders/argument_builder_test.rb +240 -207
  73. data/test/gir_ffi/builders/base_argument_builder_test.rb +0 -1
  74. data/test/gir_ffi/builders/callback_argument_builder_test.rb +81 -15
  75. data/test/gir_ffi/builders/callback_builder_test.rb +39 -14
  76. data/test/gir_ffi/builders/callback_return_value_builder_test.rb +41 -33
  77. data/test/gir_ffi/builders/enum_builder_test.rb +3 -3
  78. data/test/gir_ffi/builders/field_builder_test.rb +17 -17
  79. data/test/gir_ffi/builders/function_builder_test.rb +16 -16
  80. data/test/gir_ffi/builders/interface_builder_test.rb +9 -7
  81. data/test/gir_ffi/builders/module_builder_test.rb +5 -6
  82. data/test/gir_ffi/builders/object_builder_test.rb +24 -19
  83. data/test/gir_ffi/builders/property_builder_test.rb +25 -23
  84. data/test/gir_ffi/builders/registered_type_builder_test.rb +11 -11
  85. data/test/gir_ffi/builders/return_value_builder_test.rb +237 -197
  86. data/test/gir_ffi/builders/signal_closure_builder_test.rb +29 -22
  87. data/test/gir_ffi/builders/struct_builder_test.rb +10 -10
  88. data/test/gir_ffi/builders/unintrospectable_builder_test.rb +8 -8
  89. data/test/gir_ffi/builders/union_builder_test.rb +5 -6
  90. data/test/gir_ffi/builders/user_defined_builder_test.rb +42 -33
  91. data/test/gir_ffi/builders/vfunc_builder_test.rb +37 -30
  92. data/test/gir_ffi/callback_base_test.rb +4 -5
  93. data/test/gir_ffi/class_base_test.rb +35 -28
  94. data/test/gir_ffi/error_type_info_test.rb +14 -14
  95. data/test/gir_ffi/ffi_ext/pointer_test.rb +4 -4
  96. data/test/gir_ffi/g_type_test.rb +6 -6
  97. data/test/gir_ffi/in_out_pointer_test.rb +27 -27
  98. data/test/gir_ffi/in_pointer_test.rb +54 -50
  99. data/test/gir_ffi/info_ext/i_callable_info_test.rb +8 -7
  100. data/test/gir_ffi/info_ext/i_callback_info_test.rb +7 -7
  101. data/test/gir_ffi/info_ext/i_field_info_test.rb +10 -8
  102. data/test/gir_ffi/info_ext/i_function_info_test.rb +17 -15
  103. data/test/gir_ffi/info_ext/i_signal_info_test.rb +10 -8
  104. data/test/gir_ffi/info_ext/i_type_info_test.rb +158 -155
  105. data/test/gir_ffi/info_ext/i_unresolved_info_test.rb +17 -0
  106. data/test/gir_ffi/info_ext/safe_constant_name_test.rb +12 -10
  107. data/test/gir_ffi/info_ext/safe_function_name_test.rb +12 -10
  108. data/test/gir_ffi/interface_base_test.rb +6 -6
  109. data/test/gir_ffi/method_stubber_test.rb +16 -13
  110. data/test/gir_ffi/object_base_test.rb +6 -6
  111. data/test/gir_ffi/sized_array_test.rb +23 -23
  112. data/test/gir_ffi/type_map_test.rb +3 -3
  113. data/test/gir_ffi/unintrospectable_type_info_test.rb +18 -18
  114. data/test/gir_ffi/user_defined_property_info_test.rb +4 -4
  115. data/test/gir_ffi/user_defined_type_info_test.rb +16 -16
  116. data/test/gir_ffi/variable_name_generator_test.rb +6 -6
  117. data/test/gir_ffi/version_test.rb +1 -1
  118. data/test/gir_ffi/zero_terminated_test.rb +16 -17
  119. data/test/gir_ffi-base/glib/boolean_test.rb +13 -13
  120. data/test/gir_ffi-base/glib/strv_test.rb +11 -11
  121. data/test/gir_ffi_test.rb +18 -18
  122. data/test/gir_ffi_test_helper.rb +13 -18
  123. data/test/integration/derived_classes_test.rb +8 -8
  124. data/test/integration/generated_gimarshallingtests_test.rb +794 -792
  125. data/test/integration/generated_gio_test.rb +25 -26
  126. data/test/integration/generated_glib_test.rb +8 -2
  127. data/test/integration/generated_gobject_test.rb +16 -9
  128. data/test/integration/generated_pango_ft2_test.rb +1 -2
  129. data/test/integration/generated_pango_test.rb +2 -2
  130. data/test/integration/generated_regress_test.rb +785 -705
  131. data/test/integration/generated_secret_test.rb +5 -5
  132. data/test/integration/method_lookup_test.rb +5 -5
  133. data/test/introspection_test_helper.rb +3 -1
  134. data/test/minitest/stats_plugin.rb +3 -3
  135. metadata +6 -3
@@ -6,54 +6,69 @@ GirFFI.setup :Regress
6
6
  # Tests generated methods and functions in the Regress namespace.
7
7
  describe Regress do
8
8
  describe Regress::Lib do
9
- it "extends FFI::Library" do
9
+ it 'extends FFI::Library' do
10
10
  class << Regress::Lib
11
- self.must_be :include?, FFI::Library
11
+ must_be :include?, FFI::Library
12
12
  end
13
13
  end
14
14
  end
15
- describe "Regress::ATestError" do
15
+ describe 'Regress::ATestError' do
16
16
  before do
17
17
  skip unless get_introspection_data 'Regress', 'ATestError'
18
18
  end
19
19
 
20
- it "has the member :code0" do
20
+ it 'has the member :code0' do
21
21
  Regress::ATestError[:code0].must_equal 0
22
22
  end
23
23
 
24
- it "has the member :code1" do
24
+ it 'has the member :code1' do
25
25
  Regress::ATestError[:code1].must_equal 1
26
26
  end
27
27
 
28
- it "has the member :code2" do
28
+ it 'has the member :code2' do
29
29
  Regress::ATestError[:code2].must_equal 2
30
30
  end
31
31
  end
32
32
 
33
- it "has the constant DOUBLE_CONSTANT" do
33
+ it 'has the constant BOOL_CONSTANT' do
34
+ skip unless get_introspection_data 'Regress', 'BOOL_CONSTANT'
35
+ Regress::BOOL_CONSTANT.must_equal true
36
+ end
37
+
38
+ it 'has the constant DOUBLE_CONSTANT' do
34
39
  assert_equal 44.22, Regress::DOUBLE_CONSTANT
35
40
  end
36
41
 
37
- it "has the constant GUINT64_CONSTANT" do
42
+ it 'has the constant GI_SCANNER_ELSE' do
43
+ skip unless get_introspection_data 'Regress', 'GI_SCANNER_ELSE'
44
+ Regress::GI_SCANNER_ELSE.must_equal 3
45
+ end
46
+
47
+ it 'has the constant GI_SCANNER_IFDEF' do
48
+ skip unless get_introspection_data 'Regress', 'GI_SCANNER_IFDEF'
49
+ Regress::GI_SCANNER_IFDEF.must_equal 3
50
+ end
51
+
52
+ it 'has the constant GUINT64_CONSTANT' do
38
53
  skip unless get_introspection_data 'Regress', 'GUINT64_CONSTANT'
39
- Regress::GUINT64_CONSTANT.must_equal 18446744073709551615
54
+ Regress::GUINT64_CONSTANT.must_equal 18_446_744_073_709_551_615
40
55
  end
41
56
 
42
- it "has the constant GUINT64_CONSTANTA" do
57
+ it 'has the constant GUINT64_CONSTANTA' do
43
58
  skip unless get_introspection_data 'Regress', 'GUINT64_CONSTANTA'
44
- Regress::GUINT64_CONSTANTA.must_equal 18446744073709551615
59
+ Regress::GUINT64_CONSTANTA.must_equal 18_446_744_073_709_551_615
45
60
  end
46
61
 
47
- it "has the constant G_GINT64_CONSTANT" do
62
+ it 'has the constant G_GINT64_CONSTANT' do
48
63
  skip unless get_introspection_data 'Regress', 'G_GINT64_CONSTANT'
49
64
  Regress::G_GINT64_CONSTANT.must_equal 1000
50
65
  end
51
66
 
52
- it "has the constant INT_CONSTANT" do
67
+ it 'has the constant INT_CONSTANT' do
53
68
  assert_equal 4422, Regress::INT_CONSTANT
54
69
  end
55
70
 
56
- it "has the constant LONG_STRING_CONSTANT" do
71
+ it 'has the constant LONG_STRING_CONSTANT' do
57
72
  Regress::LONG_STRING_CONSTANT.must_equal %w(TYPE VALUE ENCODING CHARSET
58
73
  LANGUAGE DOM INTL POSTAL PARCEL
59
74
  HOME WORK PREF VOICE FAX MSG
@@ -64,122 +79,122 @@ describe Regress do
64
79
  CGM WMF BMP MET PMB DIB PICT
65
80
  TIFF PDF PS JPEG QTIME MPEG
66
81
  MPEG2 AVI WAVE AIFF PCM X509
67
- PGP).join(",")
82
+ PGP).join(',')
68
83
  end
69
84
 
70
- describe "Regress::LikeGnomeKeyringPasswordSchema" do
85
+ describe 'Regress::LikeGnomeKeyringPasswordSchema' do
71
86
  before do
72
87
  skip unless get_introspection_data 'Regress', 'LikeGnomeKeyringPasswordSchema'
73
88
  end
74
- it "creates an instance using #new" do
89
+ it 'creates an instance using #new' do
75
90
  obj = Regress::LikeGnomeKeyringPasswordSchema.new
76
91
  obj.must_be_instance_of Regress::LikeGnomeKeyringPasswordSchema
77
92
  end
78
93
 
79
94
  let(:instance) { Regress::LikeGnomeKeyringPasswordSchema.new }
80
95
 
81
- it "has a writable field dummy" do
96
+ it 'has a writable field dummy' do
82
97
  instance.dummy.must_equal 0
83
98
  instance.dummy = 42
84
99
  instance.dummy.must_equal 42
85
100
  end
86
101
 
87
- it "has a writable field attributes" do
88
- skip "Introspection data cannot deal with type of this field yet"
102
+ it 'has a writable field attributes' do
103
+ skip 'Introspection data cannot deal with type of this field yet'
89
104
  end
90
105
 
91
- it "has a writable field dummy2" do
106
+ it 'has a writable field dummy2' do
92
107
  instance.dummy2.must_equal 0.0
93
108
  instance.dummy2 = 42.42
94
109
  instance.dummy2.must_equal 42.42
95
110
  end
96
111
  end
97
112
 
98
- describe "Regress::LikeXklConfigItem" do
113
+ describe 'Regress::LikeXklConfigItem' do
99
114
  before do
100
115
  skip unless get_introspection_data 'Regress', 'LikeXklConfigItem'
101
116
  end
102
117
 
103
118
  let(:instance) { Regress::LikeXklConfigItem.new }
104
- let(:name_array) { "foo".bytes.to_a + [0] * 29 }
119
+ let(:name_array) { 'foo'.bytes.to_a + [0] * 29 }
105
120
 
106
- it "has a writable field name" do
121
+ it 'has a writable field name' do
107
122
  # TODO: Should an array of gint8 be more string-like?
108
123
  instance.name.to_a.must_equal [0] * 32
109
124
  instance.name = name_array
110
125
  instance.name.to_a.must_equal name_array
111
126
  end
112
127
 
113
- it "has a working method #set_name" do
114
- instance.set_name "foo"
128
+ it 'has a working method #set_name' do
129
+ instance.set_name 'foo'
115
130
  instance.name.to_a.must_equal name_array
116
131
  end
117
132
  end
118
133
 
119
- it "has the constant MAXUINT64" do
134
+ it 'has the constant MAXUINT64' do
120
135
  skip unless get_introspection_data 'Regress', 'MAXUINT64'
121
136
  Regress::MAXUINT64.must_equal 0xffff_ffff_ffff_ffff
122
137
  end
123
138
 
124
- it "has the constant MININT64" do
139
+ it 'has the constant MININT64' do
125
140
  skip unless get_introspection_data 'Regress', 'MININT64'
126
141
  Regress::MININT64.must_equal(-0x8000_0000_0000_0000)
127
142
  end
128
143
 
129
- it "has the constant Mixed_Case_Constant" do
144
+ it 'has the constant Mixed_Case_Constant' do
130
145
  assert_equal 4423, Regress::Mixed_Case_Constant
131
146
  end
132
147
 
133
- it "has the constant NEGATIVE_INT_CONSTANT" do
148
+ it 'has the constant NEGATIVE_INT_CONSTANT' do
134
149
  skip unless get_introspection_data 'Regress', 'NEGATIVE_INT_CONSTANT'
135
150
  Regress::NEGATIVE_INT_CONSTANT.must_equal(-42)
136
151
  end
137
152
 
138
- it "has the constant STRING_CONSTANT" do
139
- assert_equal "Some String", Regress::STRING_CONSTANT
153
+ it 'has the constant STRING_CONSTANT' do
154
+ assert_equal 'Some String', Regress::STRING_CONSTANT
140
155
  end
141
156
 
142
- describe "Regress::TestABCError" do
157
+ describe 'Regress::TestABCError' do
143
158
  before do
144
159
  skip unless get_introspection_data 'Regress', 'TestABCError'
145
160
  end
146
161
 
147
- it "has the member :code1" do
162
+ it 'has the member :code1' do
148
163
  Regress::TestABCError[:code1].must_equal 1
149
164
  end
150
165
 
151
- it "has the member :code2" do
166
+ it 'has the member :code2' do
152
167
  Regress::TestABCError[:code2].must_equal 2
153
168
  end
154
169
 
155
- it "has the member :code3" do
170
+ it 'has the member :code3' do
156
171
  Regress::TestABCError[:code3].must_equal 3
157
172
  end
158
173
 
159
- it "has a working function #quark" do
174
+ it 'has a working function #quark' do
160
175
  quark = Regress::TestABCError.quark
161
- GLib.quark_to_string(quark).must_equal "regress-test-abc-error"
176
+ GLib.quark_to_string(quark).must_equal 'regress-test-abc-error'
162
177
  end
163
178
  end
164
179
 
165
- describe "Regress::TestBoxed" do
180
+ describe 'Regress::TestBoxed' do
166
181
  let(:instance) { Regress::TestBoxed.new_alternative_constructor1 123 }
167
182
 
168
- it "has a writable field some_int8" do
183
+ it 'has a writable field some_int8' do
169
184
  instance.some_int8.must_equal 123
170
185
  instance.some_int8 = -43
171
186
  instance.some_int8.must_equal(-43)
172
187
  end
173
188
 
174
- it "has a writable field nested_a" do
189
+ it 'has a writable field nested_a' do
175
190
  instance.nested_a.some_int.must_equal 0
176
191
  nested = Regress::TestSimpleBoxedA.new
177
- nested.some_int = 12345
192
+ nested.some_int = 12_345
178
193
  instance.nested_a = nested
179
- instance.nested_a.some_int.must_equal 12345
194
+ instance.nested_a.some_int.must_equal 12_345
180
195
  end
181
196
 
182
- it "has a writable field priv" do
197
+ it 'has a writable field priv' do
183
198
  instance.priv.wont_be_nil
184
199
  other = Regress::TestBoxed.new
185
200
  instance.priv.wont_equal other.priv
@@ -187,34 +202,42 @@ describe Regress do
187
202
  instance.priv.must_equal other.priv
188
203
  end
189
204
 
190
- it "creates an instance using #new" do
205
+ it 'creates an instance using #new' do
191
206
  tb = Regress::TestBoxed.new
192
207
  assert_instance_of Regress::TestBoxed, tb
193
208
  end
194
209
 
195
- it "creates an instance using #new_alternative_constructor1" do
210
+ it 'creates an instance using #new_alternative_constructor1' do
196
211
  tb = Regress::TestBoxed.new_alternative_constructor1 1
197
212
  assert_instance_of Regress::TestBoxed, tb
198
213
  assert_equal 1, tb.some_int8
199
214
  end
200
215
 
201
- it "creates an instance using #new_alternative_constructor2" do
216
+ it 'creates an instance using #new_alternative_constructor2' do
202
217
  tb = Regress::TestBoxed.new_alternative_constructor2 1, 2
203
218
  assert_instance_of Regress::TestBoxed, tb
204
219
  assert_equal 1 + 2, tb.some_int8
205
220
  end
206
221
 
207
- it "creates an instance using #new_alternative_constructor3" do
208
- tb = Regress::TestBoxed.new_alternative_constructor3 "54"
222
+ it 'creates an instance using #new_alternative_constructor3' do
223
+ tb = Regress::TestBoxed.new_alternative_constructor3 '54'
209
224
  assert_instance_of Regress::TestBoxed, tb
210
225
  assert_equal 54, tb.some_int8
211
226
  end
212
227
 
213
- it "has non-zero positive result for #get_gtype" do
228
+ it 'has non-zero positive result for #get_gtype' do
214
229
  assert Regress::TestBoxed.get_gtype > 0
215
230
  end
216
231
 
217
- it "has a working method #copy" do
232
+ it 'has a working method #_not_a_method' do
233
+ skip unless get_method_introspection_data('Regress', 'TestBoxed', '_not_a_method')
234
+ # FIXME: This method has been moved to a function. Should we still expose
235
+ # it as a method?
236
+ instance._not_a_method
237
+ pass
238
+ end
239
+
240
+ it 'has a working method #copy' do
218
241
  tb2 = instance.copy
219
242
  assert_instance_of Regress::TestBoxed, tb2
220
243
  assert_equal 123, tb2.some_int8
@@ -222,33 +245,33 @@ describe Regress do
222
245
  assert_equal 123, tb2.some_int8
223
246
  end
224
247
 
225
- it "has a working method #equals" do
248
+ it 'has a working method #equals' do
226
249
  tb2 = Regress::TestBoxed.new_alternative_constructor2 120, 3
227
250
  assert_equal true, instance.equals(tb2)
228
251
  end
229
252
  end
230
253
 
231
- describe "Regress::TestBoxedB" do
254
+ describe 'Regress::TestBoxedB' do
232
255
  let(:instance) { Regress::TestBoxedB.new 8, 42 }
233
256
 
234
- it "has a writable field some_int8" do
257
+ it 'has a writable field some_int8' do
235
258
  instance.some_int8.must_equal 8
236
259
  instance.some_int8 = -43
237
260
  instance.some_int8.must_equal(-43)
238
261
  end
239
262
 
240
- it "has a writable field some_long" do
263
+ it 'has a writable field some_long' do
241
264
  instance.some_long.must_equal 42
242
265
  instance.some_long = -4342
243
266
  instance.some_long.must_equal(-4342)
244
267
  end
245
268
 
246
- it "creates an instance using #new" do
269
+ it 'creates an instance using #new' do
247
270
  tb = Regress::TestBoxedB.new 8, 42
248
271
  assert_instance_of Regress::TestBoxedB, tb
249
272
  end
250
273
 
251
- it "has a working method #copy" do
274
+ it 'has a working method #copy' do
252
275
  cp = instance.copy
253
276
  cp.must_be_instance_of Regress::TestBoxedB
254
277
  cp.some_int8.must_equal 8
@@ -258,229 +281,229 @@ describe Regress do
258
281
  end
259
282
  end
260
283
 
261
- describe "Regress::TestBoxedC" do
284
+ describe 'Regress::TestBoxedC' do
262
285
  before do
263
286
  skip unless get_introspection_data 'Regress', 'TestBoxedC'
264
287
  end
265
288
 
266
289
  let(:instance) { Regress::TestBoxedC.new }
267
290
 
268
- it "has a writable field refcount" do
291
+ it 'has a writable field refcount' do
269
292
  instance.refcount.must_equal 1
270
293
  instance.refcount = 2
271
294
  instance.refcount.must_equal 2
272
295
  end
273
296
 
274
- it "has a writable field another_thing" do
297
+ it 'has a writable field another_thing' do
275
298
  instance.another_thing.must_equal 42
276
299
  instance.another_thing = 4342
277
300
  instance.another_thing.must_equal 4342
278
301
  end
279
302
 
280
- it "creates an instance using #new" do
303
+ it 'creates an instance using #new' do
281
304
  tb = Regress::TestBoxedC.new
282
305
  assert_instance_of Regress::TestBoxedC, tb
283
306
  end
284
307
  end
285
308
 
286
- describe "Regress::TestBoxedD" do
309
+ describe 'Regress::TestBoxedD' do
287
310
  before do
288
311
  skip unless get_introspection_data 'Regress', 'TestBoxedD'
289
312
  end
290
313
 
291
- it "creates an instance using #new" do
292
- instance = Regress::TestBoxedD.new "foo", 42
314
+ it 'creates an instance using #new' do
315
+ instance = Regress::TestBoxedD.new 'foo', 42
293
316
  instance.must_be_instance_of Regress::TestBoxedD
294
317
  end
295
318
 
296
- it "has a working method #copy" do
297
- instance = Regress::TestBoxedD.new "foo", 42
319
+ it 'has a working method #copy' do
320
+ instance = Regress::TestBoxedD.new 'foo', 42
298
321
  copy = instance.copy
299
322
  copy.must_be_instance_of Regress::TestBoxedD
300
323
  instance.get_magic.must_equal copy.get_magic
301
324
  instance.wont_equal copy
302
325
  end
303
326
 
304
- it "has a working method #free" do
305
- instance = Regress::TestBoxedD.new "foo", 42
327
+ it 'has a working method #free' do
328
+ instance = Regress::TestBoxedD.new 'foo', 42
306
329
  instance.free
307
330
  pass
308
331
  end
309
332
 
310
- it "has a working method #get_magic" do
311
- instance = Regress::TestBoxedD.new "foo", 42
312
- instance.get_magic.must_equal "foo".length + 42
333
+ it 'has a working method #get_magic' do
334
+ instance = Regress::TestBoxedD.new 'foo', 42
335
+ instance.get_magic.must_equal 'foo'.length + 42
313
336
  end
314
337
  end
315
338
 
316
- describe "Regress::TestDEFError" do
339
+ describe 'Regress::TestDEFError' do
317
340
  before do
318
341
  skip unless get_introspection_data 'Regress', 'TestDEFError'
319
342
  end
320
- it "has the member :code0" do
343
+ it 'has the member :code0' do
321
344
  Regress::TestDEFError[:code0].must_equal 0
322
345
  end
323
346
 
324
- it "has the member :code1" do
347
+ it 'has the member :code1' do
325
348
  Regress::TestDEFError[:code1].must_equal 1
326
349
  end
327
350
 
328
- it "has the member :code2" do
351
+ it 'has the member :code2' do
329
352
  Regress::TestDEFError[:code2].must_equal 2
330
353
  end
331
354
  end
332
355
 
333
- describe "Regress::TestEnum" do
334
- it "has the member :value1" do
356
+ describe 'Regress::TestEnum' do
357
+ it 'has the member :value1' do
335
358
  Regress::TestEnum[:value1].must_equal 0
336
359
  end
337
360
 
338
- it "has the member :value2" do
361
+ it 'has the member :value2' do
339
362
  Regress::TestEnum[:value2].must_equal 1
340
363
  end
341
364
 
342
- it "has the member :value3" do
365
+ it 'has the member :value3' do
343
366
  Regress::TestEnum[:value3].must_equal(-1)
344
367
  end
345
368
 
346
- it "has the member :value4" do
369
+ it 'has the member :value4' do
347
370
  Regress::TestEnum[:value4].must_equal 48
348
371
  end
349
372
 
350
- it "has a working function #param" do
351
- Regress::TestEnum.param(:value1).must_equal("value1")
352
- Regress::TestEnum.param(:value2).must_equal("value2")
353
- Regress::TestEnum.param(:value3).must_equal("value3")
354
- Regress::TestEnum.param(:value4).must_equal("value4")
355
- Regress::TestEnum.param(0).must_equal("value1")
356
- Regress::TestEnum.param(1).must_equal("value2")
357
- Regress::TestEnum.param(-1).must_equal("value3")
358
- Regress::TestEnum.param(48).must_equal("value4")
373
+ it 'has a working function #param' do
374
+ Regress::TestEnum.param(:value1).must_equal('value1')
375
+ Regress::TestEnum.param(:value2).must_equal('value2')
376
+ Regress::TestEnum.param(:value3).must_equal('value3')
377
+ Regress::TestEnum.param(:value4).must_equal('value4')
378
+ Regress::TestEnum.param(0).must_equal('value1')
379
+ Regress::TestEnum.param(1).must_equal('value2')
380
+ Regress::TestEnum.param(-1).must_equal('value3')
381
+ Regress::TestEnum.param(48).must_equal('value4')
359
382
  end
360
383
  end
361
384
 
362
- describe "Regress::TestEnumNoGEnum" do
363
- it "has the member :evalue1" do
385
+ describe 'Regress::TestEnumNoGEnum' do
386
+ it 'has the member :evalue1' do
364
387
  Regress::TestEnumNoGEnum[:evalue1].must_equal 0
365
388
  end
366
389
 
367
- it "has the member :evalue2" do
390
+ it 'has the member :evalue2' do
368
391
  Regress::TestEnumNoGEnum[:evalue2].must_equal 42
369
392
  end
370
393
 
371
- it "has the member :evalue3" do
394
+ it 'has the member :evalue3' do
372
395
  Regress::TestEnumNoGEnum[:evalue3].must_equal 48
373
396
  end
374
397
  end
375
398
 
376
- describe "Regress::TestEnumUnsigned" do
377
- it "has the member :value1" do
399
+ describe 'Regress::TestEnumUnsigned' do
400
+ it 'has the member :value1' do
378
401
  Regress::TestEnumUnsigned[:value1].must_equal 1
379
402
  end
380
403
 
381
404
  # NOTE In c, the positive and negative values are not distinguished
382
- it "has the member :value2" do
383
- Regress::TestEnumUnsigned[:value2].must_equal(-2147483648)
405
+ it 'has the member :value2' do
406
+ Regress::TestEnumUnsigned[:value2].must_equal(-2_147_483_648)
384
407
  end
385
408
  end
386
409
 
387
- describe "Regress::TestError" do
410
+ describe 'Regress::TestError' do
388
411
  before do
389
412
  skip unless get_introspection_data 'Regress', 'TestError'
390
413
  end
391
414
 
392
- it "has the member :code1" do
415
+ it 'has the member :code1' do
393
416
  Regress::TestError[:code1].must_equal 1
394
417
  end
395
418
 
396
- it "has the member :code2" do
419
+ it 'has the member :code2' do
397
420
  Regress::TestError[:code2].must_equal 2
398
421
  end
399
422
 
400
- it "has the member :code3" do
423
+ it 'has the member :code3' do
401
424
  Regress::TestError[:code3].must_equal 3
402
425
  end
403
426
 
404
- it "has a working function #quark" do
427
+ it 'has a working function #quark' do
405
428
  quark = Regress::TestError.quark
406
- GLib.quark_to_string(quark).must_equal "regress-test-error"
429
+ GLib.quark_to_string(quark).must_equal 'regress-test-error'
407
430
  end
408
431
  end
409
432
 
410
- describe "Regress::TestFlags" do
411
- it "has the member :flag1" do
433
+ describe 'Regress::TestFlags' do
434
+ it 'has the member :flag1' do
412
435
  assert_equal 1, Regress::TestFlags[:flag1]
413
436
  end
414
- it "has the member :flag2" do
437
+ it 'has the member :flag2' do
415
438
  assert_equal 2, Regress::TestFlags[:flag2]
416
439
  end
417
- it "has the member :flag3" do
440
+ it 'has the member :flag3' do
418
441
  assert_equal 4, Regress::TestFlags[:flag3]
419
442
  end
420
443
  end
421
444
 
422
- describe "Regress::TestFloating" do
423
- it "creates an instance using #new" do
445
+ describe 'Regress::TestFloating' do
446
+ it 'creates an instance using #new' do
424
447
  o = Regress::TestFloating.new
425
448
  o.must_be_instance_of Regress::TestFloating
426
449
  end
427
450
 
428
- describe "an instance" do
451
+ describe 'an instance' do
429
452
  before do
430
453
  @o = Regress::TestFloating.new
431
454
  end
432
455
 
433
- it "has a reference count of 1" do
456
+ it 'has a reference count of 1' do
434
457
  assert_equal 1, ref_count(@o)
435
458
  end
436
459
 
437
- it "has been sunk" do
460
+ it 'has been sunk' do
438
461
  @o.wont_be :floating?
439
462
  end
440
463
  end
441
464
  end
442
465
 
443
- describe "Regress::TestFundamentalObject" do
444
- it "does not have GObject::Object as an ancestor" do
466
+ describe 'Regress::TestFundamentalObject' do
467
+ it 'does not have GObject::Object as an ancestor' do
445
468
  refute_includes Regress::TestFundamentalObject.ancestors,
446
469
  GObject::Object
447
470
  end
448
471
 
449
- it "cannot be instantiated" do
472
+ it 'cannot be instantiated' do
450
473
  proc { Regress::TestFundamentalObject.new }.must_raise NoMethodError
451
474
  end
452
475
 
453
476
  # NOTE: Instance methods can only be tested on the subclass, since
454
477
  # TestFundamentalObject is an abstract class.
455
- let(:instance) { Regress::TestFundamentalSubObject.new "foo" }
478
+ let(:instance) { Regress::TestFundamentalSubObject.new 'foo' }
456
479
 
457
- it "has a working method #ref" do
480
+ it 'has a working method #ref' do
458
481
  instance.refcount.must_equal 1
459
482
  instance.ref
460
483
  instance.refcount.must_equal 2
461
484
  end
462
485
 
463
- it "has a working method #unref" do
486
+ it 'has a working method #unref' do
464
487
  instance.refcount.must_equal 1
465
488
  instance.unref
466
489
  instance.refcount.must_equal 0
467
490
  end
468
491
  end
469
492
 
470
- describe "Regress::TestFundamentalSubObject" do
471
- it "creates an instance using #new" do
472
- obj = Regress::TestFundamentalSubObject.new "foo"
493
+ describe 'Regress::TestFundamentalSubObject' do
494
+ it 'creates an instance using #new' do
495
+ obj = Regress::TestFundamentalSubObject.new 'foo'
473
496
  obj.must_be_instance_of Regress::TestFundamentalSubObject
474
497
  end
475
498
 
476
- let(:instance) { Regress::TestFundamentalSubObject.new "foo" }
499
+ let(:instance) { Regress::TestFundamentalSubObject.new 'foo' }
477
500
 
478
- it "is a subclass of TestFundamentalObject" do
501
+ it 'is a subclass of TestFundamentalObject' do
479
502
  assert_kind_of Regress::TestFundamentalObject, instance
480
503
  end
481
504
 
482
- it "has a field :data storing the constructor parameter" do
483
- assert_equal "foo", instance.data
505
+ it 'has a field :data storing the constructor parameter' do
506
+ assert_equal 'foo', instance.data
484
507
  end
485
508
 
486
509
  it "can access its parent class' fields directly" do
@@ -488,36 +511,36 @@ describe Regress do
488
511
  end
489
512
  end
490
513
 
491
- describe "Regress::TestInterface" do
492
- it "is a module" do
514
+ describe 'Regress::TestInterface' do
515
+ it 'is a module' do
493
516
  assert_instance_of Module, Regress::TestInterface
494
517
  end
495
518
 
496
- it "extends InterfaceBase" do
519
+ it 'extends InterfaceBase' do
497
520
  metaclass = class << Regress::TestInterface; self; end
498
521
  assert_includes metaclass.ancestors, GirFFI::InterfaceBase
499
522
  end
500
523
 
501
- it "has non-zero positive result for #get_gtype" do
524
+ it 'has non-zero positive result for #get_gtype' do
502
525
  Regress::TestInterface.get_gtype.must_be :>, 0
503
526
  end
504
527
  end
505
528
 
506
- describe "Regress::TestObj" do
507
- it "creates an instance using #constructor" do
529
+ describe 'Regress::TestObj' do
530
+ it 'creates an instance using #constructor' do
508
531
  obj = Regress::TestObj.constructor
509
532
  obj.must_be_instance_of Regress::TestObj
510
533
  end
511
534
 
512
- it "creates an instance using #new" do
535
+ it 'creates an instance using #new' do
513
536
  o1 = Regress::TestObj.constructor
514
537
  o2 = Regress::TestObj.new o1
515
538
  o2.must_be_instance_of Regress::TestObj
516
539
  end
517
540
 
518
- it "creates an instance using #new_callback" do
541
+ it 'creates an instance using #new_callback' do
519
542
  a = 1
520
- o = Regress::TestObj.new_callback Proc.new { a = 2 }, nil, nil
543
+ o = Regress::TestObj.new_callback proc { a = 2 }, nil, nil
521
544
  assert_instance_of Regress::TestObj, o
522
545
  a.must_equal 2
523
546
 
@@ -528,58 +551,58 @@ describe Regress do
528
551
  result.must_equal 2
529
552
  end
530
553
 
531
- it "creates an instance using #new_from_file" do
532
- o = Regress::TestObj.new_from_file("foo")
554
+ it 'creates an instance using #new_from_file' do
555
+ o = Regress::TestObj.new_from_file('foo')
533
556
  assert_instance_of Regress::TestObj, o
534
557
  end
535
558
 
536
- it "has a working function #null_out" do
559
+ it 'has a working function #null_out' do
537
560
  obj = Regress::TestObj.null_out
538
561
  obj.must_be_nil
539
562
  end
540
563
 
541
- it "has a working function #static_method" do
564
+ it 'has a working function #static_method' do
542
565
  rv = Regress::TestObj.static_method 623
543
566
  assert_equal 623.0, rv
544
567
  end
545
568
 
546
- it "has a working function #static_method_callback" do
569
+ it 'has a working function #static_method_callback' do
547
570
  a = 1
548
- Regress::TestObj.static_method_callback Proc.new { a = 2 }
571
+ Regress::TestObj.static_method_callback proc { a = 2 }
549
572
  assert_equal 2, a
550
573
  end
551
574
 
552
- let(:instance) { Regress::TestObj.new_from_file("foo") }
575
+ let(:instance) { Regress::TestObj.new_from_file('foo') }
553
576
 
554
- describe "its gtype" do
555
- it "can be found through get_gtype and GObject.type_from_instance" do
577
+ describe 'its gtype' do
578
+ it 'can be found through get_gtype and GObject.type_from_instance' do
556
579
  gtype = Regress::TestObj.get_gtype
557
580
  r = GObject.type_from_instance instance
558
581
  assert_equal gtype, r
559
582
  end
560
583
  end
561
584
 
562
- it "has a reference count of 1" do
585
+ it 'has a reference count of 1' do
563
586
  assert_equal 1, ref_count(instance)
564
587
  end
565
588
 
566
- it "does not float" do
589
+ it 'does not float' do
567
590
  instance.wont_be :floating?
568
591
  end
569
592
 
570
- it "has a working method #matrix" do
571
- instance.matrix("bar").must_equal 42
593
+ it 'has a working method #matrix' do
594
+ instance.matrix('bar').must_equal 42
572
595
  end
573
596
 
574
- it "has a working method #do_matrix" do
575
- instance.do_matrix("bar").must_equal 42
597
+ it 'has a working method #do_matrix' do
598
+ instance.do_matrix('bar').must_equal 42
576
599
  end
577
600
 
578
- it "has a working method #emit_sig_with_foreign_struct" do
601
+ it 'has a working method #emit_sig_with_foreign_struct' do
579
602
  skip unless get_method_introspection_data('Regress', 'TestObj',
580
603
  'emit_sig_with_foreign_struct')
581
604
  has_fired = false
582
- instance.signal_connect "sig-with-foreign-struct" do |obj, cr|
605
+ instance.signal_connect 'sig-with-foreign-struct' do |_obj, cr|
583
606
  has_fired = true
584
607
  cr.must_be_instance_of Cairo::Context
585
608
  end
@@ -587,17 +610,17 @@ describe Regress do
587
610
  assert has_fired
588
611
  end
589
612
 
590
- it "has a working method #emit_sig_with_int64" do
591
- skip unless get_signal_introspection_data "Regress", "TestObj", "sig-with-int64-prop"
592
- instance.signal_connect "sig-with-int64-prop" do |obj, i, ud|
613
+ it 'has a working method #emit_sig_with_int64' do
614
+ skip unless get_signal_introspection_data 'Regress', 'TestObj', 'sig-with-int64-prop'
615
+ instance.signal_connect 'sig-with-int64-prop' do |_obj, i, _ud|
593
616
  i
594
617
  end
595
618
  instance.emit_sig_with_int64
596
619
  end
597
620
 
598
- it "has a working method #emit_sig_with_obj" do
621
+ it 'has a working method #emit_sig_with_obj' do
599
622
  has_fired = false
600
- instance.signal_connect "sig-with-obj" do |it, obj|
623
+ instance.signal_connect 'sig-with-obj' do |_it, obj|
601
624
  has_fired = true
602
625
  obj.int.must_equal 3
603
626
  end
@@ -605,37 +628,45 @@ describe Regress do
605
628
  assert has_fired
606
629
  end
607
630
 
608
- it "has a working method #emit_sig_with_uint64" do
609
- skip unless get_signal_introspection_data "Regress", "TestObj", "sig-with-uint64-prop"
610
- instance.signal_connect "sig-with-uint64-prop" do |obj, i, ud|
631
+ it 'has a working method #emit_sig_with_uint64' do
632
+ skip unless get_signal_introspection_data 'Regress', 'TestObj', 'sig-with-uint64-prop'
633
+ instance.signal_connect 'sig-with-uint64-prop' do |_obj, i, _ud|
611
634
  i
612
635
  end
613
636
  instance.emit_sig_with_uint64
614
637
  end
615
638
 
616
- it "has a working method #forced_method" do
639
+ it 'has a working method #forced_method' do
617
640
  instance.forced_method
618
641
  pass
619
642
  end
620
643
 
621
- it "has a working method #instance_method" do
644
+ it 'has a working method #instance_method' do
622
645
  rv = instance.instance_method
623
646
  assert_equal(-1, rv)
624
647
  end
625
648
 
626
- it "has a working method #instance_method_callback" do
649
+ it 'has a working method #instance_method_callback' do
627
650
  a = 1
628
- instance.instance_method_callback Proc.new { a = 2 }
651
+ instance.instance_method_callback proc { a = 2 }
629
652
  assert_equal 2, a
630
653
  end
631
654
 
632
- it "has a working method #set_bare" do
633
- obj = Regress::TestObj.new_from_file("bar")
655
+ it 'has a working method #instance_method_full' do
656
+ skip unless get_method_introspection_data('Regress', 'TestObj', 'instance_method_full')
657
+ instance.instance_method_full
658
+ # FIXME: Is this the behavior we want, or do we want to increase the
659
+ # refcount beforehand?
660
+ ref_count(instance).must_equal 0
661
+ end
662
+
663
+ it 'has a working method #set_bare' do
664
+ obj = Regress::TestObj.new_from_file('bar')
634
665
  instance.set_bare obj
635
666
  instance.bare.must_equal obj
636
667
  end
637
668
 
638
- it "has a working method #skip_inout_param" do
669
+ it 'has a working method #skip_inout_param' do
639
670
  a = 1
640
671
  c = 2.0
641
672
  num1 = 3
@@ -646,7 +677,7 @@ describe Regress do
646
677
  sum.must_equal num1 + 10 * num2
647
678
  end
648
679
 
649
- it "has a working method #skip_out_param" do
680
+ it 'has a working method #skip_out_param' do
650
681
  a = 1
651
682
  c = 2.0
652
683
  d = 3
@@ -658,7 +689,7 @@ describe Regress do
658
689
  sum.must_equal num1 + 10 * num2
659
690
  end
660
691
 
661
- it "has a working method #skip_param" do
692
+ it 'has a working method #skip_param' do
662
693
  a = 1
663
694
  d = 3
664
695
  num1 = 4
@@ -670,7 +701,7 @@ describe Regress do
670
701
  sum.must_equal num1 + 10 * num2
671
702
  end
672
703
 
673
- it "has a working method #skip_return_val" do
704
+ it 'has a working method #skip_return_val' do
674
705
  a = 1
675
706
  c = 2.0
676
707
  d = 3
@@ -682,324 +713,350 @@ describe Regress do
682
713
  out_sum.must_equal num1 + 10 * num2
683
714
  end
684
715
 
685
- it "has a working method #skip_return_val_no_out" do
716
+ it 'has a working method #skip_return_val_no_out' do
686
717
  result = instance.skip_return_val_no_out 1
687
718
  result.must_be_nil
688
719
 
689
720
  proc { instance.skip_return_val_no_out 0 }.must_raise GirFFI::GLibError
690
721
  end
691
722
 
692
- it "has a working method #torture_signature_0" do
693
- y, z, q = instance.torture_signature_0(-21, "hello", 13)
694
- assert_equal [-21, 2 * -21, "hello".length + 13],
723
+ it 'has a working method #torture_signature_0' do
724
+ y, z, q = instance.torture_signature_0(-21, 'hello', 13)
725
+ assert_equal [-21, 2 * -21, 'hello'.length + 13],
695
726
  [y, z, q]
696
727
  end
697
728
 
698
- it "has a working method #torture_signature_1" do
699
- ret, y, z, q = instance.torture_signature_1(-21, "hello", 12)
700
- [ret, y, z, q].must_equal [true, -21, 2 * -21, "hello".length + 12]
729
+ it 'has a working method #torture_signature_1' do
730
+ ret, y, z, q = instance.torture_signature_1(-21, 'hello', 12)
731
+ [ret, y, z, q].must_equal [true, -21, 2 * -21, 'hello'.length + 12]
701
732
 
702
- proc { instance.torture_signature_1(-21, "hello", 11) }.
733
+ proc { instance.torture_signature_1(-21, 'hello', 11) }.
703
734
  must_raise GirFFI::GLibError
704
735
  end
705
736
 
706
737
  describe "its 'bare' property" do
707
- it "can be retrieved with #get_property" do
708
- instance.get_property("bare").get_value.must_be_nil
738
+ it 'can be retrieved with #get_property' do
739
+ instance.get_property('bare').get_value.must_be_nil
709
740
  end
710
741
 
711
- it "can be retrieved with #bare" do
742
+ it 'can be retrieved with #bare' do
712
743
  instance.bare.must_be_nil
713
744
  end
714
745
 
715
- it "can be set with #set_property" do
716
- obj = Regress::TestObj.new_from_file("bar")
717
- instance.set_property "bare", obj
718
- instance.get_property("bare").get_value.must_equal obj
746
+ it 'can be set with #set_property' do
747
+ obj = Regress::TestObj.new_from_file('bar')
748
+ instance.set_property 'bare', obj
749
+ instance.get_property('bare').get_value.must_equal obj
719
750
  end
720
751
 
721
- it "can be set with #bare=" do
722
- obj = Regress::TestObj.new_from_file("bar")
752
+ it 'can be set with #bare=' do
753
+ obj = Regress::TestObj.new_from_file('bar')
723
754
  instance.bare = obj
724
755
 
725
756
  instance.bare.must_equal obj
726
- instance.get_property("bare").get_value.must_equal obj
757
+ instance.get_property('bare').get_value.must_equal obj
727
758
  end
728
759
  end
729
760
 
730
761
  describe "its 'boxed' property" do
731
- it "can be retrieved with #get_property" do
732
- instance.get_property("boxed").get_value.must_be_nil
762
+ it 'can be retrieved with #get_property' do
763
+ instance.get_property('boxed').get_value.must_be_nil
733
764
  end
734
765
 
735
- it "can be retrieved with #boxed" do
766
+ it 'can be retrieved with #boxed' do
736
767
  instance.boxed.must_be_nil
737
768
  end
738
769
 
739
- it "can be set with #set_property" do
770
+ it 'can be set with #set_property' do
740
771
  tb = Regress::TestBoxed.new_alternative_constructor1 75
741
- instance.set_property "boxed", tb
742
- instance.get_property("boxed").get_value.some_int8.must_equal 75
772
+ instance.set_property 'boxed', tb
773
+ instance.get_property('boxed').get_value.some_int8.must_equal 75
743
774
  end
744
775
 
745
- it "can be set with #boxed=" do
776
+ it 'can be set with #boxed=' do
746
777
  tb = Regress::TestBoxed.new_alternative_constructor1 75
747
778
  instance.boxed = tb
748
779
  instance.boxed.some_int8.must_equal tb.some_int8
749
- instance.get_property("boxed").get_value.some_int8.must_equal tb.some_int8
780
+ instance.get_property('boxed').get_value.some_int8.must_equal tb.some_int8
750
781
  end
751
782
  end
752
783
 
753
784
  describe "its 'double' property" do
754
- it "can be retrieved with #get_property" do
755
- instance.get_property("double").get_value.must_equal 0.0
785
+ it 'can be retrieved with #get_property' do
786
+ instance.get_property('double').get_value.must_equal 0.0
756
787
  end
757
788
 
758
- it "can be retrieved with #double" do
789
+ it 'can be retrieved with #double' do
759
790
  instance.double.must_equal 0.0
760
791
  end
761
792
 
762
- it "can be set with #set_property" do
763
- instance.set_property "double", 3.14
764
- instance.get_property("double").get_value.must_equal 3.14
793
+ it 'can be set with #set_property' do
794
+ instance.set_property 'double', 3.14
795
+ instance.get_property('double').get_value.must_equal 3.14
765
796
  end
766
797
 
767
- it "can be set with #double=" do
798
+ it 'can be set with #double=' do
768
799
  instance.double = 3.14
769
800
  instance.double.must_equal 3.14
770
- instance.get_property("double").get_value.must_equal 3.14
801
+ instance.get_property('double').get_value.must_equal 3.14
771
802
  end
772
803
  end
773
804
 
774
805
  describe "its 'float' property" do
775
- it "can be retrieved with #get_property" do
776
- instance.get_property("float").get_value.must_equal 0.0
806
+ it 'can be retrieved with #get_property' do
807
+ instance.get_property('float').get_value.must_equal 0.0
777
808
  end
778
809
 
779
- it "can be retrieved with #float" do
810
+ it 'can be retrieved with #float' do
780
811
  instance.float.must_equal 0.0
781
812
  end
782
813
 
783
- it "can be set with #set_property" do
784
- instance.set_property "float", 3.14
785
- instance.get_property("float").get_value.must_be_close_to 3.14
814
+ it 'can be set with #set_property' do
815
+ instance.set_property 'float', 3.14
816
+ instance.get_property('float').get_value.must_be_close_to 3.14
786
817
  end
787
818
 
788
- it "can be set with #float=" do
819
+ it 'can be set with #float=' do
789
820
  instance.float = 3.14
790
821
  instance.float.must_be_close_to 3.14
791
- instance.get_property("float").get_value.must_be_close_to 3.14
822
+ instance.get_property('float').get_value.must_be_close_to 3.14
792
823
  end
793
824
  end
794
825
 
795
826
  describe "its 'gtype' property" do
796
827
  before do
797
- skip unless get_property_introspection_data("Regress", "TestObj", "gtype")
828
+ skip unless get_property_introspection_data('Regress', 'TestObj', 'gtype')
798
829
  end
799
830
 
800
- it "can be retrieved with #get_property" do
801
- instance.get_property("gtype").get_value.must_equal 0
831
+ it 'can be retrieved with #get_property' do
832
+ instance.get_property('gtype').get_value.must_equal 0
802
833
  end
803
834
 
804
- it "can be retrieved with #gtype" do
835
+ it 'can be retrieved with #gtype' do
805
836
  instance.gtype.must_equal 0
806
837
  end
807
838
 
808
- it "can be set with #set_property" do
809
- instance.set_property "gtype", GObject::TYPE_INT64
810
- instance.get_property("gtype").get_value.must_equal GObject::TYPE_INT64
839
+ it 'can be set with #set_property' do
840
+ instance.set_property 'gtype', GObject::TYPE_INT64
841
+ instance.get_property('gtype').get_value.must_equal GObject::TYPE_INT64
811
842
  end
812
843
 
813
- it "can be set with #gtype=" do
844
+ it 'can be set with #gtype=' do
814
845
  instance.gtype = GObject::TYPE_STRING
815
846
  instance.gtype.must_equal GObject::TYPE_STRING
816
- instance.get_property("gtype").get_value.must_equal GObject::TYPE_STRING
847
+ instance.get_property('gtype').get_value.must_equal GObject::TYPE_STRING
817
848
  end
818
849
  end
819
850
 
820
851
  describe "its 'hash-table' property" do
821
- it "can be retrieved with #get_property" do
822
- instance.get_property("hash-table").get_value.must_be_nil
852
+ it 'can be retrieved with #get_property' do
853
+ instance.get_property('hash-table').get_value.must_be_nil
823
854
  end
824
855
 
825
- it "can be retrieved with #hash_table" do
856
+ it 'can be retrieved with #hash_table' do
826
857
  instance.hash_table.must_be_nil
827
858
  end
828
859
 
829
- it "can be set with #set_property_extended" do
830
- instance.set_property_extended "hash-table", {"foo" => -4, "bar" => 83}
831
- instance.hash_table.to_hash.must_equal({"foo" => -4, "bar" => 83})
860
+ it 'can be set with #set_property_extended' do
861
+ instance.set_property_extended 'hash-table', 'foo' => -4, 'bar' => 83
862
+ instance.hash_table.to_hash.must_equal('foo' => -4, 'bar' => 83)
832
863
  end
833
864
 
834
- it "can be set with #hash_table=" do
835
- instance.hash_table = {"foo" => -4, "bar" => 83}
836
- instance.hash_table.to_hash.must_equal({"foo" => -4, "bar" => 83})
837
- instance.get_property_extended("hash-table").to_hash.must_equal({"foo" => -4,
838
- "bar" => 83})
865
+ it 'can be set with #hash_table=' do
866
+ instance.hash_table = { 'foo' => -4, 'bar' => 83 }
867
+ instance.hash_table.to_hash.must_equal('foo' => -4, 'bar' => 83)
868
+ instance.get_property_extended('hash-table').to_hash.must_equal('foo' => -4,
869
+ 'bar' => 83)
839
870
  end
840
871
  end
841
872
 
842
873
  describe "its 'hash-table-old' property" do
843
- it "can be retrieved with #get_property" do
844
- instance.get_property("hash-table-old").get_value.must_be_nil
874
+ it 'can be retrieved with #get_property' do
875
+ instance.get_property('hash-table-old').get_value.must_be_nil
845
876
  end
846
877
 
847
- it "can be retrieved with #hash_table_old" do
878
+ it 'can be retrieved with #hash_table_old' do
848
879
  instance.hash_table_old.must_be_nil
849
880
  end
850
881
 
851
- it "can be set with #set_property_extended" do
852
- instance.set_property_extended "hash-table-old", {"foo" => 34, "bar" => -3}
853
- instance.hash_table_old.to_hash.must_equal({"foo" => 34, "bar" => -3})
882
+ it 'can be set with #set_property_extended' do
883
+ instance.set_property_extended 'hash-table-old', 'foo' => 34, 'bar' => -3
884
+ instance.hash_table_old.to_hash.must_equal('foo' => 34, 'bar' => -3)
854
885
  end
855
886
 
856
- it "can be set with #hash_table_old=" do
857
- instance.hash_table_old = {"foo" => 34, "bar" => -3}
858
- instance.hash_table_old.to_hash.must_equal({"foo" => 34, "bar" => -3})
859
- instance.get_property_extended("hash-table-old").to_hash.must_equal({"foo" => 34,
860
- "bar" => -3})
887
+ it 'can be set with #hash_table_old=' do
888
+ instance.hash_table_old = { 'foo' => 34, 'bar' => -3 }
889
+ instance.hash_table_old.to_hash.must_equal('foo' => 34, 'bar' => -3)
890
+ instance.get_property_extended('hash-table-old').to_hash.must_equal('foo' => 34,
891
+ 'bar' => -3)
861
892
  end
862
893
  end
863
894
 
864
895
  describe "its 'int' property" do
865
- it "can be retrieved with #get_property" do
866
- assert_equal 0, instance.get_property("int").get_value
896
+ it 'can be retrieved with #get_property' do
897
+ assert_equal 0, instance.get_property('int').get_value
867
898
  end
868
899
 
869
- it "can be retrieved with #int" do
900
+ it 'can be retrieved with #int' do
870
901
  assert_equal 0, instance.int
871
902
  end
872
903
 
873
- it "can be set with #set_property" do
874
- instance.set_property "int", 42
875
- assert_equal 42, instance.get_property("int").get_value
904
+ it 'can be set with #set_property' do
905
+ instance.set_property 'int', 42
906
+ assert_equal 42, instance.get_property('int').get_value
876
907
  end
877
908
 
878
- it "can be set with #int=" do
909
+ it 'can be set with #int=' do
879
910
  instance.int = 41
880
- assert_equal 41, instance.get_property("int").get_value
911
+ assert_equal 41, instance.get_property('int').get_value
881
912
  assert_equal 41, instance.int
882
913
  end
883
914
  end
884
915
 
885
916
  describe "its 'list' property" do
886
- it "can be retrieved with #get_property_extended" do
887
- instance.get_property_extended("list").must_be_nil
917
+ it 'can be retrieved with #get_property_extended' do
918
+ instance.get_property_extended('list').must_be_nil
888
919
  end
889
920
 
890
- it "can be retrieved with #list" do
921
+ it 'can be retrieved with #list' do
891
922
  instance.list.must_be_nil
892
923
  end
893
924
 
894
- it "can be set with #set_property_extended" do
895
- instance.set_property_extended "list", ["foo", "bar"]
896
- instance.list.to_a.must_equal ["foo", "bar"]
925
+ it 'can be set with #set_property_extended' do
926
+ instance.set_property_extended 'list', %w(foo bar)
927
+ instance.list.to_a.must_equal %w(foo bar)
897
928
  end
898
929
 
899
- it "can be set with #list=" do
900
- instance.list = ["foo", "bar"]
901
- instance.list.to_a.must_equal ["foo", "bar"]
902
- instance.get_property_extended("list").must_be :==, ["foo", "bar"]
930
+ it 'can be set with #list=' do
931
+ instance.list = %w(foo bar)
932
+ instance.list.to_a.must_equal %w(foo bar)
933
+ instance.get_property_extended('list').must_be :==, %w(foo bar)
903
934
  end
904
935
  end
905
936
 
906
937
  describe "its 'list-old' property" do
907
- it "can be retrieved with #get_property" do
908
- instance.get_property_extended("list-old").must_be_nil
938
+ it 'can be retrieved with #get_property' do
939
+ instance.get_property_extended('list-old').must_be_nil
909
940
  end
910
941
 
911
- it "can be retrieved with #list_old" do
942
+ it 'can be retrieved with #list_old' do
912
943
  instance.list_old.must_be_nil
913
944
  end
914
945
 
915
- it "can be set with #set_property_extended" do
916
- instance.set_property_extended "list-old", ["foo", "bar"]
917
- instance.list_old.must_be :==, ["foo", "bar"]
946
+ it 'can be set with #set_property_extended' do
947
+ instance.set_property_extended 'list-old', %w(foo bar)
948
+ instance.list_old.must_be :==, %w(foo bar)
918
949
  end
919
950
 
920
- it "can be set with #list_old=" do
921
- instance.list_old = ["foo", "bar"]
922
- instance.list_old.must_be :==, ["foo", "bar"]
923
- instance.get_property_extended("list-old").must_be :==, ["foo", "bar"]
951
+ it 'can be set with #list_old=' do
952
+ instance.list_old = %w(foo bar)
953
+ instance.list_old.must_be :==, %w(foo bar)
954
+ instance.get_property_extended('list-old').must_be :==, %w(foo bar)
924
955
  end
925
956
  end
926
957
 
958
+ describe "its 'pptrarray' property" do
959
+ it 'can be retrieved with #get_property' do
960
+ skip 'pptrarray is not implemented properly'
961
+ instance.get_property('pptrarray').must_be_nil
962
+ end
963
+
964
+ it 'can be retrieved with #pptrarray' do
965
+ skip 'pptrarray is not implemented properly'
966
+ instance.pptrarray.must_be_nil
967
+ end
968
+
969
+ it 'can be set with #set_property' do
970
+ skip 'pptrarray is not implemented properly'
971
+ arr = Regress.test_garray_container_return
972
+ instance.set_property 'pptrarray', arr
973
+ instance.pptrarray.must_be :==, arr
974
+ end
975
+
976
+ it 'can be set with #pptrarray=' do
977
+ skip 'pptrarray is not implemented properly'
978
+ arr = Regress.test_garray_container_return
979
+ instance.pptrarray = arr
980
+ instance.pptrarray.must_be :==, arr
981
+ instance.get_property('pptrarray').must_be :==, arr
982
+ end
983
+ end
927
984
  describe "its 'string' property" do
928
- it "can be retrieved with #get_property" do
929
- assert_nil instance.get_property("string").get_value
985
+ it 'can be retrieved with #get_property' do
986
+ assert_nil instance.get_property('string').get_value
930
987
  end
931
988
 
932
- it "can be retrieved with #string" do
989
+ it 'can be retrieved with #string' do
933
990
  assert_nil instance.string
934
991
  end
935
992
 
936
- it "can be set with #set_property" do
937
- instance.set_property "string", "foobar"
938
- assert_equal "foobar", instance.get_property("string").get_value
993
+ it 'can be set with #set_property' do
994
+ instance.set_property 'string', 'foobar'
995
+ assert_equal 'foobar', instance.get_property('string').get_value
939
996
  end
940
997
 
941
- it "can be set with #string=" do
942
- instance.string = "foobar"
943
- assert_equal "foobar", instance.string
944
- assert_equal "foobar", instance.get_property("string").get_value
998
+ it 'can be set with #string=' do
999
+ instance.string = 'foobar'
1000
+ assert_equal 'foobar', instance.string
1001
+ assert_equal 'foobar', instance.get_property('string').get_value
945
1002
  end
946
1003
  end
947
1004
 
948
1005
  it "handles the 'all' signal" do
949
1006
  a = nil
950
- GObject.signal_connect(instance, "all") { a = 4 }
951
- GObject.signal_emit instance, "all"
1007
+ GObject.signal_connect(instance, 'all') { a = 4 }
1008
+ GObject.signal_emit instance, 'all'
952
1009
  a.must_equal 4
953
1010
  end
954
1011
 
955
1012
  it "handles the 'cleanup' signal" do
956
1013
  a = nil
957
- GObject.signal_connect(instance, "cleanup") { a = 4 }
958
- GObject.signal_emit instance, "cleanup"
1014
+ GObject.signal_connect(instance, 'cleanup') { a = 4 }
1015
+ GObject.signal_emit instance, 'cleanup'
959
1016
  a.must_equal 4
960
1017
  end
961
1018
 
962
1019
  it "handles the 'first' signal" do
963
1020
  a = nil
964
- GObject.signal_connect(instance, "first") { a = 4 }
965
- GObject.signal_emit instance, "first"
1021
+ GObject.signal_connect(instance, 'first') { a = 4 }
1022
+ GObject.signal_emit instance, 'first'
966
1023
  a.must_equal 4
967
1024
  end
968
1025
 
969
1026
  it "handles the 'sig-with-array-len-prop' signal" do
970
- skip unless get_signal_introspection_data "Regress", "TestObj", "sig-with-array-len-prop"
1027
+ skip unless get_signal_introspection_data 'Regress', 'TestObj', 'sig-with-array-len-prop'
971
1028
 
972
1029
  a = nil
973
1030
 
974
- GObject.signal_connect(instance, "sig-with-array-len-prop") do |obj, arr, user_data|
1031
+ GObject.signal_connect(instance, 'sig-with-array-len-prop') do |_obj, arr, _user_data|
975
1032
  a = arr
976
1033
  end
977
1034
 
978
1035
  arr = GirFFI::InPointer.from_array(:uint, [1, 2, 3])
979
- GObject.signal_emit instance, "sig-with-array-len-prop", arr, 3
1036
+ GObject.signal_emit instance, 'sig-with-array-len-prop', arr, 3
980
1037
 
981
1038
  a.to_a.must_equal [1, 2, 3]
982
1039
  end
983
1040
 
984
1041
  it "handles the 'sig-with-array-prop' signal" do
985
1042
  a = nil
986
- GObject.signal_connect(instance, "sig-with-array-prop") {|_, arr, _| a = arr }
987
- GObject.signal_emit instance, "sig-with-array-prop",
1043
+ GObject.signal_connect(instance, 'sig-with-array-prop') { |_, arr, _| a = arr }
1044
+ GObject.signal_emit instance, 'sig-with-array-prop',
988
1045
  GLib::Array.from(:uint, [1, 2, 3])
989
1046
  a.to_a.must_equal [1, 2, 3]
990
1047
  end
991
1048
 
992
1049
  it "handles the 'sig-with-foreign-struct' signal" do
993
- skip unless get_signal_introspection_data "Regress", "TestObj", "sig-with-foreign-struct"
1050
+ skip unless get_signal_introspection_data 'Regress', 'TestObj', 'sig-with-foreign-struct'
994
1051
 
995
1052
  a = nil
996
- instance.signal_connect "sig-with-foreign-struct" do |obj, ct|
1053
+ instance.signal_connect 'sig-with-foreign-struct' do |_obj, ct|
997
1054
  a = ct
998
1055
  end
999
1056
 
1000
1057
  cairo_context = Regress.test_cairo_context_full_return
1001
1058
 
1002
- GObject.signal_emit instance, "sig-with-foreign-struct", cairo_context
1059
+ GObject.signal_emit instance, 'sig-with-foreign-struct', cairo_context
1003
1060
 
1004
1061
  a.must_be_instance_of Cairo::Context
1005
1062
  a.must_equal cairo_context
@@ -1008,45 +1065,45 @@ describe Regress do
1008
1065
  it "handles the 'sig-with-hash-prop' signal" do
1009
1066
  a = nil
1010
1067
 
1011
- GObject.signal_connect(instance, "sig-with-hash-prop") do |_, ghash, _|
1068
+ GObject.signal_connect(instance, 'sig-with-hash-prop') do |_, ghash, _|
1012
1069
  a = ghash.to_hash
1013
1070
  end
1014
1071
 
1015
1072
  g_hash_table = GLib::HashTable.from([:utf8, GObject::Value],
1016
- {"foo" => GObject::Value.from("bar")})
1073
+ 'foo' => GObject::Value.from('bar'))
1017
1074
 
1018
- GObject.signal_emit instance, "sig-with-hash-prop", g_hash_table
1075
+ GObject.signal_emit instance, 'sig-with-hash-prop', g_hash_table
1019
1076
 
1020
- a["foo"].must_be_instance_of GObject::Value
1021
- a["foo"].get_value.must_equal "bar"
1077
+ a['foo'].must_be_instance_of GObject::Value
1078
+ a['foo'].get_value.must_equal 'bar'
1022
1079
  end
1023
1080
 
1024
1081
  it "handles the 'sig-with-int64-prop' signal" do
1025
- skip unless get_signal_introspection_data "Regress", "TestObj", "sig-with-int64-prop"
1082
+ skip unless get_signal_introspection_data 'Regress', 'TestObj', 'sig-with-int64-prop'
1026
1083
 
1027
1084
  a = nil
1028
1085
 
1029
- GObject.signal_connect(instance, "sig-with-int64-prop") do |obj, int64, user_data|
1086
+ GObject.signal_connect(instance, 'sig-with-int64-prop') do |_obj, int64, _user_data|
1030
1087
  a = int64
1031
1088
  end
1032
1089
 
1033
- result = GObject.signal_emit instance, "sig-with-int64-prop", 0x7fff_ffff_ffff_ffff
1090
+ result = GObject.signal_emit instance, 'sig-with-int64-prop', 0x7fff_ffff_ffff_ffff
1034
1091
 
1035
1092
  a.must_equal 0x7fff_ffff_ffff_ffff
1036
1093
  result.get_value.must_equal 0x7fff_ffff_ffff_ffff
1037
1094
  end
1038
1095
 
1039
1096
  it "handles the 'sig-with-intarray-ret' signal" do
1040
- skip unless get_signal_introspection_data "Regress", "TestObj", "sig-with-intarray-ret"
1097
+ skip unless get_signal_introspection_data 'Regress', 'TestObj', 'sig-with-intarray-ret'
1041
1098
 
1042
1099
  a = nil
1043
1100
 
1044
- GObject.signal_connect(instance, "sig-with-intarray-ret") do |_, i, _|
1101
+ GObject.signal_connect(instance, 'sig-with-intarray-ret') do |_, i, _|
1045
1102
  a = i
1046
1103
  [3, 2, 1]
1047
1104
  end
1048
1105
 
1049
- result = GObject.signal_emit instance, "sig-with-intarray-ret", 3
1106
+ result = GObject.signal_emit instance, 'sig-with-intarray-ret', 3
1050
1107
 
1051
1108
  a.must_equal 3
1052
1109
 
@@ -1057,12 +1114,12 @@ describe Regress do
1057
1114
  it "handles the 'sig-with-obj' signal" do
1058
1115
  a = nil
1059
1116
 
1060
- GObject.signal_connect(instance, "sig-with-obj") do |_, obj, _|
1117
+ GObject.signal_connect(instance, 'sig-with-obj') do |_, obj, _|
1061
1118
  a = obj
1062
1119
  end
1063
1120
 
1064
1121
  object = Regress::TestObj.constructor
1065
- GObject.signal_emit instance, "sig-with-obj", object
1122
+ GObject.signal_emit instance, 'sig-with-obj', object
1066
1123
 
1067
1124
  a.must_equal object
1068
1125
  end
@@ -1070,25 +1127,25 @@ describe Regress do
1070
1127
  it "handles the 'sig-with-strv' signal" do
1071
1128
  a = nil
1072
1129
 
1073
- GObject.signal_connect(instance, "sig-with-strv") do |_, strs, _|
1130
+ GObject.signal_connect(instance, 'sig-with-strv') do |_, strs, _|
1074
1131
  a = strs
1075
1132
  end
1076
1133
 
1077
- GObject.signal_emit instance, "sig-with-strv", GLib::Strv.from(["foo", "bar"])
1134
+ GObject.signal_emit instance, 'sig-with-strv', GLib::Strv.from(%w(foo bar))
1078
1135
 
1079
- a.to_a.must_equal ["foo", "bar"]
1136
+ a.to_a.must_equal %w(foo bar)
1080
1137
  end
1081
1138
 
1082
1139
  it "handles the 'sig-with-uint64-prop' signal" do
1083
- skip unless get_signal_introspection_data "Regress", "TestObj", "sig-with-uint64-prop"
1140
+ skip unless get_signal_introspection_data 'Regress', 'TestObj', 'sig-with-uint64-prop'
1084
1141
 
1085
1142
  a = nil
1086
1143
 
1087
- GObject.signal_connect(instance, "sig-with-uint64-prop") do |_, uint64, _|
1144
+ GObject.signal_connect(instance, 'sig-with-uint64-prop') do |_, uint64, _|
1088
1145
  a = uint64
1089
1146
  end
1090
1147
 
1091
- result = GObject.signal_emit instance, "sig-with-uint64-prop", 0xffff_ffff_ffff_ffff
1148
+ result = GObject.signal_emit instance, 'sig-with-uint64-prop', 0xffff_ffff_ffff_ffff
1092
1149
 
1093
1150
  a.must_equal 0xffff_ffff_ffff_ffff
1094
1151
  result.get_value.must_equal 0xffff_ffff_ffff_ffff
@@ -1097,140 +1154,140 @@ describe Regress do
1097
1154
  it "handles the 'test' signal" do
1098
1155
  a = b = nil
1099
1156
  o = Regress::TestSubObj.new
1100
- GObject.signal_connect(o, "test", 2) { |i, d| a = d; b = i }
1101
- GObject.signal_emit o, "test"
1157
+ GObject.signal_connect(o, 'test', 2) { |i, d| a = d; b = i }
1158
+ GObject.signal_emit o, 'test'
1102
1159
  assert_equal [2, o], [a, b]
1103
1160
  end
1104
1161
 
1105
1162
  it "handles the 'test-with-static-scope-arg' signal" do
1106
1163
  a = nil
1107
1164
 
1108
- GObject.signal_connect(instance, "test-with-static-scope-arg") do |_, obj, _|
1165
+ GObject.signal_connect(instance, 'test-with-static-scope-arg') do |_, obj, _|
1109
1166
  a = obj
1110
1167
  end
1111
1168
 
1112
1169
  arg = Regress::TestSimpleBoxedA.new
1113
- arg.some_int = 12345
1114
- GObject.signal_emit instance, "test-with-static-scope-arg", arg
1170
+ arg.some_int = 12_345
1171
+ GObject.signal_emit instance, 'test-with-static-scope-arg', arg
1115
1172
 
1116
- a.some_int.must_equal 12345
1173
+ a.some_int.must_equal 12_345
1117
1174
  end
1118
1175
  end
1119
1176
 
1120
- describe "Regress::TestOtherError" do
1177
+ describe 'Regress::TestOtherError' do
1121
1178
  before do
1122
1179
  skip unless get_introspection_data 'Regress', 'TestOtherError'
1123
1180
  end
1124
1181
 
1125
- it "has the member :code1" do
1182
+ it 'has the member :code1' do
1126
1183
  Regress::TestOtherError[:code1].must_equal 1
1127
1184
  end
1128
1185
 
1129
- it "has the member :code2" do
1186
+ it 'has the member :code2' do
1130
1187
  Regress::TestOtherError[:code2].must_equal 2
1131
1188
  end
1132
1189
 
1133
- it "has the member :code3" do
1190
+ it 'has the member :code3' do
1134
1191
  Regress::TestOtherError[:code3].must_equal 3
1135
1192
  end
1136
1193
 
1137
- it "has a working function #quark" do
1194
+ it 'has a working function #quark' do
1138
1195
  quark = Regress::TestOtherError.quark
1139
- GLib.quark_to_string(quark).must_equal "regress-test-other-error"
1196
+ GLib.quark_to_string(quark).must_equal 'regress-test-other-error'
1140
1197
  end
1141
1198
  end
1142
1199
 
1143
- describe "Regress::TestPrivateEnum" do
1144
- it "has the member :public_enum_before" do
1200
+ describe 'Regress::TestPrivateEnum' do
1201
+ it 'has the member :public_enum_before' do
1145
1202
  Regress::TestPrivateEnum[:public_enum_before].must_equal 1
1146
1203
  end
1147
- it "does not have the member :private" do
1204
+ it 'does not have the member :private' do
1148
1205
  Regress::TestPrivateEnum[:private].must_equal nil
1149
1206
  end
1150
- it "has the member :public_enum_after" do
1207
+ it 'has the member :public_enum_after' do
1151
1208
  Regress::TestPrivateEnum[:public_enum_after].must_equal 4
1152
1209
  end
1153
1210
  end
1154
1211
 
1155
- describe "Regress::TestPrivateStruct" do
1212
+ describe 'Regress::TestPrivateStruct' do
1156
1213
  let(:instance) { Regress::TestPrivateStruct.new }
1157
1214
 
1158
- it "has a writable field this_is_public_before" do
1215
+ it 'has a writable field this_is_public_before' do
1159
1216
  instance.this_is_public_before.must_equal 0
1160
1217
  instance.this_is_public_before = 42
1161
1218
  instance.this_is_public_before.must_equal 42
1162
1219
  end
1163
1220
 
1164
- it "has a private field this_is_private" do
1165
- skip "This field is identified as readable in the typelib"
1221
+ it 'has a private field this_is_private' do
1222
+ skip 'This field is identified as readable in the typelib'
1166
1223
  proc { instance.this_is_private }.must_raise NoMethodError
1167
1224
  proc { instance.this_is_private = 42 }.must_raise NoMethodError
1168
1225
  end
1169
1226
 
1170
- it "has a writable field this_is_public_after" do
1227
+ it 'has a writable field this_is_public_after' do
1171
1228
  instance.this_is_public_after.must_equal 0
1172
1229
  instance.this_is_public_after = 42
1173
1230
  instance.this_is_public_after.must_equal 42
1174
1231
  end
1175
1232
  end
1176
1233
 
1177
- describe "Regress::TestReferenceEnum" do
1234
+ describe 'Regress::TestReferenceEnum' do
1178
1235
  before do
1179
1236
  skip unless get_introspection_data 'Regress', 'TestReferenceEnum'
1180
1237
  end
1181
- it "has the member :0" do
1238
+ it 'has the member :0' do
1182
1239
  Regress::TestReferenceEnum[:"0"].must_equal 4
1183
1240
  end
1184
- it "has the member :1" do
1241
+ it 'has the member :1' do
1185
1242
  Regress::TestReferenceEnum[:"1"].must_equal 2
1186
1243
  end
1187
- it "has the member :2" do
1244
+ it 'has the member :2' do
1188
1245
  Regress::TestReferenceEnum[:"2"].must_equal 54
1189
1246
  end
1190
- it "has the member :3" do
1247
+ it 'has the member :3' do
1191
1248
  Regress::TestReferenceEnum[:"3"].must_equal 4
1192
1249
  end
1193
- it "has the member :4" do
1250
+ it 'has the member :4' do
1194
1251
  Regress::TestReferenceEnum[:"4"].must_equal 216
1195
1252
  end
1196
- it "has the member :5" do
1253
+ it 'has the member :5' do
1197
1254
  Regress::TestReferenceEnum[:"5"].must_equal(-217)
1198
1255
  end
1199
1256
  end
1200
1257
 
1201
- describe "Regress::TestSimpleBoxedA" do
1202
- it "creates an instance using #new" do
1258
+ describe 'Regress::TestSimpleBoxedA' do
1259
+ it 'creates an instance using #new' do
1203
1260
  obj = Regress::TestSimpleBoxedA.new
1204
1261
  assert_instance_of Regress::TestSimpleBoxedA, obj
1205
1262
  end
1206
1263
 
1207
1264
  let(:instance) { Regress::TestSimpleBoxedA.new }
1208
1265
 
1209
- it "has a writable field some_int" do
1266
+ it 'has a writable field some_int' do
1210
1267
  instance.some_int.must_equal 0
1211
1268
  instance.some_int = 42
1212
1269
  instance.some_int.must_equal 42
1213
1270
  end
1214
1271
 
1215
- it "has a writable field some_int8" do
1272
+ it 'has a writable field some_int8' do
1216
1273
  instance.some_int8.must_equal 0
1217
1274
  instance.some_int8 = 42
1218
1275
  instance.some_int8.must_equal 42
1219
1276
  end
1220
1277
 
1221
- it "has a writable field some_double" do
1278
+ it 'has a writable field some_double' do
1222
1279
  instance.some_double.must_equal 0.0
1223
1280
  instance.some_double = 42.0
1224
1281
  instance.some_double.must_equal 42.0
1225
1282
  end
1226
1283
 
1227
- it "has a writable field some_enum" do
1284
+ it 'has a writable field some_enum' do
1228
1285
  instance.some_enum.must_equal :value1
1229
1286
  instance.some_enum = :value4
1230
1287
  instance.some_enum.must_equal :value4
1231
1288
  end
1232
1289
 
1233
- it "has a working method #copy" do
1290
+ it 'has a working method #copy' do
1234
1291
  instance.some_int = 4236
1235
1292
 
1236
1293
  obj2 = instance.copy
@@ -1241,7 +1298,7 @@ describe Regress do
1241
1298
  obj2.some_int.wont_equal instance.some_int
1242
1299
  end
1243
1300
 
1244
- it "has a working method #equals" do
1301
+ it 'has a working method #equals' do
1245
1302
  instance.some_int = 4236
1246
1303
 
1247
1304
  ob2 = Regress::TestSimpleBoxedA.new
@@ -1253,27 +1310,27 @@ describe Regress do
1253
1310
  ob2.equals(instance).wont_equal true
1254
1311
  end
1255
1312
 
1256
- it "has a working function #const_return" do
1313
+ it 'has a working function #const_return' do
1257
1314
  result = Regress::TestSimpleBoxedA.const_return
1258
1315
  [result.some_int, result.some_int8, result.some_double].must_equal [5, 6, 7.0]
1259
1316
  end
1260
1317
  end
1261
1318
 
1262
- describe "Regress::TestSimpleBoxedB" do
1319
+ describe 'Regress::TestSimpleBoxedB' do
1263
1320
  let(:instance) { Regress::TestSimpleBoxedB.new }
1264
- it "has a writable field some_int8" do
1321
+ it 'has a writable field some_int8' do
1265
1322
  instance.some_int8.must_equal 0
1266
1323
  instance.some_int8 = 42
1267
1324
  instance.some_int8.must_equal 42
1268
1325
  end
1269
1326
 
1270
- it "has a writable field nested_a" do
1327
+ it 'has a writable field nested_a' do
1271
1328
  instance.nested_a.some_int.must_equal 0
1272
1329
  instance.nested_a = Regress::TestSimpleBoxedA.const_return
1273
1330
  instance.nested_a.some_int.must_equal 5
1274
1331
  end
1275
1332
 
1276
- it "has a working method #copy" do
1333
+ it 'has a working method #copy' do
1277
1334
  instance.some_int8 = -42
1278
1335
  instance.nested_a.some_int = 4242
1279
1336
 
@@ -1285,33 +1342,33 @@ describe Regress do
1285
1342
  end
1286
1343
  end
1287
1344
 
1288
- describe "Regress::TestStructA" do
1345
+ describe 'Regress::TestStructA' do
1289
1346
  let(:instance) { Regress::TestStructA.new }
1290
- it "has a writable field some_int" do
1347
+ it 'has a writable field some_int' do
1291
1348
  instance.some_int.must_equal 0
1292
1349
  instance.some_int = 2556
1293
1350
  instance.some_int.must_equal 2556
1294
1351
  end
1295
1352
 
1296
- it "has a writable field some_int8" do
1353
+ it 'has a writable field some_int8' do
1297
1354
  instance.some_int8.must_equal 0
1298
1355
  instance.some_int8 = -10
1299
1356
  instance.some_int8.must_equal(-10)
1300
1357
  end
1301
1358
 
1302
- it "has a writable field some_double" do
1359
+ it 'has a writable field some_double' do
1303
1360
  instance.some_double.must_equal 0.0
1304
1361
  instance.some_double = 1.03455e20
1305
1362
  instance.some_double.must_equal 1.03455e20
1306
1363
  end
1307
1364
 
1308
- it "has a writable field some_enum" do
1365
+ it 'has a writable field some_enum' do
1309
1366
  instance.some_enum.must_equal :value1
1310
1367
  instance.some_enum = :value2
1311
1368
  instance.some_enum.must_equal :value2
1312
1369
  end
1313
1370
 
1314
- it "has a working method #clone" do
1371
+ it 'has a working method #clone' do
1315
1372
  a = Regress::TestStructA.new
1316
1373
  a.some_int = 2556
1317
1374
  a.some_int8 = -10
@@ -1326,22 +1383,22 @@ describe Regress do
1326
1383
  assert_equal :value2, b.some_enum
1327
1384
  end
1328
1385
 
1329
- it "has a working function #parse" do
1386
+ it 'has a working function #parse' do
1330
1387
  skip unless get_method_introspection_data 'Regress', 'TestStructA', 'parse'
1331
- a = Regress::TestStructA.parse("this string is actually ignored")
1388
+ a = Regress::TestStructA.parse('this string is actually ignored')
1332
1389
  a.some_int.must_equal 23
1333
1390
  end
1334
1391
  end
1335
1392
 
1336
- describe "Regress::TestStructB" do
1393
+ describe 'Regress::TestStructB' do
1337
1394
  let(:instance) { Regress::TestStructB.new }
1338
- it "has a writable field some_int8" do
1395
+ it 'has a writable field some_int8' do
1339
1396
  instance.some_int8.must_equal 0
1340
1397
  instance.some_int8 = 42
1341
1398
  instance.some_int8.must_equal 42
1342
1399
  end
1343
1400
 
1344
- it "has a writable field nested_a" do
1401
+ it 'has a writable field nested_a' do
1345
1402
  instance.nested_a.some_int.must_equal 0
1346
1403
 
1347
1404
  nested = Regress::TestStructA.new
@@ -1351,7 +1408,7 @@ describe Regress do
1351
1408
  instance.nested_a.some_int.must_equal(-4321)
1352
1409
  end
1353
1410
 
1354
- it "has a working method #clone" do
1411
+ it 'has a working method #clone' do
1355
1412
  a = Regress::TestStructB.new
1356
1413
  a.some_int8 = 42
1357
1414
  a.nested_a.some_int = 2556
@@ -1369,15 +1426,15 @@ describe Regress do
1369
1426
  end
1370
1427
  end
1371
1428
 
1372
- describe "Regress::TestStructC" do
1429
+ describe 'Regress::TestStructC' do
1373
1430
  let(:instance) { Regress::TestStructC.new }
1374
- it "has a writable field another_int" do
1431
+ it 'has a writable field another_int' do
1375
1432
  instance.another_int.must_equal 0
1376
1433
  instance.another_int = 42
1377
1434
  instance.another_int.must_equal 42
1378
1435
  end
1379
1436
 
1380
- it "has a writable field obj" do
1437
+ it 'has a writable field obj' do
1381
1438
  o = Regress::TestSubObj.new
1382
1439
  instance.obj.must_equal nil
1383
1440
  instance.obj = o
@@ -1385,37 +1442,37 @@ describe Regress do
1385
1442
  end
1386
1443
  end
1387
1444
 
1388
- describe "Regress::TestStructD" do
1445
+ describe 'Regress::TestStructD' do
1389
1446
  let(:instance) { Regress::TestStructD.new }
1390
- it "has a writable field array1" do
1447
+ it 'has a writable field array1' do
1391
1448
  instance.array1.must_be :==, []
1392
1449
  struct = Regress::TestStructA.new
1393
1450
  instance.array1 = [struct]
1394
1451
  instance.array1.must_be :==, [struct]
1395
1452
  end
1396
1453
 
1397
- it "has a writable field array2" do
1454
+ it 'has a writable field array2' do
1398
1455
  instance.array2.must_be :==, []
1399
1456
  o = Regress::TestSubObj.new
1400
1457
  instance.array2 = [o]
1401
1458
  instance.array2.must_be :==, [o]
1402
1459
  end
1403
1460
 
1404
- it "has a writable field field" do
1461
+ it 'has a writable field field' do
1405
1462
  instance.field.must_equal nil
1406
1463
  o = Regress::TestSubObj.new
1407
1464
  instance.field = o
1408
1465
  instance.field.must_equal o
1409
1466
  end
1410
1467
 
1411
- it "has a writable field list" do
1468
+ it 'has a writable field list' do
1412
1469
  instance.list.must_be_nil
1413
1470
  o = Regress::TestSubObj.new
1414
1471
  instance.list = [o]
1415
1472
  instance.list.must_be :==, [o]
1416
1473
  end
1417
1474
 
1418
- it "has a writable field garray" do
1475
+ it 'has a writable field garray' do
1419
1476
  instance.garray.must_be_nil
1420
1477
  o = Regress::TestSubObj.new
1421
1478
  instance.garray = [o]
@@ -1423,15 +1480,15 @@ describe Regress do
1423
1480
  end
1424
1481
  end
1425
1482
 
1426
- describe "Regress::TestStructE" do
1483
+ describe 'Regress::TestStructE' do
1427
1484
  let(:instance) { Regress::TestStructE.new }
1428
- it "has a writable field some_type" do
1485
+ it 'has a writable field some_type' do
1429
1486
  instance.some_type.must_equal 0
1430
1487
  instance.some_type = GObject::TYPE_STRING
1431
1488
  instance.some_type.must_equal GObject::TYPE_STRING
1432
1489
  end
1433
1490
 
1434
- it "has a writable field some_union" do
1491
+ it 'has a writable field some_union' do
1435
1492
  instance.some_union.map(&:v_int).must_equal [0, 0]
1436
1493
 
1437
1494
  union1 = Regress::TestStructE__some_union__union.new
@@ -1444,161 +1501,161 @@ describe Regress do
1444
1501
  instance.some_union.map(&:v_int).must_equal [42, 84]
1445
1502
  end
1446
1503
  end
1447
- describe "Regress::TestStructE__some_union__union" do
1504
+ describe 'Regress::TestStructE__some_union__union' do
1448
1505
  let(:instance) { Regress::TestStructE__some_union__union.new }
1449
- it "has a writable field v_int" do
1506
+ it 'has a writable field v_int' do
1450
1507
  instance.v_int.must_equal 0
1451
- instance.v_int = -54321
1452
- instance.v_int.must_equal(-54321)
1508
+ instance.v_int = -54_321
1509
+ instance.v_int.must_equal(-54_321)
1453
1510
  end
1454
1511
 
1455
- it "has a writable field v_uint" do
1512
+ it 'has a writable field v_uint' do
1456
1513
  instance.v_uint.must_equal 0
1457
- instance.v_uint = 54321
1458
- instance.v_uint.must_equal 54321
1514
+ instance.v_uint = 54_321
1515
+ instance.v_uint.must_equal 54_321
1459
1516
  end
1460
1517
 
1461
- it "has a writable field v_long" do
1518
+ it 'has a writable field v_long' do
1462
1519
  instance.v_long.must_equal 0
1463
- instance.v_long = -54321
1464
- instance.v_long.must_equal(-54321)
1520
+ instance.v_long = -54_321
1521
+ instance.v_long.must_equal(-54_321)
1465
1522
  end
1466
1523
 
1467
- it "has a writable field v_ulong" do
1524
+ it 'has a writable field v_ulong' do
1468
1525
  instance.v_long.must_equal 0
1469
- instance.v_long = 54321
1470
- instance.v_long.must_equal 54321
1526
+ instance.v_long = 54_321
1527
+ instance.v_long.must_equal 54_321
1471
1528
  end
1472
1529
 
1473
- it "has a writable field v_int64" do
1530
+ it 'has a writable field v_int64' do
1474
1531
  instance.v_int64.must_equal 0
1475
1532
  instance.v_int64 = -54_321_000_000_000
1476
1533
  instance.v_int64.must_equal(-54_321_000_000_000)
1477
1534
  end
1478
- it "has a writable field v_uint64" do
1535
+ it 'has a writable field v_uint64' do
1479
1536
  instance.v_uint64.must_equal 0
1480
1537
  instance.v_uint64 = 54_321_000_000_000
1481
1538
  instance.v_uint64.must_equal 54_321_000_000_000
1482
1539
  end
1483
- it "has a writable field v_float" do
1540
+ it 'has a writable field v_float' do
1484
1541
  instance.v_float.must_equal 0
1485
1542
  instance.v_float = 3.1415
1486
1543
  instance.v_float.must_be_close_to 3.1415
1487
1544
  end
1488
- it "has a writable field v_double" do
1545
+ it 'has a writable field v_double' do
1489
1546
  instance.v_double.must_equal 0
1490
1547
  instance.v_double = 3.1415
1491
1548
  instance.v_double.must_equal 3.1415
1492
1549
  end
1493
- it "has a writable field v_pointer" do
1550
+ it 'has a writable field v_pointer' do
1494
1551
  instance.v_pointer.must_be :null?
1495
- instance.v_pointer = FFI::Pointer.new 54321
1496
- instance.v_pointer.address.must_equal 54321
1552
+ instance.v_pointer = FFI::Pointer.new 54_321
1553
+ instance.v_pointer.address.must_equal 54_321
1497
1554
  end
1498
1555
  end
1499
- describe "Regress::TestStructF" do
1556
+ describe 'Regress::TestStructF' do
1500
1557
  before do
1501
1558
  skip unless get_introspection_data 'Regress', 'TestStructF'
1502
1559
  end
1503
1560
 
1504
1561
  let(:instance) { Regress::TestStructF.new }
1505
1562
 
1506
- it "has a writable field ref_count" do
1563
+ it 'has a writable field ref_count' do
1507
1564
  instance.ref_count.must_equal 0
1508
1565
  instance.ref_count = 1
1509
1566
  instance.ref_count.must_equal 1
1510
1567
  end
1511
1568
 
1512
- it "has a writable field data1" do
1569
+ it 'has a writable field data1' do
1513
1570
  instance.data1.must_be :null?
1514
1571
  instance.data1 = GirFFI::InOutPointer.from(:gint32, 42)
1515
1572
  instance.data1.read_int.must_equal 42
1516
1573
  end
1517
1574
 
1518
1575
  # TODO: Check what gobject-introspection should/will do with these fields.
1519
- it "has a writable field data2" do
1520
- skip "Introspection data cannot deal with type of this field yet"
1576
+ it 'has a writable field data2' do
1577
+ skip 'Introspection data cannot deal with type of this field yet'
1521
1578
  end
1522
1579
 
1523
- it "has a writable field data3" do
1524
- skip "Introspection data cannot deal with type of this field yet"
1580
+ it 'has a writable field data3' do
1581
+ skip 'Introspection data cannot deal with type of this field yet'
1525
1582
  end
1526
1583
 
1527
- it "has a writable field data4" do
1528
- skip "Introspection data cannot deal with type of this field yet"
1584
+ it 'has a writable field data4' do
1585
+ skip 'Introspection data cannot deal with type of this field yet'
1529
1586
  end
1530
1587
 
1531
- it "has a writable field data5" do
1532
- skip "Introspection data cannot deal with type of this field yet"
1588
+ it 'has a writable field data5' do
1589
+ skip 'Introspection data cannot deal with type of this field yet'
1533
1590
  end
1534
1591
 
1535
- it "has a writable field data6" do
1536
- skip "Introspection data cannot deal with type of this field yet"
1592
+ it 'has a writable field data6' do
1593
+ skip 'Introspection data cannot deal with type of this field yet'
1537
1594
  end
1538
1595
  end
1539
1596
 
1540
- describe "Regress::TestStructFixedArray" do
1597
+ describe 'Regress::TestStructFixedArray' do
1541
1598
  let(:instance) { Regress::TestStructFixedArray.new }
1542
- it "has a writable field just_int" do
1599
+ it 'has a writable field just_int' do
1543
1600
  instance.just_int.must_equal 0
1544
1601
  instance.just_int = 42
1545
1602
  instance.just_int.must_equal 42
1546
1603
  end
1547
1604
 
1548
- it "has a writable field array" do
1605
+ it 'has a writable field array' do
1549
1606
  instance.array.must_be :==, [0] * 10
1550
1607
  instance.array = (1..10).to_a
1551
1608
  instance.array.must_be :==, (1..10).to_a
1552
1609
  end
1553
1610
 
1554
- it "has a working method #frob" do
1611
+ it 'has a working method #frob' do
1555
1612
  instance.array = (0..9).to_a
1556
1613
  instance.frob
1557
- instance.array.must_be :==, (42..42+9).to_a
1614
+ instance.array.must_be :==, (42..42 + 9).to_a
1558
1615
  instance.just_int.must_equal 7
1559
1616
  end
1560
1617
  end
1561
1618
 
1562
- describe "Regress::TestSubObj" do
1563
- it "creates an instance using #new" do
1619
+ describe 'Regress::TestSubObj' do
1620
+ it 'creates an instance using #new' do
1564
1621
  tso = Regress::TestSubObj.new
1565
1622
  assert_instance_of Regress::TestSubObj, tso
1566
1623
  end
1567
1624
 
1568
1625
  let(:instance) { Regress::TestSubObj.new }
1569
1626
 
1570
- it "has a working method #instance_method" do
1627
+ it 'has a working method #instance_method' do
1571
1628
  res = instance.instance_method
1572
1629
  assert_equal 0, res
1573
1630
  end
1574
1631
 
1575
- it "has a working method #unset_bare" do
1632
+ it 'has a working method #unset_bare' do
1576
1633
  instance.unset_bare
1577
1634
  pass
1578
1635
  end
1579
1636
 
1580
- it "does not have a field parent_instance" do
1637
+ it 'does not have a field parent_instance' do
1581
1638
  assert_raises(NoMethodError) { instance.parent_instance }
1582
1639
  end
1583
1640
  end
1584
1641
 
1585
- describe "Regress::TestWi8021x" do
1586
- it "creates an instance using #new" do
1642
+ describe 'Regress::TestWi8021x' do
1643
+ it 'creates an instance using #new' do
1587
1644
  o = Regress::TestWi8021x.new
1588
1645
  assert_instance_of Regress::TestWi8021x, o
1589
1646
  end
1590
1647
 
1591
- it "has a working function #static_method" do
1648
+ it 'has a working function #static_method' do
1592
1649
  assert_equal(-84, Regress::TestWi8021x.static_method(-42))
1593
1650
  end
1594
1651
 
1595
1652
  let(:instance) { Regress::TestWi8021x.new }
1596
1653
 
1597
- it "has a working method #get_testbool" do
1654
+ it 'has a working method #get_testbool' do
1598
1655
  instance.get_testbool.must_equal true
1599
1656
  end
1600
1657
 
1601
- it "has a working method #set_testbool" do
1658
+ it 'has a working method #set_testbool' do
1602
1659
  instance.set_testbool true
1603
1660
  instance.get_testbool.must_equal true
1604
1661
  instance.set_testbool false
@@ -1606,89 +1663,89 @@ describe Regress do
1606
1663
  end
1607
1664
 
1608
1665
  describe "its 'testbool' property" do
1609
- it "can be retrieved with #get_property" do
1610
- instance.get_property("testbool").get_value.must_equal true
1666
+ it 'can be retrieved with #get_property' do
1667
+ instance.get_property('testbool').get_value.must_equal true
1611
1668
  end
1612
1669
 
1613
- it "can be retrieved with #testbool" do
1670
+ it 'can be retrieved with #testbool' do
1614
1671
  instance.testbool.must_equal true
1615
1672
  end
1616
1673
 
1617
- it "can be set with #set_property" do
1618
- instance.set_property "testbool", true
1674
+ it 'can be set with #set_property' do
1675
+ instance.set_property 'testbool', true
1619
1676
  instance.get_testbool.must_equal true
1620
- instance.get_property("testbool").get_value.must_equal true
1677
+ instance.get_property('testbool').get_value.must_equal true
1621
1678
 
1622
- instance.set_property "testbool", false
1679
+ instance.set_property 'testbool', false
1623
1680
  instance.get_testbool.must_equal false
1624
- instance.get_property("testbool").get_value.must_equal false
1681
+ instance.get_property('testbool').get_value.must_equal false
1625
1682
  end
1626
1683
 
1627
- it "can be set with #testbool=" do
1684
+ it 'can be set with #testbool=' do
1628
1685
  instance.testbool = true
1629
1686
  instance.testbool.must_equal true
1630
1687
  instance.get_testbool.must_equal true
1631
- instance.get_property("testbool").get_value.must_equal true
1688
+ instance.get_property('testbool').get_value.must_equal true
1632
1689
 
1633
1690
  instance.testbool = false
1634
1691
  instance.testbool.must_equal false
1635
1692
  instance.get_testbool.must_equal false
1636
- instance.get_property("testbool").get_value.must_equal false
1693
+ instance.get_property('testbool').get_value.must_equal false
1637
1694
  end
1638
1695
  end
1639
1696
  end
1640
1697
 
1641
- it "has the constant UTF8_CONSTANT" do
1642
- assert_equal "const ♥ utf8", Regress::UTF8_CONSTANT
1698
+ it 'has the constant UTF8_CONSTANT' do
1699
+ assert_equal 'const ♥ utf8', Regress::UTF8_CONSTANT
1643
1700
  end
1644
1701
 
1645
- it "has a working function #aliased_caller_alloc" do
1702
+ it 'has a working function #aliased_caller_alloc' do
1646
1703
  result = Regress.aliased_caller_alloc
1647
1704
  result.must_be_instance_of Regress::TestBoxed
1648
1705
  end
1649
1706
 
1650
- it "has a working function #atest_error_quark" do
1707
+ it 'has a working function #atest_error_quark' do
1651
1708
  skip unless get_introspection_data 'Regress', 'atest_error_quark'
1652
1709
  result = Regress.atest_error_quark
1653
- GLib.quark_to_string(result).must_equal "regress-atest-error"
1710
+ GLib.quark_to_string(result).must_equal 'regress-atest-error'
1654
1711
  end
1655
1712
 
1656
- it "has a working function #func_obj_null_in" do
1713
+ it 'has a working function #func_obj_null_in' do
1657
1714
  Regress.func_obj_null_in nil
1658
1715
  Regress.func_obj_null_in Regress::TestObj.constructor
1659
1716
  pass
1660
1717
  end
1661
1718
 
1662
- it "has a working function #global_get_flags_out" do
1719
+ it 'has a working function #global_get_flags_out' do
1663
1720
  result = Regress.global_get_flags_out
1664
1721
  result.must_equal Regress::TestFlags[:flag1] | Regress::TestFlags[:flag3]
1665
1722
  end
1666
1723
 
1667
- it "has a working function #has_parameter_named_attrs" do
1724
+ it 'has a working function #has_parameter_named_attrs' do
1668
1725
  skip unless get_introspection_data 'Regress', 'has_parameter_named_attrs'
1669
1726
  Regress.has_parameter_named_attrs 42, [23] * 32
1670
1727
  pass
1671
1728
  end
1672
1729
 
1673
- it "has a working function #introspectable_via_alias" do
1730
+ it 'has a working function #introspectable_via_alias' do
1674
1731
  Regress.introspectable_via_alias []
1675
1732
  pass
1676
1733
  end
1677
1734
 
1678
- it "has a working function #set_abort_on_error" do
1735
+ it 'has a working function #set_abort_on_error' do
1679
1736
  Regress.set_abort_on_error false
1680
1737
  Regress.set_abort_on_error true
1681
1738
  pass
1682
1739
  end
1683
1740
 
1684
- it "has a working function #test_abc_error_quark" do
1741
+ it 'has a working function #test_abc_error_quark' do
1685
1742
  skip unless get_introspection_data 'Regress', 'test_abc_error_quark'
1686
1743
 
1687
1744
  quark = Regress.test_abc_error_quark
1688
- GLib.quark_to_string(quark).must_equal "regress-test-abc-error"
1745
+ GLib.quark_to_string(quark).must_equal 'regress-test-abc-error'
1689
1746
  end
1690
1747
 
1691
- it "has a working function #test_array_callback" do
1748
+ it 'has a working function #test_array_callback' do
1692
1749
  a = nil
1693
1750
  b = nil
1694
1751
  c = 95
@@ -1703,10 +1760,10 @@ describe Regress do
1703
1760
 
1704
1761
  result.must_equal 2 * c
1705
1762
  a.to_a.must_equal [-1, 0, 1, 2]
1706
- b.to_a.must_equal ["one", "two", "three"]
1763
+ b.to_a.must_equal %w(one two three)
1707
1764
  end
1708
1765
 
1709
- it "has a working function #test_array_fixed_out_objects" do
1766
+ it 'has a working function #test_array_fixed_out_objects' do
1710
1767
  result = Regress.test_array_fixed_out_objects
1711
1768
  gtype = Regress::TestObj.get_gtype
1712
1769
 
@@ -1718,82 +1775,92 @@ describe Regress do
1718
1775
  }
1719
1776
  end
1720
1777
 
1721
- it "has a working function #test_array_fixed_size_int_in" do
1778
+ it 'has a working function #test_array_fixed_size_int_in' do
1722
1779
  assert_equal 5 + 4 + 3 + 2 + 1, Regress.test_array_fixed_size_int_in([5, 4, 3, 2, 1])
1723
1780
  end
1724
1781
 
1725
- describe "#test_array_fixed_size_int_in" do
1726
- it "raises an error when called with the wrong number of arguments" do
1782
+ describe '#test_array_fixed_size_int_in' do
1783
+ it 'raises an error when called with the wrong number of arguments' do
1727
1784
  assert_raises ArgumentError do
1728
1785
  Regress.test_array_fixed_size_int_in [2]
1729
1786
  end
1730
1787
  end
1731
1788
  end
1732
1789
 
1733
- it "has a working function #test_array_fixed_size_int_out" do
1790
+ it 'has a working function #test_array_fixed_size_int_out' do
1734
1791
  Regress.test_array_fixed_size_int_out.must_be :==, [0, 1, 2, 3, 4]
1735
1792
  end
1736
1793
 
1737
- it "has a working function #test_array_fixed_size_int_return" do
1794
+ it 'has a working function #test_array_fixed_size_int_return' do
1738
1795
  Regress.test_array_fixed_size_int_return.must_be :==, [0, 1, 2, 3, 4]
1739
1796
  end
1740
1797
 
1741
- it "has a working function #test_array_gint16_in" do
1798
+ it 'has a working function #test_array_gint16_in' do
1742
1799
  assert_equal 5 + 4 + 3, Regress.test_array_gint16_in([5, 4, 3])
1743
1800
  end
1744
1801
 
1745
- it "has a working function #test_array_gint32_in" do
1802
+ it 'has a working function #test_array_gint32_in' do
1746
1803
  assert_equal 5 + 4 + 3, Regress.test_array_gint32_in([5, 4, 3])
1747
1804
  end
1748
1805
 
1749
- it "has a working function #test_array_gint64_in" do
1806
+ it 'has a working function #test_array_gint64_in' do
1750
1807
  assert_equal 5 + 4 + 3, Regress.test_array_gint64_in([5, 4, 3])
1751
1808
  end
1752
1809
 
1753
- it "has a working function #test_array_gint8_in" do
1810
+ it 'has a working function #test_array_gint8_in' do
1754
1811
  assert_equal 5 + 4 + 3, Regress.test_array_gint8_in([5, 4, 3])
1755
1812
  end
1756
1813
 
1757
- it "has a working function #test_array_gtype_in" do
1758
- t1 = GObject.type_from_name "gboolean"
1759
- t2 = GObject.type_from_name "gint64"
1760
- assert_equal "[gboolean,gint64,]", Regress.test_array_gtype_in([t1, t2])
1814
+ it 'has a working function #test_array_gtype_in' do
1815
+ t1 = GObject.type_from_name 'gboolean'
1816
+ t2 = GObject.type_from_name 'gint64'
1817
+ assert_equal '[gboolean,gint64,]', Regress.test_array_gtype_in([t1, t2])
1818
+ end
1819
+
1820
+ it 'has a working function #test_array_inout_callback' do
1821
+ skip unless get_introspection_data 'Regress', 'test_array_inout_callback'
1822
+ Regress.test_array_inout_callback proc { |ints|
1823
+ arr = ints.to_a
1824
+ arr.shift
1825
+ arr
1826
+ }
1827
+ pass
1761
1828
  end
1762
1829
 
1763
- it "has a working function #test_array_int_full_out" do
1830
+ it 'has a working function #test_array_int_full_out' do
1764
1831
  Regress.test_array_int_full_out.must_be :==, [0, 1, 2, 3, 4]
1765
1832
  end
1766
1833
 
1767
- it "has a working function #test_array_int_in" do
1834
+ it 'has a working function #test_array_int_in' do
1768
1835
  assert_equal 5 + 4 + 3, Regress.test_array_int_in([5, 4, 3])
1769
1836
  end
1770
1837
 
1771
- it "has a working function #test_array_int_inout" do
1838
+ it 'has a working function #test_array_int_inout' do
1772
1839
  Regress.test_array_int_inout([5, 2, 3]).must_be :==, [3, 4]
1773
1840
  end
1774
1841
 
1775
- it "has a working function #test_array_int_none_out" do
1842
+ it 'has a working function #test_array_int_none_out' do
1776
1843
  Regress.test_array_int_none_out.must_be :==, [1, 2, 3, 4, 5]
1777
1844
  end
1778
1845
 
1779
- it "has a working function #test_array_int_null_in" do
1846
+ it 'has a working function #test_array_int_null_in' do
1780
1847
  Regress.test_array_int_null_in nil
1781
1848
  pass
1782
1849
  end
1783
1850
 
1784
- it "has a working function #test_array_int_null_out" do
1851
+ it 'has a working function #test_array_int_null_out' do
1785
1852
  assert_equal nil, Regress.test_array_int_null_out
1786
1853
  end
1787
1854
 
1788
- it "has a working function #test_array_int_out" do
1855
+ it 'has a working function #test_array_int_out' do
1789
1856
  Regress.test_array_int_out.must_be :==, [0, 1, 2, 3, 4]
1790
1857
  end
1791
1858
 
1792
- it "has a working function #test_async_ready_callback" do
1859
+ it 'has a working function #test_async_ready_callback' do
1793
1860
  main_loop = GLib::MainLoop.new nil, false
1794
1861
 
1795
1862
  a = 1
1796
- Regress.test_async_ready_callback Proc.new {
1863
+ Regress.test_async_ready_callback proc {
1797
1864
  main_loop.quit
1798
1865
  a = 2
1799
1866
  }
@@ -1803,57 +1870,70 @@ describe Regress do
1803
1870
  assert_equal 2, a
1804
1871
  end
1805
1872
 
1806
- it "has a working function #test_boolean" do
1873
+ it 'has a working function #test_boolean' do
1807
1874
  assert_equal false, Regress.test_boolean(false)
1808
1875
  assert_equal true, Regress.test_boolean(true)
1809
1876
  end
1810
1877
 
1811
- it "has a working function #test_boolean_false" do
1878
+ it 'has a working function #test_boolean_false' do
1812
1879
  assert_equal false, Regress.test_boolean_false(false)
1813
1880
  end
1814
1881
 
1815
- it "has a working function #test_boolean_true" do
1882
+ it 'has a working function #test_boolean_true' do
1816
1883
  assert_equal true, Regress.test_boolean_true(true)
1817
1884
  end
1818
1885
 
1819
- it "has a working function #test_cairo_context_full_return" do
1886
+ it 'has a working function #test_boxeds_not_a_method' do
1887
+ skip unless get_introspection_data 'Regress', 'test_boxeds_not_a_method'
1888
+ boxed = Regress::TestBoxed.new_alternative_constructor1 123
1889
+ Regress.test_boxeds_not_a_method boxed
1890
+ pass
1891
+ end
1892
+
1893
+ it 'has a working function #test_boxeds_not_a_static' do
1894
+ skip unless get_introspection_data 'Regress', 'test_boxeds_not_a_static'
1895
+ Regress.test_boxeds_not_a_static
1896
+ pass
1897
+ end
1898
+
1899
+ it 'has a working function #test_cairo_context_full_return' do
1820
1900
  ct = Regress.test_cairo_context_full_return
1821
1901
  assert_instance_of Cairo::Context, ct
1822
1902
  end
1823
1903
 
1824
- it "has a working function #test_cairo_context_none_in" do
1904
+ it 'has a working function #test_cairo_context_none_in' do
1825
1905
  ct = Regress.test_cairo_context_full_return
1826
1906
  Regress.test_cairo_context_none_in ct
1827
1907
  end
1828
1908
 
1829
- it "has a working function #test_cairo_surface_full_out" do
1909
+ it 'has a working function #test_cairo_surface_full_out' do
1830
1910
  cs = Regress.test_cairo_surface_full_out
1831
1911
  assert_instance_of Cairo::Surface, cs
1832
1912
  end
1833
1913
 
1834
- it "has a working function #test_cairo_surface_full_return" do
1914
+ it 'has a working function #test_cairo_surface_full_return' do
1835
1915
  cs = Regress.test_cairo_surface_full_return
1836
1916
  assert_instance_of Cairo::Surface, cs
1837
1917
  end
1838
1918
 
1839
- it "has a working function #test_cairo_surface_none_in" do
1919
+ it 'has a working function #test_cairo_surface_none_in' do
1840
1920
  cs = Regress.test_cairo_surface_full_return
1841
1921
  Regress.test_cairo_surface_none_in cs
1842
1922
  end
1843
1923
 
1844
- it "has a working function #test_cairo_surface_none_return" do
1924
+ it 'has a working function #test_cairo_surface_none_return' do
1845
1925
  cs = Regress.test_cairo_surface_none_return
1846
1926
  assert_instance_of Cairo::Surface, cs
1847
1927
  end
1848
1928
 
1849
- it "has a working function #test_callback" do
1850
- result = Regress.test_callback Proc.new { 5 }
1929
+ it 'has a working function #test_callback' do
1930
+ result = Regress.test_callback proc { 5 }
1851
1931
  assert_equal 5, result
1852
1932
  end
1853
1933
 
1854
- it "has a working function #test_callback_async" do
1934
+ it 'has a working function #test_callback_async' do
1855
1935
  a = 1
1856
- Regress.test_callback_async Proc.new {|b|
1936
+ Regress.test_callback_async proc {|b|
1857
1937
  a = 2
1858
1938
  b
1859
1939
  }, 44
@@ -1862,12 +1942,12 @@ describe Regress do
1862
1942
  assert_equal 2, a
1863
1943
  end
1864
1944
 
1865
- it "has a working function #test_callback_destroy_notify" do
1945
+ it 'has a working function #test_callback_destroy_notify' do
1866
1946
  a = 1
1867
- r1 = Regress.test_callback_destroy_notify Proc.new {|b|
1947
+ r1 = Regress.test_callback_destroy_notify proc {|b|
1868
1948
  a = 2
1869
1949
  b
1870
- }, 42, Proc.new { a = 3 }
1950
+ }, 42, proc { a = 3 }
1871
1951
  assert_equal 2, a
1872
1952
  assert_equal 42, r1
1873
1953
  r2 = Regress.test_callback_thaw_notifications
@@ -1875,20 +1955,20 @@ describe Regress do
1875
1955
  assert_equal 42, r2
1876
1956
  end
1877
1957
 
1878
- it "has a working function #test_callback_destroy_notify_no_user_data" do
1958
+ it 'has a working function #test_callback_destroy_notify_no_user_data' do
1879
1959
  skip unless get_introspection_data 'Regress', 'test_callback_destroy_notify_no_user_data'
1880
1960
 
1881
1961
  callback_times_called = 0
1882
1962
  notify_times_called = 0
1883
1963
  b = :not_nil
1884
1964
 
1885
- callback = Proc.new {|user_data|
1965
+ callback = proc {|user_data|
1886
1966
  callback_times_called += 1
1887
1967
  b = user_data
1888
1968
  callback_times_called * 5
1889
1969
  }
1890
1970
 
1891
- notify = Proc.new { notify_times_called += 1 }
1971
+ notify = proc { notify_times_called += 1 }
1892
1972
 
1893
1973
  result = Regress.test_callback_destroy_notify_no_user_data callback, notify
1894
1974
 
@@ -1905,39 +1985,39 @@ describe Regress do
1905
1985
  b.must_be_nil
1906
1986
  end
1907
1987
 
1908
- it "has a working function #test_callback_thaw_async" do
1988
+ it 'has a working function #test_callback_thaw_async' do
1909
1989
  invoked = []
1910
- Regress.test_callback_async Proc.new { invoked << 1; 1 }, nil
1911
- Regress.test_callback_async Proc.new { invoked << 2; 2 }, nil
1912
- Regress.test_callback_async Proc.new { invoked << 3; 3 }, nil
1990
+ Regress.test_callback_async proc { invoked << 1; 1 }, nil
1991
+ Regress.test_callback_async proc { invoked << 2; 2 }, nil
1992
+ Regress.test_callback_async proc { invoked << 3; 3 }, nil
1913
1993
  result = Regress.test_callback_thaw_async
1914
1994
  invoked.must_equal [3, 2, 1]
1915
1995
  result.must_equal 1
1916
1996
  end
1917
1997
 
1918
- it "has a working function #test_callback_thaw_notifications" do
1998
+ it 'has a working function #test_callback_thaw_notifications' do
1919
1999
  invoked = false
1920
- Regress.test_callback_destroy_notify Proc.new { 42 }, nil, nil
1921
- Regress.test_callback_destroy_notify Proc.new { 24 }, nil, Proc.new { invoked = true }
2000
+ Regress.test_callback_destroy_notify proc { 42 }, nil, nil
2001
+ Regress.test_callback_destroy_notify proc { 24 }, nil, proc { invoked = true }
1922
2002
  result = Regress.test_callback_thaw_notifications
1923
2003
  result.must_equal 66
1924
2004
  invoked.must_equal true
1925
2005
  end
1926
2006
 
1927
- it "has a working function #test_callback_user_data" do
1928
- a = "old-value"
1929
- result = Regress.test_callback_user_data Proc.new {|u|
2007
+ it 'has a working function #test_callback_user_data' do
2008
+ a = 'old-value'
2009
+ result = Regress.test_callback_user_data proc {|u|
1930
2010
  a = u
1931
2011
  5
1932
- }, "new-value"
1933
- a.must_equal "new-value"
2012
+ }, 'new-value'
2013
+ a.must_equal 'new-value'
1934
2014
  result.must_equal 5
1935
2015
  end
1936
2016
 
1937
- describe "the #test_callback_user_data function" do
1938
- it "handles boolean user_data" do
2017
+ describe 'the #test_callback_user_data function' do
2018
+ it 'handles boolean user_data' do
1939
2019
  a = false
1940
- Regress.test_callback_user_data Proc.new {|u|
2020
+ Regress.test_callback_user_data proc {|u|
1941
2021
  a = u
1942
2022
  5
1943
2023
  }, true
@@ -1945,28 +2025,28 @@ describe Regress do
1945
2025
  end
1946
2026
  end
1947
2027
 
1948
- it "has a working function #test_closure" do
2028
+ it 'has a working function #test_closure' do
1949
2029
  c = GObject::RubyClosure.new { 5235 }
1950
2030
  r = Regress.test_closure c
1951
2031
  assert_equal 5235, r
1952
2032
  end
1953
2033
 
1954
- it "has a working function #test_closure_one_arg" do
2034
+ it 'has a working function #test_closure_one_arg' do
1955
2035
  c = GObject::RubyClosure.new { |a| a * 2 }
1956
2036
  r = Regress.test_closure_one_arg c, 2
1957
2037
  assert_equal 4, r
1958
2038
  end
1959
2039
 
1960
- it "has a working function #test_closure_variant" do
1961
- arg = GLib::Variant.new_string "foo"
2040
+ it 'has a working function #test_closure_variant' do
2041
+ arg = GLib::Variant.new_string 'foo'
1962
2042
 
1963
2043
  # TODO: Convert proc to RubyClosure automatically
1964
2044
  closure = GObject::RubyClosure.new do |variant|
1965
2045
  str = variant.get_string
1966
- if str == "foo"
2046
+ if str == 'foo'
1967
2047
  GLib::Variant.new_int32 40
1968
2048
  else
1969
- GLib::Variant.new_string "bar"
2049
+ GLib::Variant.new_string 'bar'
1970
2050
  end
1971
2051
  end
1972
2052
 
@@ -1975,7 +2055,7 @@ describe Regress do
1975
2055
  result.get_int32.must_equal 40
1976
2056
  end
1977
2057
 
1978
- it "has a working function #test_date_in_gvalue" do
2058
+ it 'has a working function #test_date_in_gvalue' do
1979
2059
  r = Regress.test_date_in_gvalue
1980
2060
  date = r.get_value
1981
2061
  skip unless date.respond_to? :get_year
@@ -1983,329 +2063,329 @@ describe Regress do
1983
2063
  [date.get_year, date.get_month, date.get_day]
1984
2064
  end
1985
2065
 
1986
- it "has a working function #test_def_error_quark" do
2066
+ it 'has a working function #test_def_error_quark' do
1987
2067
  skip unless get_introspection_data 'Regress', 'test_def_error_quark'
1988
2068
  quark = Regress.test_def_error_quark
1989
- GLib.quark_to_string(quark).must_equal "regress-test-def-error"
2069
+ GLib.quark_to_string(quark).must_equal 'regress-test-def-error'
1990
2070
  end
1991
2071
 
1992
- it "has a working function #test_double" do
2072
+ it 'has a working function #test_double' do
1993
2073
  r = Regress.test_double 5435.32
1994
2074
  assert_equal 5435.32, r
1995
2075
  end
1996
2076
 
1997
- it "has a working function #test_enum_param" do
2077
+ it 'has a working function #test_enum_param' do
1998
2078
  r = Regress.test_enum_param :value3
1999
- assert_equal "value3", r
2079
+ assert_equal 'value3', r
2000
2080
  end
2001
2081
 
2002
- it "has a working function #test_error_quark" do
2082
+ it 'has a working function #test_error_quark' do
2003
2083
  skip unless get_introspection_data 'Regress', 'test_error_quark'
2004
2084
  quark = Regress.test_error_quark
2005
- GLib.quark_to_string(quark).must_equal "regress-test-error"
2085
+ GLib.quark_to_string(quark).must_equal 'regress-test-error'
2006
2086
  end
2007
2087
 
2008
- it "has a working function #test_filename_return" do
2088
+ it 'has a working function #test_filename_return' do
2009
2089
  arr = Regress.test_filename_return
2010
- arr.must_be :==, ["åäö", "/etc/fstab"]
2090
+ arr.must_be :==, ['åäö', '/etc/fstab']
2011
2091
  end
2012
2092
 
2013
- it "has a working function #test_float" do
2093
+ it 'has a working function #test_float' do
2014
2094
  r = Regress.test_float 5435.32
2015
2095
  assert_in_delta 5435.32, r, 0.001
2016
2096
  end
2017
2097
 
2018
- it "has a working function #test_garray_container_return" do
2098
+ it 'has a working function #test_garray_container_return' do
2019
2099
  arr = Regress.test_garray_container_return
2020
2100
  arr.must_be_instance_of GLib::PtrArray
2021
2101
  arr.len.must_equal 1
2022
2102
 
2023
2103
  ptr = arr.pdata
2024
2104
  ptr2 = ptr.read_pointer
2025
- ptr2.read_string.must_be :==, "regress"
2105
+ ptr2.read_string.must_be :==, 'regress'
2026
2106
  end
2027
2107
 
2028
- it "has a working function #test_garray_full_return" do
2108
+ it 'has a working function #test_garray_full_return' do
2029
2109
  result = Regress.test_garray_full_return
2030
- result.to_a.must_equal ["regress"]
2110
+ result.to_a.must_equal ['regress']
2031
2111
  end
2032
2112
 
2033
- it "has a working function #test_gerror_callback" do
2113
+ it 'has a working function #test_gerror_callback' do
2034
2114
  result = nil
2035
- Regress.test_gerror_callback Proc.new {|err| result = err.message }
2036
- result.must_equal "regression test error"
2115
+ Regress.test_gerror_callback proc { |err| result = err.message }
2116
+ result.must_equal 'regression test error'
2037
2117
  end
2038
2118
 
2039
- it "has a working function #test_ghash_container_return" do
2119
+ it 'has a working function #test_ghash_container_return' do
2040
2120
  hash = Regress.test_ghash_container_return
2041
2121
  hash.must_be_instance_of GLib::HashTable
2042
- hash.to_hash.must_equal("foo" => "bar",
2043
- "baz" => "bat",
2044
- "qux" => "quux")
2122
+ hash.to_hash.must_equal('foo' => 'bar',
2123
+ 'baz' => 'bat',
2124
+ 'qux' => 'quux')
2045
2125
  end
2046
2126
 
2047
- it "has a working function #test_ghash_everything_return" do
2127
+ it 'has a working function #test_ghash_everything_return' do
2048
2128
  ghash = Regress.test_ghash_everything_return
2049
- ghash.to_hash.must_be :==, {"foo" => "bar",
2050
- "baz" => "bat",
2051
- "qux" => "quux"}
2129
+ ghash.to_hash.must_be :==, 'foo' => 'bar',
2130
+ 'baz' => 'bat',
2131
+ 'qux' => 'quux'
2052
2132
  end
2053
2133
 
2054
- it "has a working function #test_ghash_gvalue_in" do
2134
+ it 'has a working function #test_ghash_gvalue_in' do
2055
2135
  skip unless get_introspection_data 'Regress', 'test_ghash_gvalue_in'
2056
2136
  skip unless get_introspection_data 'Regress', 'test_ghash_gvalue_return'
2057
2137
  hash_table = Regress.test_ghash_gvalue_return
2058
2138
  Regress.test_ghash_gvalue_in hash_table
2059
2139
  end
2060
2140
 
2061
- it "has a working function #test_ghash_gvalue_return" do
2141
+ it 'has a working function #test_ghash_gvalue_return' do
2062
2142
  skip unless get_introspection_data 'Regress', 'test_ghash_gvalue_return'
2063
2143
 
2064
2144
  result = Regress.test_ghash_gvalue_return
2065
2145
  hash = result.to_hash
2066
2146
 
2067
- has_enum_and_flag_keys = hash.has_key?("flags")
2147
+ has_enum_and_flag_keys = hash.key?('flags')
2068
2148
 
2069
- hash["integer"].get_value.must_equal 12
2070
- hash["boolean"].get_value.must_equal true
2071
- hash["string"].get_value.must_equal "some text"
2072
- hash["strings"].get_value.to_a.must_equal ["first", "second", "third"]
2149
+ hash['integer'].get_value.must_equal 12
2150
+ hash['boolean'].get_value.must_equal true
2151
+ hash['string'].get_value.must_equal 'some text'
2152
+ hash['strings'].get_value.to_a.must_equal %w(first second third)
2073
2153
 
2074
2154
  if has_enum_and_flag_keys
2075
- hash["flags"].get_value.must_equal Regress::TestFlags[:flag1] | Regress::TestFlags[:flag3]
2076
- hash["enum"].get_value.must_equal :value2
2155
+ hash['flags'].get_value.must_equal Regress::TestFlags[:flag1] | Regress::TestFlags[:flag3]
2156
+ hash['enum'].get_value.must_equal :value2
2077
2157
  end
2078
2158
 
2079
2159
  expected_keys = if has_enum_and_flag_keys
2080
- ["boolean", "enum", "flags", "integer", "string", "strings"]
2160
+ %w(boolean enum flags integer string strings)
2081
2161
  else
2082
- ["boolean", "integer", "string", "strings"]
2162
+ %w(boolean integer string strings)
2083
2163
  end
2084
2164
 
2085
2165
  hash.keys.sort.must_equal expected_keys
2086
2166
  end
2087
2167
 
2088
- it "has a working function #test_ghash_nested_everything_return" do
2168
+ it 'has a working function #test_ghash_nested_everything_return' do
2089
2169
  result = Regress.test_ghash_nested_everything_return
2090
2170
  hash = result.to_hash
2091
- hash.keys.must_equal ["wibble"]
2092
- hash["wibble"].to_hash.must_equal({"foo" => "bar",
2093
- "baz" => "bat",
2094
- "qux" => "quux"})
2171
+ hash.keys.must_equal ['wibble']
2172
+ hash['wibble'].to_hash.must_equal('foo' => 'bar',
2173
+ 'baz' => 'bat',
2174
+ 'qux' => 'quux')
2095
2175
  end
2096
2176
 
2097
- it "has a working function #test_ghash_nested_everything_return2" do
2177
+ it 'has a working function #test_ghash_nested_everything_return2' do
2098
2178
  result = Regress.test_ghash_nested_everything_return2
2099
2179
  hash = result.to_hash
2100
- hash.keys.must_equal ["wibble"]
2101
- hash["wibble"].to_hash.must_equal({"foo" => "bar",
2102
- "baz" => "bat",
2103
- "qux" => "quux"})
2180
+ hash.keys.must_equal ['wibble']
2181
+ hash['wibble'].to_hash.must_equal('foo' => 'bar',
2182
+ 'baz' => 'bat',
2183
+ 'qux' => 'quux')
2104
2184
  end
2105
2185
 
2106
- it "has a working function #test_ghash_nothing_in" do
2107
- Regress.test_ghash_nothing_in({"foo" => "bar",
2108
- "baz" => "bat",
2109
- "qux" => "quux"})
2186
+ it 'has a working function #test_ghash_nothing_in' do
2187
+ Regress.test_ghash_nothing_in('foo' => 'bar',
2188
+ 'baz' => 'bat',
2189
+ 'qux' => 'quux')
2110
2190
  end
2111
2191
 
2112
- it "has a working function #test_ghash_nothing_in2" do
2113
- Regress.test_ghash_nothing_in2({"foo" => "bar",
2114
- "baz" => "bat",
2115
- "qux" => "quux"})
2192
+ it 'has a working function #test_ghash_nothing_in2' do
2193
+ Regress.test_ghash_nothing_in2('foo' => 'bar',
2194
+ 'baz' => 'bat',
2195
+ 'qux' => 'quux')
2116
2196
  end
2117
2197
 
2118
- it "has a working function #test_ghash_nothing_return" do
2198
+ it 'has a working function #test_ghash_nothing_return' do
2119
2199
  ghash = Regress.test_ghash_nothing_return
2120
- ghash.to_hash.must_be :==, {"foo" => "bar",
2121
- "baz" => "bat",
2122
- "qux" => "quux"}
2200
+ ghash.to_hash.must_be :==, 'foo' => 'bar',
2201
+ 'baz' => 'bat',
2202
+ 'qux' => 'quux'
2123
2203
  end
2124
2204
 
2125
- it "has a working function #test_ghash_nothing_return2" do
2205
+ it 'has a working function #test_ghash_nothing_return2' do
2126
2206
  ghash = Regress.test_ghash_nothing_return2
2127
- ghash.to_hash.must_be :==, {"foo" => "bar",
2128
- "baz" => "bat",
2129
- "qux" => "quux"}
2207
+ ghash.to_hash.must_be :==, 'foo' => 'bar',
2208
+ 'baz' => 'bat',
2209
+ 'qux' => 'quux'
2130
2210
  end
2131
2211
 
2132
- it "has a working function #test_ghash_null_in" do
2212
+ it 'has a working function #test_ghash_null_in' do
2133
2213
  Regress.test_ghash_null_in(nil)
2134
2214
  end
2135
2215
 
2136
- it "has a working function #test_ghash_null_out" do
2216
+ it 'has a working function #test_ghash_null_out' do
2137
2217
  ghash = Regress.test_ghash_null_out
2138
2218
  ghash.must_be_nil
2139
2219
  end
2140
2220
 
2141
- it "has a working function #test_ghash_null_return" do
2221
+ it 'has a working function #test_ghash_null_return' do
2142
2222
  ghash = Regress.test_ghash_null_return
2143
2223
  ghash.must_be_nil
2144
2224
  end
2145
2225
 
2146
- it "has a working function #test_glist_container_return" do
2226
+ it 'has a working function #test_glist_container_return' do
2147
2227
  list = Regress.test_glist_container_return
2148
2228
  assert_instance_of GLib::List, list
2149
- list.must_be :==, ["1", "2", "3"]
2229
+ list.must_be :==, %w(1 2 3)
2150
2230
  end
2151
2231
 
2152
- it "has a working function #test_glist_everything_return" do
2232
+ it 'has a working function #test_glist_everything_return' do
2153
2233
  list = Regress.test_glist_everything_return
2154
- list.must_be :==, ["1", "2", "3"]
2234
+ list.must_be :==, %w(1 2 3)
2155
2235
  end
2156
2236
 
2157
- it "has a working function #test_glist_nothing_in" do
2158
- Regress.test_glist_nothing_in ["1", "2", "3"]
2237
+ it 'has a working function #test_glist_nothing_in' do
2238
+ Regress.test_glist_nothing_in %w(1 2 3)
2159
2239
  pass
2160
2240
  end
2161
2241
 
2162
- it "has a working function #test_glist_nothing_in2" do
2163
- Regress.test_glist_nothing_in2 ["1", "2", "3"]
2242
+ it 'has a working function #test_glist_nothing_in2' do
2243
+ Regress.test_glist_nothing_in2 %w(1 2 3)
2164
2244
  pass
2165
2245
  end
2166
2246
 
2167
- it "has a working function #test_glist_nothing_return" do
2247
+ it 'has a working function #test_glist_nothing_return' do
2168
2248
  list = Regress.test_glist_nothing_return
2169
- list.must_be :==, ["1", "2", "3"]
2249
+ list.must_be :==, %w(1 2 3)
2170
2250
  end
2171
2251
 
2172
- it "has a working function #test_glist_nothing_return2" do
2252
+ it 'has a working function #test_glist_nothing_return2' do
2173
2253
  list = Regress.test_glist_nothing_return2
2174
- list.must_be :==, ["1", "2", "3"]
2254
+ list.must_be :==, %w(1 2 3)
2175
2255
  end
2176
2256
 
2177
- it "has a working function #test_glist_null_in" do
2257
+ it 'has a working function #test_glist_null_in' do
2178
2258
  Regress.test_glist_null_in nil
2179
2259
  pass
2180
2260
  end
2181
2261
 
2182
- it "has a working function #test_glist_null_out" do
2262
+ it 'has a working function #test_glist_null_out' do
2183
2263
  result = Regress.test_glist_null_out
2184
2264
  assert_equal nil, result
2185
2265
  end
2186
2266
 
2187
- it "has a working function #test_gslist_container_return" do
2267
+ it 'has a working function #test_gslist_container_return' do
2188
2268
  slist = Regress.test_gslist_container_return
2189
2269
  assert_instance_of GLib::SList, slist
2190
- slist.must_be :==, ["1", "2", "3"]
2270
+ slist.must_be :==, %w(1 2 3)
2191
2271
  end
2192
2272
 
2193
- it "has a working function #test_gslist_everything_return" do
2273
+ it 'has a working function #test_gslist_everything_return' do
2194
2274
  slist = Regress.test_gslist_everything_return
2195
- slist.must_be :==, ["1", "2", "3"]
2275
+ slist.must_be :==, %w(1 2 3)
2196
2276
  end
2197
2277
 
2198
- it "has a working function #test_gslist_nothing_in" do
2199
- Regress.test_gslist_nothing_in ["1", "2", "3"]
2278
+ it 'has a working function #test_gslist_nothing_in' do
2279
+ Regress.test_gslist_nothing_in %w(1 2 3)
2200
2280
  pass
2201
2281
  end
2202
2282
 
2203
- it "has a working function #test_gslist_nothing_in2" do
2204
- Regress.test_gslist_nothing_in2 ["1", "2", "3"]
2283
+ it 'has a working function #test_gslist_nothing_in2' do
2284
+ Regress.test_gslist_nothing_in2 %w(1 2 3)
2205
2285
  pass
2206
2286
  end
2207
2287
 
2208
- it "has a working function #test_gslist_nothing_return" do
2288
+ it 'has a working function #test_gslist_nothing_return' do
2209
2289
  slist = Regress.test_gslist_nothing_return
2210
- slist.must_be :==, ["1", "2", "3"]
2290
+ slist.must_be :==, %w(1 2 3)
2211
2291
  end
2212
2292
 
2213
- it "has a working function #test_gslist_nothing_return2" do
2293
+ it 'has a working function #test_gslist_nothing_return2' do
2214
2294
  slist = Regress.test_gslist_nothing_return2
2215
- slist.must_be :==, ["1", "2", "3"]
2295
+ slist.must_be :==, %w(1 2 3)
2216
2296
  end
2217
2297
 
2218
- it "has a working function #test_gslist_null_in" do
2298
+ it 'has a working function #test_gslist_null_in' do
2219
2299
  Regress.test_gslist_null_in nil
2220
2300
  pass
2221
2301
  end
2222
2302
 
2223
- it "has a working function #test_gslist_null_out" do
2303
+ it 'has a working function #test_gslist_null_out' do
2224
2304
  result = Regress.test_gslist_null_out
2225
2305
  assert_equal nil, result
2226
2306
  end
2227
2307
 
2228
- it "has a working function #test_gtype" do
2308
+ it 'has a working function #test_gtype' do
2229
2309
  result = Regress.test_gtype 23
2230
2310
  assert_equal 23, result
2231
2311
  end
2232
2312
 
2233
- it "has a working function #test_gvariant_as" do
2234
- Regress.test_gvariant_as.get_strv.to_a.must_equal ["one", "two", "three"]
2313
+ it 'has a working function #test_gvariant_as' do
2314
+ Regress.test_gvariant_as.get_strv.to_a.must_equal %w(one two three)
2235
2315
  end
2236
2316
 
2237
- it "has a working function #test_gvariant_asv" do
2317
+ it 'has a working function #test_gvariant_asv' do
2238
2318
  result = Regress.test_gvariant_asv
2239
2319
  result.n_children.must_equal 2
2240
- result.lookup_value("name", nil).get_string.must_equal "foo"
2241
- result.lookup_value("timeout", nil).get_int32.must_equal 10
2320
+ result.lookup_value('name', nil).get_string.must_equal 'foo'
2321
+ result.lookup_value('timeout', nil).get_int32.must_equal 10
2242
2322
  end
2243
2323
 
2244
- it "has a working function #test_gvariant_i" do
2324
+ it 'has a working function #test_gvariant_i' do
2245
2325
  Regress.test_gvariant_i.get_int32.must_equal 1
2246
2326
  end
2247
2327
 
2248
- it "has a working function #test_gvariant_s" do
2249
- Regress.test_gvariant_s.get_string.must_equal "one"
2328
+ it 'has a working function #test_gvariant_s' do
2329
+ Regress.test_gvariant_s.get_string.must_equal 'one'
2250
2330
  end
2251
2331
 
2252
- it "has a working function #test_gvariant_v" do
2253
- Regress.test_gvariant_v.get_variant.get_string.must_equal "contents"
2332
+ it 'has a working function #test_gvariant_v' do
2333
+ Regress.test_gvariant_v.get_variant.get_string.must_equal 'contents'
2254
2334
  end
2255
2335
 
2256
- it "has a working function #test_hash_table_callback" do
2336
+ it 'has a working function #test_hash_table_callback' do
2257
2337
  value = nil
2258
- Regress.test_hash_table_callback({"foo" => 42}, Proc.new {|hash| value = hash})
2259
- value.to_hash.must_equal({"foo" => 42})
2338
+ Regress.test_hash_table_callback({ 'foo' => 42 }, proc { |hash| value = hash })
2339
+ value.to_hash.must_equal('foo' => 42)
2260
2340
  end
2261
2341
 
2262
- it "has a working function #test_int" do
2342
+ it 'has a working function #test_int' do
2263
2343
  result = Regress.test_int 23
2264
2344
  assert_equal 23, result
2265
2345
  end
2266
2346
 
2267
- it "has a working function #test_int16" do
2347
+ it 'has a working function #test_int16' do
2268
2348
  result = Regress.test_int16 23
2269
2349
  assert_equal 23, result
2270
2350
  end
2271
2351
 
2272
- it "has a working function #test_int32" do
2352
+ it 'has a working function #test_int32' do
2273
2353
  result = Regress.test_int32 23
2274
2354
  assert_equal 23, result
2275
2355
  end
2276
2356
 
2277
- it "has a working function #test_int64" do
2278
- result = Regress.test_int64 2300000000000
2279
- assert_equal 2300000000000, result
2357
+ it 'has a working function #test_int64' do
2358
+ result = Regress.test_int64 2_300_000_000_000
2359
+ assert_equal 2_300_000_000_000, result
2280
2360
  end
2281
2361
 
2282
- it "has a working function #test_int8" do
2362
+ it 'has a working function #test_int8' do
2283
2363
  result = Regress.test_int8 23
2284
2364
  assert_equal 23, result
2285
2365
  end
2286
2366
 
2287
- it "has a working function #test_int_out_utf8" do
2288
- len = Regress.test_int_out_utf8 "How long?"
2367
+ it 'has a working function #test_int_out_utf8' do
2368
+ len = Regress.test_int_out_utf8 'How long?'
2289
2369
  assert_equal 9, len
2290
2370
  end
2291
2371
 
2292
- it "has a working function #test_int_value_arg" do
2372
+ it 'has a working function #test_int_value_arg' do
2293
2373
  gv = GObject::Value.new
2294
- gv.init GObject.type_from_name "gint"
2374
+ gv.init GObject.type_from_name 'gint'
2295
2375
  gv.set_int 343
2296
2376
  result = Regress.test_int_value_arg gv
2297
2377
  assert_equal 343, result
2298
2378
  end
2299
2379
 
2300
- it "has a working function #test_long" do
2380
+ it 'has a working function #test_long' do
2301
2381
  long_val = FFI.type_size(:long) == 8 ? 2_300_000_000_000 : 2_000_000_000
2302
2382
  result = Regress.test_long long_val
2303
2383
  assert_equal long_val, result
2304
2384
  end
2305
2385
 
2306
- it "has a working function #test_multi_callback" do
2386
+ it 'has a working function #test_multi_callback' do
2307
2387
  a = 1
2308
- result = Regress.test_multi_callback Proc.new {
2388
+ result = Regress.test_multi_callback proc {
2309
2389
  a += 1
2310
2390
  23
2311
2391
  }
@@ -2313,221 +2393,221 @@ describe Regress do
2313
2393
  assert_equal 3, a
2314
2394
  end
2315
2395
 
2316
- it "has a working function #test_multi_double_args" do
2396
+ it 'has a working function #test_multi_double_args' do
2317
2397
  one, two = Regress.test_multi_double_args 23.1
2318
2398
  assert_equal 2 * 23.1, one
2319
2399
  assert_equal 3 * 23.1, two
2320
2400
  end
2321
2401
 
2322
- it "has a working function #test_multiline_doc_comments" do
2402
+ it 'has a working function #test_multiline_doc_comments' do
2323
2403
  Regress.test_multiline_doc_comments.must_be_nil
2324
2404
  end
2325
2405
 
2326
- it "has a working function #test_nested_parameter" do
2406
+ it 'has a working function #test_nested_parameter' do
2327
2407
  Regress.test_nested_parameter(3).must_be_nil
2328
2408
  end
2329
2409
 
2330
- it "has a working function #test_null_gerror_callback" do
2410
+ it 'has a working function #test_null_gerror_callback' do
2331
2411
  value = nil
2332
- Regress.test_owned_gerror_callback Proc.new {|err| value = err }
2333
- value.message.must_equal "regression test owned error"
2412
+ Regress.test_owned_gerror_callback proc { |err| value = err }
2413
+ value.message.must_equal 'regression test owned error'
2334
2414
  end
2335
2415
 
2336
- it "has a working function #test_owned_gerror_callback" do
2416
+ it 'has a working function #test_owned_gerror_callback' do
2337
2417
  value = nil
2338
- Regress.test_owned_gerror_callback Proc.new {|err| value = err }
2339
- value.message.must_equal "regression test owned error"
2418
+ Regress.test_owned_gerror_callback proc { |err| value = err }
2419
+ value.message.must_equal 'regression test owned error'
2340
2420
  end
2341
2421
 
2342
- it "has a working function #test_short" do
2422
+ it 'has a working function #test_short' do
2343
2423
  result = Regress.test_short 23
2344
2424
  assert_equal 23, result
2345
2425
  end
2346
2426
 
2347
- it "has a working function #test_simple_boxed_a_const_return" do
2427
+ it 'has a working function #test_simple_boxed_a_const_return' do
2348
2428
  result = Regress.test_simple_boxed_a_const_return
2349
2429
  assert_equal [5, 6, 7.0], [result.some_int, result.some_int8, result.some_double]
2350
2430
  end
2351
2431
 
2352
- it "has a working function #test_simple_callback" do
2432
+ it 'has a working function #test_simple_callback' do
2353
2433
  a = 0
2354
- Regress.test_simple_callback Proc.new { a = 1 }
2434
+ Regress.test_simple_callback proc { a = 1 }
2355
2435
  assert_equal 1, a
2356
2436
  end
2357
2437
 
2358
- it "has a working function #test_size" do
2438
+ it 'has a working function #test_size' do
2359
2439
  assert_equal 2354, Regress.test_size(2354)
2360
2440
  end
2361
2441
 
2362
- it "has a working function #test_ssize" do
2442
+ it 'has a working function #test_ssize' do
2363
2443
  assert_equal(-2_000_000, Regress.test_ssize(-2_000_000))
2364
2444
  end
2365
2445
 
2366
- it "has a working function #test_struct_a_parse" do
2446
+ it 'has a working function #test_struct_a_parse' do
2367
2447
  skip unless get_introspection_data 'Regress', 'test_struct_a_parse'
2368
- a = Regress.test_struct_a_parse("this string is actually ignored")
2448
+ a = Regress.test_struct_a_parse('this string is actually ignored')
2369
2449
  a.must_be_instance_of Regress::TestStructA
2370
2450
  a.some_int.must_equal 23
2371
2451
  end
2372
2452
 
2373
- it "has a working function #test_strv_in" do
2374
- assert_equal true, Regress.test_strv_in(['1', '2', '3'])
2453
+ it 'has a working function #test_strv_in' do
2454
+ assert_equal true, Regress.test_strv_in(%w(1 2 3))
2375
2455
  end
2376
2456
 
2377
- it "has a working function #test_strv_in_gvalue" do
2457
+ it 'has a working function #test_strv_in_gvalue' do
2378
2458
  gv = Regress.test_strv_in_gvalue
2379
- gv.get_value.must_be :==, ['one', 'two', 'three']
2459
+ gv.get_value.must_be :==, %w(one two three)
2380
2460
  end
2381
2461
 
2382
- it "has a working function #test_strv_out" do
2462
+ it 'has a working function #test_strv_out' do
2383
2463
  arr = Regress.test_strv_out
2384
- arr.must_be :==, ["thanks", "for", "all", "the", "fish"]
2464
+ arr.must_be :==, %w(thanks for all the fish)
2385
2465
  end
2386
2466
 
2387
- it "has a working function #test_strv_out_c" do
2467
+ it 'has a working function #test_strv_out_c' do
2388
2468
  arr = Regress.test_strv_out_c
2389
- arr.must_be :==, ["thanks", "for", "all", "the", "fish"]
2469
+ arr.must_be :==, %w(thanks for all the fish)
2390
2470
  end
2391
2471
 
2392
- it "has a working function #test_strv_out_container" do
2472
+ it 'has a working function #test_strv_out_container' do
2393
2473
  arr = Regress.test_strv_out_container
2394
- arr.must_be :==, ['1', '2', '3']
2474
+ arr.must_be :==, %w(1 2 3)
2395
2475
  end
2396
2476
 
2397
- it "has a working function #test_strv_outarg" do
2477
+ it 'has a working function #test_strv_outarg' do
2398
2478
  arr = Regress.test_strv_outarg
2399
- arr.must_be :==, ['1', '2', '3']
2479
+ arr.must_be :==, %w(1 2 3)
2400
2480
  end
2401
2481
 
2402
- it "has a working function #test_timet" do
2482
+ it 'has a working function #test_timet' do
2403
2483
  # Time rounded to seconds.
2404
2484
  t = Time.at(Time.now.to_i)
2405
2485
  result = Regress.test_timet(t.to_i)
2406
2486
  assert_equal t, Time.at(result)
2407
2487
  end
2408
2488
 
2409
- it "has a working function #test_torture_signature_0" do
2410
- y, z, q = Regress.test_torture_signature_0 86, "foo", 2
2411
- assert_equal [86, 2*86, 3+2], [y, z, q]
2489
+ it 'has a working function #test_torture_signature_0' do
2490
+ y, z, q = Regress.test_torture_signature_0 86, 'foo', 2
2491
+ assert_equal [86, 2 * 86, 3 + 2], [y, z, q]
2412
2492
  end
2413
2493
 
2414
- it "has a working function #test_torture_signature_1" do
2415
- ret, y, z, q = Regress.test_torture_signature_1(-21, "hello", 12)
2416
- [ret, y, z, q].must_equal [true, -21, 2 * -21, "hello".length + 12]
2494
+ it 'has a working function #test_torture_signature_1' do
2495
+ ret, y, z, q = Regress.test_torture_signature_1(-21, 'hello', 12)
2496
+ [ret, y, z, q].must_equal [true, -21, 2 * -21, 'hello'.length + 12]
2417
2497
 
2418
- proc { Regress.test_torture_signature_1(-21, "hello", 11) }.
2498
+ proc { Regress.test_torture_signature_1(-21, 'hello', 11) }.
2419
2499
  must_raise GirFFI::GLibError
2420
2500
  end
2421
2501
 
2422
- it "has a working function #test_torture_signature_2" do
2502
+ it 'has a working function #test_torture_signature_2' do
2423
2503
  a = 1
2424
2504
  y, z, q = Regress.test_torture_signature_2 244,
2425
- Proc.new {|u| a = u }, 2, Proc.new { a = 3 },
2426
- "foofoo", 31
2427
- assert_equal [244, 2*244, 6+31], [y, z, q]
2505
+ proc { |u| a = u }, 2, proc { a = 3 },
2506
+ 'foofoo', 31
2507
+ assert_equal [244, 2 * 244, 6 + 31], [y, z, q]
2428
2508
  assert_equal 3, a
2429
2509
  end
2430
2510
 
2431
- it "has a working function #test_uint" do
2511
+ it 'has a working function #test_uint' do
2432
2512
  assert_equal 31, Regress.test_uint(31)
2433
2513
  end
2434
2514
 
2435
- it "has a working function #test_uint16" do
2515
+ it 'has a working function #test_uint16' do
2436
2516
  assert_equal 31, Regress.test_uint16(31)
2437
2517
  end
2438
2518
 
2439
- it "has a working function #test_uint32" do
2440
- assert_equal 540000, Regress.test_uint32(540000)
2519
+ it 'has a working function #test_uint32' do
2520
+ assert_equal 540_000, Regress.test_uint32(540_000)
2441
2521
  end
2442
2522
 
2443
- it "has a working function #test_uint64" do
2523
+ it 'has a working function #test_uint64' do
2444
2524
  assert_equal 54_000_000_000_000, Regress.test_uint64(54_000_000_000_000)
2445
2525
  end
2446
2526
 
2447
- it "has a working function #test_uint8" do
2527
+ it 'has a working function #test_uint8' do
2448
2528
  assert_equal 31, Regress.test_uint8(31)
2449
2529
  end
2450
2530
 
2451
- it "has a working function #test_ulong" do
2531
+ it 'has a working function #test_ulong' do
2452
2532
  assert_equal 54_000_000_000_000, Regress.test_uint64(54_000_000_000_000)
2453
2533
  end
2454
2534
 
2455
- it "has a working function #test_unconventional_error_quark" do
2535
+ it 'has a working function #test_unconventional_error_quark' do
2456
2536
  skip unless get_introspection_data 'Regress', 'test_unconventional_error_quark'
2457
2537
  result = Regress.test_unconventional_error_quark
2458
- GLib.quark_to_string(result).must_equal "regress-test-other-error"
2538
+ GLib.quark_to_string(result).must_equal 'regress-test-other-error'
2459
2539
  end
2460
2540
 
2461
- it "has a working function #test_unichar" do
2541
+ it 'has a working function #test_unichar' do
2462
2542
  assert_equal 120, Regress.test_unichar(120)
2463
2543
  assert_equal 540_000, Regress.test_unichar(540_000)
2464
2544
  end
2465
2545
 
2466
- it "has a working function #test_unsigned_enum_param" do
2467
- assert_equal "value1", Regress.test_unsigned_enum_param(:value1)
2468
- assert_equal "value2", Regress.test_unsigned_enum_param(:value2)
2546
+ it 'has a working function #test_unsigned_enum_param' do
2547
+ assert_equal 'value1', Regress.test_unsigned_enum_param(:value1)
2548
+ assert_equal 'value2', Regress.test_unsigned_enum_param(:value2)
2469
2549
  end
2470
2550
 
2471
- it "has a working function #test_ushort" do
2551
+ it 'has a working function #test_ushort' do
2472
2552
  assert_equal 54_000_000, Regress.test_uint64(54_000_000)
2473
2553
  end
2474
2554
 
2475
- it "has a working function #test_utf8_const_in" do
2555
+ it 'has a working function #test_utf8_const_in' do
2476
2556
  Regress.test_utf8_const_in("const \xe2\x99\xa5 utf8")
2477
2557
  pass
2478
2558
  end
2479
2559
 
2480
- it "has a working function #test_utf8_const_return" do
2560
+ it 'has a working function #test_utf8_const_return' do
2481
2561
  result = Regress.test_utf8_const_return
2482
2562
  assert_equal "const \xe2\x99\xa5 utf8", result
2483
2563
  end
2484
2564
 
2485
- it "has a working function #test_utf8_inout" do
2565
+ it 'has a working function #test_utf8_inout' do
2486
2566
  result = Regress.test_utf8_inout "const \xe2\x99\xa5 utf8"
2487
2567
  assert_equal "nonconst \xe2\x99\xa5 utf8", result
2488
2568
  end
2489
2569
 
2490
- it "has a working function #test_utf8_nonconst_return" do
2570
+ it 'has a working function #test_utf8_nonconst_return' do
2491
2571
  result = Regress.test_utf8_nonconst_return
2492
2572
  assert_equal "nonconst \xe2\x99\xa5 utf8", result
2493
2573
  end
2494
2574
 
2495
- it "has a working function #test_utf8_null_in" do
2575
+ it 'has a working function #test_utf8_null_in' do
2496
2576
  Regress.test_utf8_null_in nil
2497
2577
  pass
2498
2578
  end
2499
2579
 
2500
- it "has a working function #test_utf8_null_out" do
2580
+ it 'has a working function #test_utf8_null_out' do
2501
2581
  assert_equal nil, Regress.test_utf8_null_out
2502
2582
  end
2503
2583
 
2504
- it "has a working function #test_utf8_out" do
2584
+ it 'has a working function #test_utf8_out' do
2505
2585
  result = Regress.test_utf8_out
2506
2586
  assert_equal "nonconst \xe2\x99\xa5 utf8", result
2507
2587
  end
2508
2588
 
2509
- it "has a working function #test_utf8_out_nonconst_return" do
2589
+ it 'has a working function #test_utf8_out_nonconst_return' do
2510
2590
  r, out = Regress.test_utf8_out_nonconst_return
2511
- assert_equal ["first", "second"], [r, out]
2591
+ assert_equal %w(first second), [r, out]
2512
2592
  end
2513
2593
 
2514
- it "has a working function #test_utf8_out_out" do
2594
+ it 'has a working function #test_utf8_out_out' do
2515
2595
  out0, out1 = Regress.test_utf8_out_nonconst_return
2516
- assert_equal ["first", "second"], [out0, out1]
2596
+ assert_equal %w(first second), [out0, out1]
2517
2597
  end
2518
2598
 
2519
- it "has a working function #test_value_return" do
2599
+ it 'has a working function #test_value_return' do
2520
2600
  result = Regress.test_value_return 3423
2521
2601
  assert_equal 3423, result.get_int
2522
2602
  end
2523
2603
 
2524
- it "has a working function #test_versioning" do
2604
+ it 'has a working function #test_versioning' do
2525
2605
  skip unless get_introspection_data 'Regress', 'test_versioning'
2526
2606
  Regress.test_versioning
2527
2607
  pass
2528
2608
  end
2529
2609
 
2530
- it "raises an appropriate NoMethodError when a function is not found" do
2610
+ it 'raises an appropriate NoMethodError when a function is not found' do
2531
2611
  begin
2532
2612
  Regress.this_method_does_not_exist
2533
2613
  rescue => e