Sha256: f699e12b7a687c0b42923329c2c113f4701ced287c3dff0873003562653e0ac3

Contents?: true

Size: 878 Bytes

Versions: 12

Compression:

Stored size: 878 Bytes

Contents

require 'gir_ffi_test_helper'

describe GirFFI::InfoExt::IFieldInfo do
  let(:klass) { Class.new do
    include GirFFI::InfoExt::IFieldInfo
  end }
  let(:field_info) { klass.new }
  describe "#layout_specification" do
    it "returns an array of name, typespec and offset" do
      mock(type = Object.new).to_ffitype { :bar }

      mock(field_info).name { "foo" }
      mock(field_info).field_type { type }
      mock(field_info).offset { 0 }

      result = field_info.layout_specification

      assert_equal [:foo, :bar, 0], result
    end

    it "keeps a complex typespec intact" do
      mock(type = Object.new).to_ffitype { [:bar, 2] }

      mock(field_info).name { "foo" }
      mock(field_info).field_type { type }
      mock(field_info).offset { 0 }

      result = field_info.layout_specification

      assert_equal [:foo, [:bar, 2], 0], result
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
gir_ffi-0.7.7 test/gir_ffi/info_ext/i_field_info_test.rb
gir_ffi-0.7.6 test/gir_ffi/info_ext/i_field_info_test.rb
gir_ffi-0.7.5 test/gir_ffi/info_ext/i_field_info_test.rb
gir_ffi-0.7.4 test/gir_ffi/info_ext/i_field_info_test.rb
gir_ffi-0.7.3 test/gir_ffi/info_ext/i_field_info_test.rb
gir_ffi-0.7.2 test/gir_ffi/info_ext/i_field_info_test.rb
gir_ffi-0.7.1 test/gir_ffi/info_ext/i_field_info_test.rb
gir_ffi-0.7.0 test/gir_ffi/info_ext/i_field_info_test.rb
gir_ffi-0.6.7 test/gir_ffi/info_ext/i_field_info_test.rb
gir_ffi-0.6.6 test/gir_ffi/info_ext/i_field_info_test.rb
gir_ffi-0.6.5 test/gir_ffi/info_ext/i_field_info_test.rb
gir_ffi-0.6.4 test/gir_ffi/info_ext/i_field_info_test.rb