Sha256: cb9084e60653de9059d779b663372748600ab1640fdb954ce9d3a613f5fa8934

Contents?: true

Size: 755 Bytes

Versions: 6

Compression:

Stored size: 755 Bytes

Contents

require File.expand_path('../gir_ffi_test_helper.rb', File.dirname(__FILE__))
require "gir_ffi/callback_helper"

describe GirFFI::CallbackHelper do
  describe "::map_single_callback_arg" do
    it "maps a :struct type by building the type and wrapping the argument in it" do
      cinfo = get_introspection_data 'GObject', 'ClosureMarshal'
      ainfo = cinfo.args[0]
      ifinfo = ainfo.argument_type.interface

      assert_equal :struct, ifinfo.info_type

      struct_class = Class.new
      mock(GirFFI::Builder).build_class(ifinfo) { struct_class }
      mock(struct_class).wrap("dummy") { "good-result" }

      r = GirFFI::CallbackHelper.map_single_callback_arg "dummy", ainfo.argument_type

      assert_equal "good-result", r
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
gir_ffi-0.3.0 test/unit/callback_helper_test.rb
gir_ffi-0.2.3 test/unit/callback_helper_test.rb
gir_ffi-0.2.2 test/unit/callback_helper_test.rb
gir_ffi-0.2.1 test/unit/callback_helper_test.rb
gir_ffi-0.2.0 test/unit/callback_helper_test.rb
gir_ffi-0.1.0 test/unit/callback_helper_test.rb