gir_ffi 0.14.1 → 0.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Changelog.md +21 -0
- data/Gemfile +6 -4
- data/README.md +4 -4
- data/Rakefile +5 -5
- data/lib/ffi-glib/array.rb +14 -4
- data/lib/ffi-glib/byte_array.rb +7 -2
- data/lib/ffi-glib/container_class_methods.rb +1 -1
- data/lib/ffi-glib/error.rb +1 -1
- data/lib/ffi-glib/hash_table.rb +3 -3
- data/lib/ffi-glib/list.rb +1 -1
- data/lib/ffi-glib/list_methods.rb +1 -1
- data/lib/ffi-glib/main_loop.rb +3 -3
- data/lib/ffi-glib/ptr_array.rb +30 -8
- data/lib/ffi-glib/s_list.rb +1 -1
- data/lib/ffi-glib/variant.rb +1 -1
- data/lib/ffi-glib.rb +16 -16
- data/lib/ffi-gobject/object.rb +23 -32
- data/lib/ffi-gobject/param_spec.rb +1 -1
- data/lib/ffi-gobject/ruby_closure.rb +2 -2
- data/lib/ffi-gobject/value.rb +37 -28
- data/lib/ffi-gobject.rb +13 -13
- data/lib/ffi-gobject_introspection/gobject_type_init.rb +2 -2
- data/lib/ffi-gobject_introspection/i_arg_info.rb +2 -2
- data/lib/ffi-gobject_introspection/i_base_info.rb +27 -17
- data/lib/ffi-gobject_introspection/i_callable_info.rb +4 -4
- data/lib/ffi-gobject_introspection/i_constant_info.rb +2 -2
- data/lib/ffi-gobject_introspection/i_enum_info.rb +1 -0
- data/lib/ffi-gobject_introspection/i_field_info.rb +1 -1
- data/lib/ffi-gobject_introspection/i_function_info.rb +1 -1
- data/lib/ffi-gobject_introspection/i_interface_info.rb +1 -1
- data/lib/ffi-gobject_introspection/i_object_info.rb +2 -2
- data/lib/ffi-gobject_introspection/i_property_info.rb +2 -2
- data/lib/ffi-gobject_introspection/i_repository.rb +9 -6
- data/lib/ffi-gobject_introspection/i_struct_info.rb +2 -1
- data/lib/ffi-gobject_introspection/i_type_info.rb +13 -7
- data/lib/ffi-gobject_introspection/i_unresolved_info.rb +1 -1
- data/lib/ffi-gobject_introspection/i_vfunc_info.rb +1 -1
- data/lib/ffi-gobject_introspection/lib.rb +30 -19
- data/lib/ffi-gobject_introspection/strv.rb +1 -1
- data/lib/ffi-gobject_introspection.rb +20 -20
- data/lib/gir_ffi/allocation_helper.rb +1 -1
- data/lib/gir_ffi/arg_helper.rb +4 -4
- data/lib/gir_ffi/{in_out_pointer.rb → array_element_convertor.rb} +16 -23
- data/lib/gir_ffi/boolean.rb +1 -1
- data/lib/gir_ffi/boxed_base.rb +1 -1
- data/lib/gir_ffi/builder.rb +18 -10
- data/lib/gir_ffi/builders/argument_builder.rb +17 -17
- data/lib/gir_ffi/builders/base_argument_builder.rb +1 -0
- data/lib/gir_ffi/builders/base_method_builder.rb +7 -7
- data/lib/gir_ffi/builders/base_return_value_builder.rb +1 -1
- data/lib/gir_ffi/builders/base_type_builder.rb +1 -1
- data/lib/gir_ffi/builders/c_to_ruby_convertor.rb +5 -5
- data/lib/gir_ffi/builders/callback_argument_builder.rb +8 -8
- data/lib/gir_ffi/builders/callback_builder.rb +3 -3
- data/lib/gir_ffi/builders/callback_return_value_builder.rb +2 -2
- data/lib/gir_ffi/builders/closure_argument_builder.rb +1 -1
- data/lib/gir_ffi/builders/closure_return_value_builder.rb +1 -1
- data/lib/gir_ffi/builders/constant_builder.rb +1 -1
- data/lib/gir_ffi/builders/constructor_builder.rb +9 -9
- data/lib/gir_ffi/builders/enum_builder.rb +2 -2
- data/lib/gir_ffi/builders/field_builder.rb +16 -15
- data/lib/gir_ffi/builders/flags_builder.rb +2 -2
- data/lib/gir_ffi/builders/full_c_to_ruby_convertor.rb +1 -1
- data/lib/gir_ffi/builders/function_builder.rb +11 -5
- data/lib/gir_ffi/builders/initializer_builder.rb +3 -3
- data/lib/gir_ffi/builders/initializer_return_value_builder.rb +2 -2
- data/lib/gir_ffi/builders/interface_builder.rb +2 -2
- data/lib/gir_ffi/builders/mapping_method_builder.rb +9 -9
- data/lib/gir_ffi/builders/marshalling_method_builder.rb +7 -7
- data/lib/gir_ffi/builders/method_template.rb +1 -1
- data/lib/gir_ffi/builders/module_builder.rb +4 -6
- data/lib/gir_ffi/builders/object_builder.rb +6 -6
- data/lib/gir_ffi/builders/property_argument_builder.rb +1 -1
- data/lib/gir_ffi/builders/property_builder.rb +13 -12
- data/lib/gir_ffi/builders/property_return_value_builder.rb +1 -1
- data/lib/gir_ffi/builders/registered_type_builder.rb +14 -5
- data/lib/gir_ffi/builders/return_value_builder.rb +4 -4
- data/lib/gir_ffi/builders/ruby_to_c_convertor.rb +6 -6
- data/lib/gir_ffi/builders/signal_closure_builder.rb +2 -2
- data/lib/gir_ffi/builders/struct_builder.rb +4 -4
- data/lib/gir_ffi/builders/struct_like.rb +1 -1
- data/lib/gir_ffi/builders/type_builder.rb +12 -12
- data/lib/gir_ffi/builders/unintrospectable_boxed_builder.rb +2 -2
- data/lib/gir_ffi/builders/unintrospectable_builder.rb +2 -2
- data/lib/gir_ffi/builders/union_builder.rb +4 -4
- data/lib/gir_ffi/builders/user_defined_builder.rb +2 -2
- data/lib/gir_ffi/builders/vfunc_argument_builder.rb +1 -1
- data/lib/gir_ffi/builders/vfunc_builder.rb +6 -6
- data/lib/gir_ffi/builders/with_layout.rb +2 -2
- data/lib/gir_ffi/callback_base.rb +1 -1
- data/lib/gir_ffi/class_base.rb +5 -5
- data/lib/gir_ffi/core.rb +19 -20
- data/lib/gir_ffi/enum_base.rb +1 -1
- data/lib/gir_ffi/enum_like_base.rb +2 -2
- data/lib/gir_ffi/error_argument_info.rb +2 -2
- data/lib/gir_ffi/error_type_info.rb +1 -1
- data/lib/gir_ffi/ffi_ext/pointer.rb +1 -1
- data/lib/gir_ffi/ffi_ext.rb +1 -1
- data/lib/gir_ffi/flags_base.rb +1 -1
- data/lib/gir_ffi/in_pointer.rb +10 -0
- data/lib/gir_ffi/info_ext/full_type_name.rb +3 -3
- data/lib/gir_ffi/info_ext/i_arg_info.rb +1 -1
- data/lib/gir_ffi/info_ext/i_callable_info.rb +1 -1
- data/lib/gir_ffi/info_ext/i_callback_info.rb +1 -1
- data/lib/gir_ffi/info_ext/i_field_info.rb +1 -1
- data/lib/gir_ffi/info_ext/i_function_info.rb +1 -1
- data/lib/gir_ffi/info_ext/i_property_info.rb +2 -2
- data/lib/gir_ffi/info_ext/i_registered_type_info.rb +4 -5
- data/lib/gir_ffi/info_ext/i_signal_info.rb +7 -3
- data/lib/gir_ffi/info_ext/i_type_info.rb +48 -26
- data/lib/gir_ffi/info_ext/i_unresolved_info.rb +1 -1
- data/lib/gir_ffi/info_ext/i_value_info.rb +2 -2
- data/lib/gir_ffi/info_ext/i_vfunc_info.rb +2 -2
- data/lib/gir_ffi/info_ext/safe_constant_name.rb +8 -8
- data/lib/gir_ffi/info_ext/safe_function_name.rb +2 -2
- data/lib/gir_ffi/info_ext.rb +15 -15
- data/lib/gir_ffi/interface_base.rb +3 -3
- data/lib/gir_ffi/lib_c.rb +1 -1
- data/lib/gir_ffi/method_stubber.rb +1 -1
- data/lib/gir_ffi/module_base.rb +1 -1
- data/lib/gir_ffi/object_base.rb +3 -4
- data/lib/gir_ffi/receiver_argument_info.rb +1 -1
- data/lib/gir_ffi/receiver_type_info.rb +2 -2
- data/lib/gir_ffi/registered_type_base.rb +1 -1
- data/lib/gir_ffi/sized_array.rb +4 -2
- data/lib/gir_ffi/struct.rb +1 -1
- data/lib/gir_ffi/struct_base.rb +1 -1
- data/lib/gir_ffi/type_map.rb +2 -23
- data/lib/gir_ffi/unintrospectable_boxed_info.rb +2 -2
- data/lib/gir_ffi/unintrospectable_type_info.rb +1 -1
- data/lib/gir_ffi/union.rb +1 -1
- data/lib/gir_ffi/union_base.rb +1 -1
- data/lib/gir_ffi/user_defined_object_info.rb +6 -2
- data/lib/gir_ffi/user_defined_property_info.rb +33 -33
- data/lib/gir_ffi/version.rb +1 -1
- data/lib/gir_ffi-base/gobject/lib.rb +3 -2
- data/lib/gir_ffi-base/gobject.rb +26 -25
- data/lib/gir_ffi-base.rb +1 -1
- data/lib/gir_ffi.rb +3 -3
- data/tasks/test.rake +3 -2
- data/test/base_test_helper.rb +16 -9
- data/test/ffi-glib/array_test.rb +71 -56
- data/test/ffi-glib/byte_array_test.rb +13 -7
- data/test/ffi-glib/bytes_test.rb +24 -19
- data/test/ffi-glib/closure_test.rb +11 -11
- data/test/ffi-glib/destroy_notify_test.rb +6 -6
- data/test/ffi-glib/hash_table_test.rb +27 -27
- data/test/ffi-glib/list_test.rb +22 -22
- data/test/ffi-glib/main_loop_test.rb +12 -12
- data/test/ffi-glib/ptr_array_test.rb +39 -39
- data/test/ffi-glib/ruby_closure_test.rb +10 -10
- data/test/ffi-glib/s_list_test.rb +20 -20
- data/test/ffi-glib/strv_test.rb +19 -19
- data/test/ffi-glib/variant_test.rb +5 -5
- data/test/ffi-gobject/gobject_test.rb +48 -44
- data/test/ffi-gobject/object_class_test.rb +8 -8
- data/test/ffi-gobject/object_test.rb +49 -67
- data/test/ffi-gobject/param_spec_test.rb +12 -12
- data/test/ffi-gobject/value_test.rb +145 -125
- data/test/ffi-gobject_introspection/gobject_type_init_test.rb +8 -8
- data/test/ffi-gobject_introspection/i_base_info_test.rb +15 -16
- data/test/ffi-gobject_introspection/i_constant_info_test.rb +9 -13
- data/test/ffi-gobject_introspection/i_enum_info_test.rb +7 -7
- data/test/ffi-gobject_introspection/i_function_info_test.rb +1 -1
- data/test/ffi-gobject_introspection/i_interface_info_test.rb +10 -10
- data/test/ffi-gobject_introspection/i_object_info_test.rb +23 -23
- data/test/ffi-gobject_introspection/i_property_info_test.rb +19 -19
- data/test/ffi-gobject_introspection/i_registered_type_info_test.rb +10 -10
- data/test/ffi-gobject_introspection/i_repository_test.rb +31 -31
- data/test/ffi-gobject_introspection/i_struct_info_test.rb +10 -10
- data/test/ffi-gobject_introspection/i_type_info_test.rb +12 -15
- data/test/ffi-gobject_introspection/i_union_info_test.rb +7 -7
- data/test/ffi-gobject_introspection/i_vfunc_info_test.rb +16 -16
- data/test/ffi-gobject_introspection/lib_test.rb +3 -3
- data/test/ffi-gobject_introspection/strv_test.rb +9 -9
- data/test/ffi-gobject_test.rb +44 -44
- data/test/gir_ffi/allocation_helper_test.rb +13 -13
- data/test/gir_ffi/arg_helper_test.rb +63 -64
- data/test/gir_ffi/boolean_test.rb +20 -20
- data/test/gir_ffi/boxed_base_test.rb +18 -18
- data/test/gir_ffi/builder_test.rb +115 -93
- data/test/gir_ffi/builders/argument_builder_test.rb +280 -286
- data/test/gir_ffi/builders/base_argument_builder_test.rb +1 -1
- data/test/gir_ffi/builders/callback_argument_builder_test.rb +53 -56
- data/test/gir_ffi/builders/callback_builder_test.rb +71 -72
- data/test/gir_ffi/builders/callback_return_value_builder_test.rb +36 -40
- data/test/gir_ffi/builders/constant_builder_test.rb +1 -1
- data/test/gir_ffi/builders/constructor_builder_test.rb +10 -10
- data/test/gir_ffi/builders/enum_builder_test.rb +10 -10
- data/test/gir_ffi/builders/field_builder_test.rb +42 -42
- data/test/gir_ffi/builders/function_builder_test.rb +236 -224
- data/test/gir_ffi/builders/initializer_builder_test.rb +14 -14
- data/test/gir_ffi/builders/interface_builder_test.rb +9 -9
- data/test/gir_ffi/builders/module_builder_test.rb +18 -18
- data/test/gir_ffi/builders/object_builder_test.rb +38 -38
- data/test/gir_ffi/builders/property_builder_test.rb +91 -94
- data/test/gir_ffi/builders/registered_type_builder_test.rb +35 -11
- data/test/gir_ffi/builders/return_value_builder_test.rb +215 -222
- data/test/gir_ffi/builders/signal_closure_builder_test.rb +122 -113
- data/test/gir_ffi/builders/struct_builder_test.rb +32 -32
- data/test/gir_ffi/builders/unintrospectable_boxed_builder_test.rb +8 -14
- data/test/gir_ffi/builders/unintrospectable_builder_test.rb +23 -23
- data/test/gir_ffi/builders/union_builder_test.rb +12 -15
- data/test/gir_ffi/builders/user_defined_builder_test.rb +147 -147
- data/test/gir_ffi/builders/vfunc_argument_builder_test.rb +40 -40
- data/test/gir_ffi/builders/vfunc_builder_test.rb +145 -157
- data/test/gir_ffi/callback_base_test.rb +9 -9
- data/test/gir_ffi/class_base_test.rb +49 -51
- data/test/gir_ffi/core_test.rb +32 -32
- data/test/gir_ffi/enum_base_test.rb +19 -19
- data/test/gir_ffi/error_type_info_test.rb +23 -23
- data/test/gir_ffi/ffi_ext/pointer_test.rb +5 -5
- data/test/gir_ffi/g_type_test.rb +11 -11
- data/test/gir_ffi/in_pointer_test.rb +70 -50
- data/test/gir_ffi/info_ext/i_callable_info_test.rb +5 -5
- data/test/gir_ffi/info_ext/i_callback_info_test.rb +4 -4
- data/test/gir_ffi/info_ext/i_field_info_test.rb +6 -6
- data/test/gir_ffi/info_ext/i_function_info_test.rb +17 -17
- data/test/gir_ffi/info_ext/i_signal_info_test.rb +8 -8
- data/test/gir_ffi/info_ext/i_type_info_test.rb +229 -215
- data/test/gir_ffi/info_ext/i_unresolved_info_test.rb +4 -4
- data/test/gir_ffi/info_ext/safe_constant_name_test.rb +8 -8
- data/test/gir_ffi/info_ext/safe_function_name_test.rb +8 -8
- data/test/gir_ffi/interface_base_test.rb +8 -8
- data/test/gir_ffi/method_stubber_test.rb +19 -19
- data/test/gir_ffi/object_base_test.rb +19 -19
- data/test/gir_ffi/object_store_test.rb +13 -13
- data/test/gir_ffi/receiver_argument_info_test.rb +15 -15
- data/test/gir_ffi/sized_array_test.rb +68 -68
- data/test/gir_ffi/struct_base_test.rb +8 -8
- data/test/gir_ffi/struct_like_base_test.rb +64 -64
- data/test/gir_ffi/type_map_test.rb +6 -6
- data/test/gir_ffi/unintrospectable_type_info_test.rb +33 -33
- data/test/gir_ffi/union_base_test.rb +8 -8
- data/test/gir_ffi/user_defined_object_info_test.rb +34 -34
- data/test/gir_ffi/user_defined_property_info_test.rb +16 -16
- data/test/gir_ffi/variable_name_generator_test.rb +8 -8
- data/test/gir_ffi/version_test.rb +4 -4
- data/test/gir_ffi/zero_terminated_test.rb +34 -34
- data/test/gir_ffi_test_helper.rb +3 -3
- data/test/integration/callback_exceptions_test.rb +17 -21
- data/test/integration/derived_classes_test.rb +13 -13
- data/test/integration/generated_everything_test.rb +224 -224
- data/test/integration/generated_gimarshallingtests_test.rb +1118 -1017
- data/test/integration/generated_gio_test.rb +36 -36
- data/test/integration/generated_glib_test.rb +4 -6
- data/test/integration/generated_gobject_test.rb +43 -35
- data/test/integration/generated_gst_test.rb +16 -16
- data/test/integration/generated_gtk_source_test.rb +22 -17
- data/test/integration/generated_gtop_test.rb +8 -15
- data/test/integration/generated_pango_ft2_test.rb +2 -2
- data/test/integration/generated_pango_test.rb +4 -4
- data/test/integration/generated_regress_test.rb +1809 -1621
- data/test/integration/generated_secret_test.rb +8 -11
- data/test/integration/generated_utility_test.rb +81 -81
- data/test/integration/generated_warnlib_test.rb +13 -19
- data/test/integration/method_lookup_test.rb +6 -6
- data/test/introspection_test_helper.rb +48 -7
- data/test/minitest/stats_plugin.rb +1 -1
- metadata +11 -28
- data/lib/ffi-glib/array_methods.rb +0 -16
- data/test/gir_ffi/in_out_pointer_test.rb +0 -56
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "gir_ffi_test_helper"
|
4
4
|
|
5
5
|
GirFFI.setup :Regress
|
6
6
|
|
@@ -13,20 +13,20 @@ describe GirFFI::InfoExt::ISignalInfo do
|
|
13
13
|
end
|
14
14
|
let(:signal_info) { signal_class.new }
|
15
15
|
|
16
|
-
describe
|
16
|
+
describe "#arguments_to_gvalues" do
|
17
17
|
let(:object) { Regress::TestSubObj.new }
|
18
18
|
let(:boxed) { Regress::TestSimpleBoxedA.const_return }
|
19
|
-
let(:signal_info) { Regress::TestSubObj.find_signal
|
19
|
+
let(:signal_info) { Regress::TestSubObj.find_signal "test-with-static-scope-arg" }
|
20
20
|
let(:result) { signal_info.arguments_to_gvalues(object, [boxed]) }
|
21
21
|
|
22
|
-
it
|
23
|
-
result[0].get_value.must_equal object
|
22
|
+
it "correctly wraps :object" do
|
23
|
+
_(result[0].get_value).must_equal object
|
24
24
|
end
|
25
25
|
|
26
|
-
it
|
26
|
+
it "correctly wraps :struct" do
|
27
27
|
result_boxed = result[1].get_value
|
28
|
-
result_boxed.some_int8.must_equal boxed.some_int8
|
29
|
-
result_boxed.some_int.must_equal boxed.some_int
|
28
|
+
_(result_boxed.some_int8).must_equal boxed.some_int8
|
29
|
+
_(result_boxed.some_int).must_equal boxed.some_int
|
30
30
|
end
|
31
31
|
end
|
32
32
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "gir_ffi_test_helper"
|
4
4
|
|
5
5
|
describe GirFFI::InfoExt::ITypeInfo do
|
6
6
|
let(:info_class) do
|
@@ -16,15 +16,15 @@ describe GirFFI::InfoExt::ITypeInfo do
|
|
16
16
|
let(:iface_info) { Object.new }
|
17
17
|
|
18
18
|
let(:callback_type_info) do
|
19
|
-
get_introspection_data(
|
19
|
+
get_introspection_data("Regress", "test_callback").args[0].argument_type
|
20
20
|
end
|
21
21
|
let(:ghash_type_info) do
|
22
|
-
get_introspection_data(
|
23
|
-
|
22
|
+
get_introspection_data("Regress",
|
23
|
+
"test_ghash_nested_everything_return").return_type
|
24
24
|
end
|
25
25
|
|
26
|
-
describe
|
27
|
-
it
|
26
|
+
describe "#to_ffi_type" do
|
27
|
+
it "returns an array with elements subtype and size for type :array" do
|
28
28
|
expect(type_info).to receive(:pointer?).and_return false
|
29
29
|
allow(type_info).to receive(:tag).and_return :array
|
30
30
|
expect(type_info).to receive(:array_fixed_size).and_return 2
|
@@ -36,7 +36,7 @@ describe GirFFI::InfoExt::ITypeInfo do
|
|
36
36
|
assert_equal [:foo, 2], result
|
37
37
|
end
|
38
38
|
|
39
|
-
describe
|
39
|
+
describe "for an :interface type" do
|
40
40
|
before do
|
41
41
|
allow(type_info).to receive(:interface).and_return iface_info
|
42
42
|
allow(type_info).to receive(:tag).and_return :interface
|
@@ -46,13 +46,13 @@ describe GirFFI::InfoExt::ITypeInfo do
|
|
46
46
|
it "maps a the interface's ffi_type" do
|
47
47
|
allow(iface_info).to receive(:to_ffi_type).and_return :foo
|
48
48
|
|
49
|
-
type_info.to_ffi_type.must_equal :foo
|
49
|
+
_(type_info.to_ffi_type).must_equal :foo
|
50
50
|
end
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
54
|
-
describe
|
55
|
-
it
|
54
|
+
describe "#element_type" do
|
55
|
+
it "returns the element type for lists" do
|
56
56
|
allow(elmtype_info).to receive(:tag).and_return :foo
|
57
57
|
expect(elmtype_info).to receive(:pointer?).and_return false
|
58
58
|
|
@@ -60,10 +60,10 @@ describe GirFFI::InfoExt::ITypeInfo do
|
|
60
60
|
expect(type_info).to receive(:param_type).with(0).and_return elmtype_info
|
61
61
|
|
62
62
|
result = type_info.element_type
|
63
|
-
result.must_equal :foo
|
63
|
+
_(result).must_equal :foo
|
64
64
|
end
|
65
65
|
|
66
|
-
it
|
66
|
+
it "returns the key and value types for ghashes" do
|
67
67
|
allow(keytype_info).to receive(:tag).and_return :foo
|
68
68
|
expect(keytype_info).to receive(:pointer?).and_return false
|
69
69
|
allow(valtype_info).to receive(:tag).and_return :bar
|
@@ -74,17 +74,17 @@ describe GirFFI::InfoExt::ITypeInfo do
|
|
74
74
|
expect(type_info).to receive(:param_type).with(1).and_return valtype_info
|
75
75
|
|
76
76
|
result = type_info.element_type
|
77
|
-
result.must_equal [:foo, :bar]
|
77
|
+
_(result).must_equal [:foo, :bar]
|
78
78
|
end
|
79
79
|
|
80
|
-
it
|
80
|
+
it "returns nil for other types" do
|
81
81
|
expect(type_info).to receive(:tag).and_return :foo
|
82
82
|
|
83
83
|
result = type_info.element_type
|
84
|
-
result.must_be_nil
|
84
|
+
_(result).must_be_nil
|
85
85
|
end
|
86
86
|
|
87
|
-
it
|
87
|
+
it "returns [:pointer, :void] if the element type is a pointer with tag :void" do
|
88
88
|
allow(elmtype_info).to receive(:tag_or_class).and_return [:pointer, :void]
|
89
89
|
|
90
90
|
expect(type_info).to receive(:tag).and_return :glist
|
@@ -94,100 +94,100 @@ describe GirFFI::InfoExt::ITypeInfo do
|
|
94
94
|
end
|
95
95
|
end
|
96
96
|
|
97
|
-
describe
|
98
|
-
describe
|
99
|
-
it
|
97
|
+
describe "#flattened_tag" do
|
98
|
+
describe "for a simple type" do
|
99
|
+
it "returns the type tag" do
|
100
100
|
allow(type_info).to receive(:tag).and_return :uint32
|
101
101
|
|
102
|
-
type_info.flattened_tag.must_equal :uint32
|
102
|
+
_(type_info.flattened_tag).must_equal :uint32
|
103
103
|
end
|
104
104
|
end
|
105
105
|
|
106
|
-
describe
|
106
|
+
describe "for a zero-terminated array" do
|
107
107
|
before do
|
108
108
|
allow(type_info).to receive(:tag).and_return :array
|
109
109
|
allow(type_info).to receive(:param_type).with(0).and_return elmtype_info
|
110
110
|
allow(type_info).to receive(:zero_terminated?).and_return true
|
111
111
|
end
|
112
112
|
|
113
|
-
describe
|
114
|
-
it
|
113
|
+
describe "of utf8" do
|
114
|
+
it "returns :strv" do
|
115
115
|
allow(elmtype_info).to receive(:tag).and_return :utf8
|
116
116
|
allow(elmtype_info).to receive(:pointer?).and_return true
|
117
117
|
|
118
|
-
type_info.flattened_tag.must_equal :strv
|
118
|
+
_(type_info.flattened_tag).must_equal :strv
|
119
119
|
end
|
120
120
|
end
|
121
121
|
|
122
|
-
describe
|
123
|
-
it
|
122
|
+
describe "of filename" do
|
123
|
+
it "returns :strv" do
|
124
124
|
allow(elmtype_info).to receive(:tag).and_return :filename
|
125
125
|
allow(elmtype_info).to receive(:pointer?).and_return true
|
126
126
|
|
127
|
-
type_info.flattened_tag.must_equal :strv
|
127
|
+
_(type_info.flattened_tag).must_equal :strv
|
128
128
|
end
|
129
129
|
end
|
130
130
|
|
131
|
-
describe
|
132
|
-
it
|
131
|
+
describe "of another type" do
|
132
|
+
it "returns :zero_terminated" do
|
133
133
|
allow(elmtype_info).to receive(:tag).and_return :foo
|
134
134
|
allow(elmtype_info).to receive(:pointer?).and_return false
|
135
135
|
|
136
|
-
type_info.flattened_tag.must_equal :zero_terminated
|
136
|
+
_(type_info.flattened_tag).must_equal :zero_terminated
|
137
137
|
end
|
138
138
|
end
|
139
139
|
end
|
140
140
|
|
141
|
-
describe
|
142
|
-
it
|
141
|
+
describe "for a fixed length c-like array" do
|
142
|
+
it "returns :c" do
|
143
143
|
expect(type_info).to receive(:tag).and_return :array
|
144
144
|
expect(type_info).to receive(:zero_terminated?).and_return false
|
145
145
|
expect(type_info).to receive(:array_type).and_return :c
|
146
146
|
|
147
|
-
type_info.flattened_tag.must_equal :c
|
147
|
+
_(type_info.flattened_tag).must_equal :c
|
148
148
|
end
|
149
149
|
end
|
150
150
|
|
151
|
-
describe
|
152
|
-
it
|
151
|
+
describe "for a GLib array" do
|
152
|
+
it "returns :c" do
|
153
153
|
expect(type_info).to receive(:tag).and_return :array
|
154
154
|
expect(type_info).to receive(:zero_terminated?).and_return false
|
155
155
|
expect(type_info).to receive(:array_type).and_return :array
|
156
156
|
|
157
|
-
type_info.flattened_tag.must_equal :array
|
157
|
+
_(type_info.flattened_tag).must_equal :array
|
158
158
|
end
|
159
159
|
end
|
160
160
|
end
|
161
161
|
|
162
|
-
describe
|
163
|
-
describe
|
162
|
+
describe "#tag_or_class" do
|
163
|
+
describe "for a simple type" do
|
164
164
|
it "returns the type's tag" do
|
165
165
|
allow(type_info).to receive(:tag).and_return :foo
|
166
166
|
expect(type_info).to receive(:pointer?).and_return false
|
167
167
|
|
168
|
-
type_info.tag_or_class.must_equal :foo
|
168
|
+
_(type_info.tag_or_class).must_equal :foo
|
169
169
|
end
|
170
170
|
end
|
171
171
|
|
172
|
-
describe
|
173
|
-
it
|
172
|
+
describe "for utf8 strings" do
|
173
|
+
it "returns the tag :utf8" do
|
174
174
|
allow(type_info).to receive(:tag).and_return :utf8
|
175
175
|
expect(type_info).to receive(:pointer?).and_return true
|
176
176
|
|
177
|
-
type_info.tag_or_class.must_equal :utf8
|
177
|
+
_(type_info.tag_or_class).must_equal :utf8
|
178
178
|
end
|
179
179
|
end
|
180
180
|
|
181
|
-
describe
|
182
|
-
it
|
181
|
+
describe "for filename strings" do
|
182
|
+
it "returns the tag :filename" do
|
183
183
|
allow(type_info).to receive(:tag).and_return :filename
|
184
184
|
expect(type_info).to receive(:pointer?).and_return true
|
185
185
|
|
186
|
-
type_info.tag_or_class.must_equal :filename
|
186
|
+
_(type_info.tag_or_class).must_equal :filename
|
187
187
|
end
|
188
188
|
end
|
189
189
|
|
190
|
-
describe
|
190
|
+
describe "for an interface class" do
|
191
191
|
let(:interface) { Object.new }
|
192
192
|
|
193
193
|
before do
|
@@ -198,58 +198,58 @@ describe GirFFI::InfoExt::ITypeInfo do
|
|
198
198
|
expect(GirFFI::Builder).to receive(:build_class).with(iface_info).and_return interface
|
199
199
|
end
|
200
200
|
|
201
|
-
describe
|
202
|
-
it
|
201
|
+
describe "when the interface type is :enum" do
|
202
|
+
it "returns the built interface module" do
|
203
203
|
allow(iface_info).to receive(:info_type).and_return :enum
|
204
204
|
|
205
|
-
type_info.tag_or_class.must_equal interface
|
205
|
+
_(type_info.tag_or_class).must_equal interface
|
206
206
|
end
|
207
207
|
end
|
208
208
|
|
209
|
-
describe
|
210
|
-
it
|
209
|
+
describe "when the interface type is :object" do
|
210
|
+
it "returns the built interface class" do
|
211
211
|
allow(iface_info).to receive(:info_type).and_return :object
|
212
212
|
|
213
|
-
type_info.tag_or_class.must_equal interface
|
213
|
+
_(type_info.tag_or_class).must_equal interface
|
214
214
|
end
|
215
215
|
end
|
216
216
|
|
217
|
-
describe
|
218
|
-
it
|
217
|
+
describe "when the interface type is :struct" do
|
218
|
+
it "returns the built interface class" do
|
219
219
|
allow(iface_info).to receive(:info_type).and_return :struct
|
220
220
|
|
221
|
-
type_info.tag_or_class.must_equal interface
|
221
|
+
_(type_info.tag_or_class).must_equal interface
|
222
222
|
end
|
223
223
|
end
|
224
224
|
end
|
225
225
|
|
226
|
-
describe
|
226
|
+
describe "for a callback" do
|
227
227
|
it "returns the callback's wrapper class" do
|
228
|
-
callback_type_info.tag_or_class.must_equal Regress::TestCallback
|
228
|
+
_(callback_type_info.tag_or_class).must_equal Regress::TestCallback
|
229
229
|
end
|
230
230
|
end
|
231
231
|
|
232
|
-
describe
|
233
|
-
it
|
232
|
+
describe "for a pointer to simple type :foo" do
|
233
|
+
it "returns [:pointer, :foo]" do
|
234
234
|
allow(type_info).to receive(:tag).and_return :foo
|
235
235
|
expect(type_info).to receive(:pointer?).and_return true
|
236
236
|
|
237
|
-
type_info.tag_or_class.must_equal [:pointer, :foo]
|
237
|
+
_(type_info.tag_or_class).must_equal [:pointer, :foo]
|
238
238
|
end
|
239
239
|
end
|
240
240
|
|
241
|
-
describe
|
242
|
-
it
|
241
|
+
describe "for a pointer to :void" do
|
242
|
+
it "returns [:pointer, :void]" do
|
243
243
|
allow(type_info).to receive(:tag).and_return :void
|
244
244
|
allow(type_info).to receive(:pointer?).and_return true
|
245
245
|
|
246
|
-
type_info.tag_or_class.must_equal [:pointer, :void]
|
246
|
+
_(type_info.tag_or_class).must_equal [:pointer, :void]
|
247
247
|
end
|
248
248
|
end
|
249
249
|
|
250
|
-
describe
|
251
|
-
it
|
252
|
-
ghash_type_info.tag_or_class.must_equal(
|
250
|
+
describe "for a complex nested hash type" do
|
251
|
+
it "returns a representeation of the nested structure" do
|
252
|
+
_(ghash_type_info.tag_or_class).must_equal(
|
253
253
|
[:pointer,
|
254
254
|
[:ghash,
|
255
255
|
:utf8,
|
@@ -259,34 +259,34 @@ describe GirFFI::InfoExt::ITypeInfo do
|
|
259
259
|
end
|
260
260
|
end
|
261
261
|
|
262
|
-
describe
|
263
|
-
describe
|
262
|
+
describe "#to_callback_ffi_type" do
|
263
|
+
describe "for an :interface argument" do
|
264
264
|
before do
|
265
265
|
allow(type_info).to receive(:interface).and_return iface_info
|
266
266
|
allow(type_info).to receive(:tag).and_return :interface
|
267
267
|
allow(type_info).to receive(:pointer?).and_return false
|
268
268
|
end
|
269
269
|
|
270
|
-
it
|
270
|
+
it "delegates to interface info" do
|
271
271
|
allow(iface_info).to receive(:to_callback_ffi_type).and_return :some_ffi_type
|
272
272
|
|
273
|
-
type_info.to_callback_ffi_type.must_equal :some_ffi_type
|
273
|
+
_(type_info.to_callback_ffi_type).must_equal :some_ffi_type
|
274
274
|
end
|
275
275
|
end
|
276
276
|
end
|
277
277
|
|
278
|
-
describe
|
279
|
-
describe
|
278
|
+
describe "#extra_conversion_arguments" do
|
279
|
+
describe "for normal types" do
|
280
280
|
before do
|
281
281
|
allow(type_info).to receive(:tag).and_return :foo
|
282
282
|
end
|
283
283
|
|
284
|
-
it
|
285
|
-
type_info.extra_conversion_arguments.must_equal []
|
284
|
+
it "returns an empty array" do
|
285
|
+
_(type_info.extra_conversion_arguments).must_equal []
|
286
286
|
end
|
287
287
|
end
|
288
288
|
|
289
|
-
describe
|
289
|
+
describe "for a fixed-size array" do
|
290
290
|
before do
|
291
291
|
allow(type_info).to receive(:tag).and_return :array
|
292
292
|
allow(type_info).to receive(:zero_terminated?).and_return false
|
@@ -297,12 +297,12 @@ describe GirFFI::InfoExt::ITypeInfo do
|
|
297
297
|
allow(elmtype_info).to receive(:tag_or_class).and_return :foo
|
298
298
|
end
|
299
299
|
|
300
|
-
it
|
301
|
-
type_info.extra_conversion_arguments.must_equal [:foo, 3]
|
300
|
+
it "returns an array containing the element type" do
|
301
|
+
_(type_info.extra_conversion_arguments).must_equal [:foo, 3]
|
302
302
|
end
|
303
303
|
end
|
304
304
|
|
305
|
-
describe
|
305
|
+
describe "for a zero-terminated array" do
|
306
306
|
before do
|
307
307
|
allow(type_info).to receive(:tag).and_return :array
|
308
308
|
allow(type_info).to receive(:zero_terminated?).and_return true
|
@@ -311,12 +311,12 @@ describe GirFFI::InfoExt::ITypeInfo do
|
|
311
311
|
allow(elmtype_info).to receive(:tag_or_class).and_return :foo
|
312
312
|
end
|
313
313
|
|
314
|
-
it
|
315
|
-
type_info.extra_conversion_arguments.must_equal [:foo]
|
314
|
+
it "returns an array containing the element type" do
|
315
|
+
_(type_info.extra_conversion_arguments).must_equal [:foo]
|
316
316
|
end
|
317
317
|
end
|
318
318
|
|
319
|
-
describe
|
319
|
+
describe "for a GArray" do
|
320
320
|
before do
|
321
321
|
allow(type_info).to receive(:tag).and_return :array
|
322
322
|
allow(type_info).to receive(:zero_terminated?).and_return false
|
@@ -326,12 +326,12 @@ describe GirFFI::InfoExt::ITypeInfo do
|
|
326
326
|
allow(elmtype_info).to receive(:tag_or_class).and_return :foo
|
327
327
|
end
|
328
328
|
|
329
|
-
it
|
330
|
-
type_info.extra_conversion_arguments.must_equal [:foo]
|
329
|
+
it "returns an array containing the element type" do
|
330
|
+
_(type_info.extra_conversion_arguments).must_equal [:foo]
|
331
331
|
end
|
332
332
|
end
|
333
333
|
|
334
|
-
describe
|
334
|
+
describe "for a GHashTable" do
|
335
335
|
before do
|
336
336
|
allow(type_info).to receive(:tag).and_return :ghash
|
337
337
|
allow(type_info).to receive(:param_type).with(0).and_return keytype_info
|
@@ -341,12 +341,12 @@ describe GirFFI::InfoExt::ITypeInfo do
|
|
341
341
|
allow(valtype_info).to receive(:tag_or_class).and_return :bar
|
342
342
|
end
|
343
343
|
|
344
|
-
it
|
345
|
-
type_info.extra_conversion_arguments.must_equal [[:foo, :bar]]
|
344
|
+
it "returns an array containing the element type pair" do
|
345
|
+
_(type_info.extra_conversion_arguments).must_equal [[:foo, :bar]]
|
346
346
|
end
|
347
347
|
end
|
348
348
|
|
349
|
-
describe
|
349
|
+
describe "for a GList" do
|
350
350
|
before do
|
351
351
|
allow(type_info).to receive(:tag).and_return :glist
|
352
352
|
|
@@ -354,12 +354,12 @@ describe GirFFI::InfoExt::ITypeInfo do
|
|
354
354
|
allow(elmtype_info).to receive(:tag_or_class).and_return :foo
|
355
355
|
end
|
356
356
|
|
357
|
-
it
|
358
|
-
type_info.extra_conversion_arguments.must_equal [:foo]
|
357
|
+
it "returns an array containing the element type" do
|
358
|
+
_(type_info.extra_conversion_arguments).must_equal [:foo]
|
359
359
|
end
|
360
360
|
end
|
361
361
|
|
362
|
-
describe
|
362
|
+
describe "for a GSList" do
|
363
363
|
before do
|
364
364
|
allow(type_info).to receive(:tag).and_return :gslist
|
365
365
|
|
@@ -367,12 +367,12 @@ describe GirFFI::InfoExt::ITypeInfo do
|
|
367
367
|
allow(elmtype_info).to receive(:tag_or_class).and_return :foo
|
368
368
|
end
|
369
369
|
|
370
|
-
it
|
371
|
-
type_info.extra_conversion_arguments.must_equal [:foo]
|
370
|
+
it "returns an array containing the element type" do
|
371
|
+
_(type_info.extra_conversion_arguments).must_equal [:foo]
|
372
372
|
end
|
373
373
|
end
|
374
374
|
|
375
|
-
describe
|
375
|
+
describe "for a GPtrArray" do
|
376
376
|
before do
|
377
377
|
allow(type_info).to receive(:tag).and_return :array
|
378
378
|
allow(type_info).to receive(:zero_terminated?).and_return false
|
@@ -382,313 +382,327 @@ describe GirFFI::InfoExt::ITypeInfo do
|
|
382
382
|
allow(elmtype_info).to receive(:tag_or_class).and_return :foo
|
383
383
|
end
|
384
384
|
|
385
|
-
it
|
386
|
-
type_info.extra_conversion_arguments.must_equal [:foo]
|
385
|
+
it "returns an array containing the element type" do
|
386
|
+
_(type_info.extra_conversion_arguments).must_equal [:foo]
|
387
387
|
end
|
388
388
|
end
|
389
389
|
|
390
|
-
describe
|
390
|
+
describe "for a :callback" do
|
391
391
|
before do
|
392
|
-
allow(interface_type_info = Object.new).to receive(:namespace).and_return
|
393
|
-
allow(interface_type_info).to receive(:name).and_return
|
392
|
+
allow(interface_type_info = Object.new).to receive(:namespace).and_return "Bar"
|
393
|
+
allow(interface_type_info).to receive(:name).and_return "Foo"
|
394
394
|
|
395
395
|
allow(type_info).to receive(:tag).and_return :callback
|
396
396
|
allow(type_info).to receive(:interface).and_return interface_type_info
|
397
397
|
end
|
398
398
|
|
399
|
-
it
|
400
|
-
type_info.extra_conversion_arguments.must_equal []
|
399
|
+
it "returns an empty array" do
|
400
|
+
_(type_info.extra_conversion_arguments).must_equal []
|
401
401
|
end
|
402
402
|
end
|
403
403
|
end
|
404
404
|
|
405
|
-
describe
|
405
|
+
describe "#argument_class_name" do
|
406
406
|
before do
|
407
407
|
allow(type_info).to receive(:tag).and_return tag
|
408
408
|
end
|
409
409
|
|
410
|
-
describe
|
410
|
+
describe "for :gint32" do
|
411
411
|
let(:tag) { :gint32 }
|
412
412
|
|
413
|
-
it
|
414
|
-
type_info.argument_class_name.must_be_nil
|
413
|
+
it "is nil" do
|
414
|
+
_(type_info.argument_class_name).must_be_nil
|
415
415
|
end
|
416
416
|
end
|
417
417
|
|
418
|
-
describe
|
418
|
+
describe "for interfaces" do
|
419
419
|
let(:tag) { :interface }
|
420
420
|
|
421
421
|
before do
|
422
422
|
allow(type_info).to receive(:interface).and_return iface_info
|
423
423
|
allow(iface_info).to receive(:info_type).and_return interface_type
|
424
|
-
allow(iface_info).to receive(:full_type_name).and_return
|
424
|
+
allow(iface_info).to receive(:full_type_name).and_return "Bar::Foo"
|
425
425
|
end
|
426
426
|
|
427
|
-
describe
|
427
|
+
describe "for :struct" do
|
428
428
|
let(:interface_type) { :struct }
|
429
|
-
it
|
430
|
-
type_info.argument_class_name.must_equal
|
429
|
+
it "equals the struct class name" do
|
430
|
+
_(type_info.argument_class_name).must_equal "Bar::Foo"
|
431
431
|
end
|
432
432
|
end
|
433
433
|
|
434
|
-
describe
|
434
|
+
describe "for :union" do
|
435
435
|
let(:interface_type) { :union }
|
436
|
-
it
|
437
|
-
type_info.argument_class_name.must_equal
|
436
|
+
it "equals the union class name" do
|
437
|
+
_(type_info.argument_class_name).must_equal "Bar::Foo"
|
438
438
|
end
|
439
439
|
end
|
440
440
|
|
441
|
-
describe
|
441
|
+
describe "for :interface" do
|
442
442
|
let(:interface_type) { :interface }
|
443
443
|
|
444
|
-
it
|
445
|
-
type_info.argument_class_name.must_equal
|
444
|
+
it "equals the interface module name" do
|
445
|
+
_(type_info.argument_class_name).must_equal "Bar::Foo"
|
446
446
|
end
|
447
447
|
end
|
448
448
|
|
449
|
-
describe
|
449
|
+
describe "for :object" do
|
450
450
|
let(:interface_type) { :object }
|
451
451
|
|
452
|
-
it
|
453
|
-
type_info.argument_class_name.must_equal
|
452
|
+
it "equals the object class name" do
|
453
|
+
_(type_info.argument_class_name).must_equal "Bar::Foo"
|
454
454
|
end
|
455
455
|
end
|
456
456
|
|
457
|
-
describe
|
457
|
+
describe "for :callback" do
|
458
458
|
let(:interface_type) { :callback }
|
459
459
|
|
460
|
-
it
|
461
|
-
type_info.argument_class_name.must_equal
|
460
|
+
it "equals the callback type name" do
|
461
|
+
_(type_info.argument_class_name).must_equal "Bar::Foo"
|
462
462
|
end
|
463
463
|
end
|
464
464
|
end
|
465
465
|
|
466
|
-
describe
|
466
|
+
describe "for :strv" do
|
467
467
|
let(:tag) { :strv }
|
468
468
|
|
469
|
-
it
|
470
|
-
type_info.argument_class_name.must_equal
|
469
|
+
it "equals GLib::Strv" do
|
470
|
+
_(type_info.argument_class_name).must_equal "GLib::Strv"
|
471
471
|
end
|
472
472
|
end
|
473
473
|
|
474
|
-
describe
|
474
|
+
describe "for arrays" do
|
475
475
|
let(:tag) { :array }
|
476
476
|
before do
|
477
477
|
allow(type_info).to receive(:param_type).with(0).and_return elmtype_info
|
478
478
|
allow(elmtype_info).to receive(:tag_or_class).and_return :foo
|
479
479
|
end
|
480
480
|
|
481
|
-
describe
|
481
|
+
describe "for :zero_terminated" do
|
482
482
|
before do
|
483
483
|
allow(type_info).to receive(:zero_terminated?).and_return true
|
484
484
|
end
|
485
485
|
|
486
|
-
it
|
487
|
-
type_info.argument_class_name.must_equal
|
486
|
+
it "equals GirFFI::ZeroTerminated" do
|
487
|
+
_(type_info.argument_class_name).must_equal "GirFFI::ZeroTerminated"
|
488
488
|
end
|
489
489
|
end
|
490
490
|
|
491
|
-
describe
|
491
|
+
describe "for :byte_array" do
|
492
492
|
before do
|
493
493
|
allow(type_info).to receive(:zero_terminated?).and_return false
|
494
494
|
allow(type_info).to receive(:array_type).and_return :byte_array
|
495
495
|
end
|
496
496
|
|
497
|
-
it
|
498
|
-
type_info.argument_class_name.must_equal
|
497
|
+
it "equals GLib::ByteArray" do
|
498
|
+
_(type_info.argument_class_name).must_equal "GLib::ByteArray"
|
499
499
|
end
|
500
500
|
end
|
501
501
|
|
502
|
-
describe
|
502
|
+
describe "for :ptr_array" do
|
503
503
|
before do
|
504
504
|
allow(type_info).to receive(:zero_terminated?).and_return false
|
505
505
|
allow(type_info).to receive(:array_type).and_return :ptr_array
|
506
506
|
end
|
507
507
|
|
508
|
-
it
|
509
|
-
type_info.argument_class_name.must_equal
|
508
|
+
it "equals GLib::PtrArray" do
|
509
|
+
_(type_info.argument_class_name).must_equal "GLib::PtrArray"
|
510
510
|
end
|
511
511
|
end
|
512
512
|
|
513
|
-
describe
|
513
|
+
describe "for :array" do
|
514
514
|
before do
|
515
515
|
allow(type_info).to receive(:zero_terminated?).and_return false
|
516
516
|
allow(type_info).to receive(:array_type).and_return :array
|
517
517
|
end
|
518
518
|
|
519
|
-
it
|
520
|
-
type_info.argument_class_name.must_equal
|
519
|
+
it "equals GLib::Array" do
|
520
|
+
_(type_info.argument_class_name).must_equal "GLib::Array"
|
521
521
|
end
|
522
522
|
end
|
523
523
|
end
|
524
524
|
|
525
|
-
describe
|
525
|
+
describe "for :glist" do
|
526
526
|
let(:tag) { :glist }
|
527
527
|
|
528
|
-
it
|
529
|
-
type_info.argument_class_name.must_equal
|
528
|
+
it "equals GLib::List" do
|
529
|
+
_(type_info.argument_class_name).must_equal "GLib::List"
|
530
530
|
end
|
531
531
|
end
|
532
532
|
|
533
|
-
describe
|
533
|
+
describe "for :gslist" do
|
534
534
|
let(:tag) { :gslist }
|
535
535
|
|
536
|
-
it
|
537
|
-
type_info.argument_class_name.must_equal
|
536
|
+
it "equals GLib::SList" do
|
537
|
+
_(type_info.argument_class_name).must_equal "GLib::SList"
|
538
538
|
end
|
539
539
|
end
|
540
540
|
|
541
|
-
describe
|
541
|
+
describe "for :ghash" do
|
542
542
|
let(:tag) { :ghash }
|
543
543
|
|
544
|
-
it
|
545
|
-
type_info.argument_class_name.must_equal
|
544
|
+
it "equals GLib::HashTable" do
|
545
|
+
_(type_info.argument_class_name).must_equal "GLib::HashTable"
|
546
546
|
end
|
547
547
|
end
|
548
548
|
|
549
|
-
describe
|
549
|
+
describe "for :error" do
|
550
550
|
let(:tag) { :error }
|
551
551
|
|
552
|
-
it
|
553
|
-
type_info.argument_class_name.must_equal
|
552
|
+
it "equals GLib::Error" do
|
553
|
+
_(type_info.argument_class_name).must_equal "GLib::Error"
|
554
554
|
end
|
555
555
|
end
|
556
556
|
end
|
557
557
|
|
558
|
-
describe
|
558
|
+
describe "#gtype" do
|
559
559
|
before do
|
560
560
|
allow(type_info).to receive(:tag).and_return tag
|
561
561
|
allow(type_info).to receive(:pointer?).and_return pointer?
|
562
562
|
end
|
563
563
|
|
564
|
-
describe
|
565
|
-
let(:tag) { :void }
|
564
|
+
describe "for non-pointers" do
|
566
565
|
let(:pointer?) { false }
|
566
|
+
describe "for :void" do
|
567
|
+
let(:tag) { :void }
|
567
568
|
|
568
|
-
|
569
|
-
|
569
|
+
it "equals the none type" do
|
570
|
+
_(GObject.type_name(type_info.gtype)).must_equal "void"
|
571
|
+
end
|
570
572
|
end
|
571
|
-
end
|
572
573
|
|
573
|
-
|
574
|
-
|
575
|
-
let(:pointer?) { true }
|
574
|
+
describe "for :gboolean" do
|
575
|
+
let(:tag) { :gboolean }
|
576
576
|
|
577
|
-
|
578
|
-
|
577
|
+
it "equals the gboolean type" do
|
578
|
+
_(GObject.type_name(type_info.gtype)).must_equal "gboolean"
|
579
|
+
end
|
579
580
|
end
|
580
|
-
end
|
581
581
|
|
582
|
-
|
583
|
-
|
584
|
-
let(:pointer?) { false }
|
582
|
+
describe "for :gint32" do
|
583
|
+
let(:tag) { :gint32 }
|
585
584
|
|
586
|
-
|
587
|
-
|
585
|
+
it "equals the gint type" do
|
586
|
+
_(GObject.type_name(type_info.gtype)).must_equal "gint"
|
587
|
+
end
|
588
588
|
end
|
589
|
-
end
|
590
589
|
|
591
|
-
|
592
|
-
|
593
|
-
let(:pointer?) { false }
|
590
|
+
describe "for :gint64" do
|
591
|
+
let(:tag) { :gint64 }
|
594
592
|
|
595
|
-
|
596
|
-
|
593
|
+
it "equals the gint64 type" do
|
594
|
+
_(GObject.type_name(type_info.gtype)).must_equal "gint64"
|
595
|
+
end
|
597
596
|
end
|
598
|
-
end
|
599
597
|
|
600
|
-
|
601
|
-
|
602
|
-
let(:pointer?) { false }
|
598
|
+
describe "for :guint64" do
|
599
|
+
let(:tag) { :guint64 }
|
603
600
|
|
604
|
-
|
605
|
-
|
601
|
+
it "equals the guint64 type" do
|
602
|
+
_(GObject.type_name(type_info.gtype)).must_equal "guint64"
|
603
|
+
end
|
606
604
|
end
|
607
605
|
end
|
608
606
|
|
609
|
-
describe
|
610
|
-
let(:
|
611
|
-
|
607
|
+
describe "for pointers" do
|
608
|
+
let(:pointer?) { true }
|
609
|
+
|
610
|
+
describe "to :void" do
|
611
|
+
let(:tag) { :void }
|
612
612
|
|
613
|
-
|
614
|
-
|
613
|
+
it "equals the gpointer type" do
|
614
|
+
_(GObject.type_name(type_info.gtype)).must_equal "gpointer"
|
615
|
+
end
|
615
616
|
end
|
616
|
-
end
|
617
617
|
|
618
|
-
|
619
|
-
|
620
|
-
let(:pointer?) { true }
|
618
|
+
describe "to :utf8" do
|
619
|
+
let(:tag) { :utf8 }
|
621
620
|
|
622
|
-
|
623
|
-
|
621
|
+
it "equals the gchararray type" do
|
622
|
+
_(GObject.type_name(type_info.gtype)).must_equal "gchararray"
|
623
|
+
end
|
624
624
|
end
|
625
|
-
end
|
626
625
|
|
627
|
-
|
628
|
-
|
629
|
-
let(:pointer?) { true }
|
626
|
+
describe "to :ghash" do
|
627
|
+
let(:tag) { :ghash }
|
630
628
|
|
631
|
-
|
632
|
-
|
629
|
+
it "equals the GHashTable type" do
|
630
|
+
_(GObject.type_name(type_info.gtype)).must_equal "GHashTable"
|
631
|
+
end
|
633
632
|
end
|
634
|
-
end
|
635
633
|
|
636
|
-
|
637
|
-
|
638
|
-
let(:pointer?) { true }
|
634
|
+
describe "to :glist" do
|
635
|
+
let(:tag) { :glist }
|
639
636
|
|
640
|
-
|
641
|
-
|
637
|
+
it "equals the pointer type" do
|
638
|
+
_(GObject.type_name(type_info.gtype)).must_equal "gpointer"
|
639
|
+
end
|
640
|
+
end
|
641
|
+
|
642
|
+
describe "to :error" do
|
643
|
+
let(:tag) { :error }
|
644
|
+
|
645
|
+
it "equals the gpointer type" do
|
646
|
+
_(GObject.type_name(type_info.gtype)).must_equal "gpointer"
|
647
|
+
end
|
648
|
+
end
|
649
|
+
|
650
|
+
describe "to :guint32" do
|
651
|
+
let(:tag) { :guint32 }
|
652
|
+
|
653
|
+
it "equals the gpointer type" do
|
654
|
+
_(GObject.type_name(type_info.gtype)).must_equal "gpointer"
|
655
|
+
end
|
642
656
|
end
|
643
657
|
end
|
644
658
|
|
645
|
-
describe
|
659
|
+
describe "for arrays" do
|
646
660
|
let(:tag) { :array }
|
647
661
|
let(:pointer?) { true }
|
648
662
|
|
649
|
-
describe
|
663
|
+
describe "for pointer to GArray" do
|
650
664
|
before do
|
651
665
|
allow(type_info).to receive(:zero_terminated?).and_return false
|
652
666
|
allow(type_info).to receive(:array_type).and_return :array
|
653
667
|
end
|
654
668
|
|
655
|
-
it
|
656
|
-
GObject.type_name(type_info.gtype).must_equal
|
669
|
+
it "equals the GArray type" do
|
670
|
+
_(GObject.type_name(type_info.gtype)).must_equal "GArray"
|
657
671
|
end
|
658
672
|
end
|
659
673
|
|
660
|
-
describe
|
674
|
+
describe "for a C array" do
|
661
675
|
before do
|
662
676
|
allow(type_info).to receive(:zero_terminated?).and_return false
|
663
677
|
allow(type_info).to receive(:array_type).and_return :c
|
664
678
|
end
|
665
679
|
|
666
|
-
it
|
667
|
-
GObject.type_name(type_info.gtype).must_equal
|
680
|
+
it "equals the gpointer type" do
|
681
|
+
_(GObject.type_name(type_info.gtype)).must_equal "gpointer"
|
668
682
|
end
|
669
683
|
end
|
670
684
|
|
671
|
-
describe
|
685
|
+
describe "for a zero-terminated array" do
|
672
686
|
before do
|
673
687
|
allow(type_info).to receive(:param_type).with(0).and_return elmtype_info
|
674
688
|
allow(type_info).to receive(:zero_terminated?).and_return true
|
675
689
|
end
|
676
690
|
|
677
|
-
describe
|
678
|
-
it
|
691
|
+
describe "of utf8" do
|
692
|
+
it "equals the GStrv type" do
|
679
693
|
allow(elmtype_info).to receive(:tag).and_return :utf8
|
680
694
|
allow(elmtype_info).to receive(:pointer?).and_return true
|
681
695
|
|
682
|
-
GObject.type_name(type_info.gtype).must_equal
|
696
|
+
_(GObject.type_name(type_info.gtype)).must_equal "GStrv"
|
683
697
|
end
|
684
698
|
end
|
685
699
|
|
686
|
-
describe
|
687
|
-
it
|
700
|
+
describe "of filename" do
|
701
|
+
it "equals the GStrv type" do
|
688
702
|
allow(elmtype_info).to receive(:tag).and_return :filename
|
689
703
|
allow(elmtype_info).to receive(:pointer?).and_return true
|
690
704
|
|
691
|
-
GObject.type_name(type_info.gtype).must_equal
|
705
|
+
_(GObject.type_name(type_info.gtype)).must_equal "GStrv"
|
692
706
|
end
|
693
707
|
end
|
694
708
|
end
|