Sha256: fb2c03ae7a29c607ff09afc3d1cf6136827f6f7d31fba06edd52c9632d03db81
Contents?: true
Size: 1.15 KB
Versions: 3
Compression:
Stored size: 1.15 KB
Contents
require 'gir_ffi_test_helper' describe GirFFI::InfoExt::IArgInfo do let(:klass) { Class.new do include GirFFI::InfoExt::IArgInfo end } let(:arg_info) { klass.new } describe "#cast_signal_argument" do describe "with info for an enum" do before do enuminfo = get_introspection_data 'GLib', 'DateMonth' stub(type_info = Object.new).interface { enuminfo } stub(type_info).tag { :interface } stub(arg_info).argument_type { type_info } end it "casts an integer to its enum symbol" do res = arg_info.cast_signal_argument 7 assert_equal :july, res end end describe "with info for an interface" do before do ifaceinfo = get_introspection_data 'Regress', 'TestInterface' stub(type_info = Object.new).interface { ifaceinfo } stub(type_info).tag { :interface } stub(arg_info).argument_type { type_info } end it "casts the argument by calling #to_object on it" do mock(ptr = Object.new).to_object { "good-result" } res = arg_info.cast_signal_argument ptr res.must_equal "good-result" end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
gir_ffi-0.6.6 | test/gir_ffi/info_ext/i_arg_info_test.rb |
gir_ffi-0.6.5 | test/gir_ffi/info_ext/i_arg_info_test.rb |
gir_ffi-0.6.4 | test/gir_ffi/info_ext/i_arg_info_test.rb |