Sha256: 9cd3c9fac0e6f178f0367b8e626e53a07d8f95e65254c0eeaf26aa6934196063

Contents?: true

Size: 580 Bytes

Versions: 3

Compression:

Stored size: 580 Bytes

Contents

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

describe GirFFI::ArgHelper do
  describe "::ptr_to_typed_array" do
    describe "for pointers to class types" do
      it "reads an array of pointers and wraps each in the class" do
        c = Class.new do
          def self.wrap a; "wrapped: #{a}"; end
        end

        mock(ptr = Object.new).read_array_of_pointer(2) { [:a, :b] }

        result = GirFFI::ArgHelper.ptr_to_typed_array [:pointer, c], ptr, 2

        assert_equal ["wrapped: a", "wrapped: b"], result
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
gir_ffi-0.2.3 test/unit/arg_helper_test.rb
gir_ffi-0.2.2 test/unit/arg_helper_test.rb
gir_ffi-0.2.1 test/unit/arg_helper_test.rb