Sha256: 64c5993a6c285e5e180dc2a7e7da96e770af723cac7ecc8a3b45dd395e4e79d9
Contents?: true
Size: 1.01 KB
Versions: 5
Compression:
Stored size: 1.01 KB
Contents
require File.expand_path('../gir_ffi_test_helper.rb', File.dirname(__FILE__)) describe GirFFI::InfoExt::IFieldInfo do describe "#layout_specification" do it "returns an array of name, typespec and offset" do testclass = Class.new do include GirFFI::InfoExt::IFieldInfo end mock(type = Object.new).layout_specification_type { :bar } field = testclass.new mock(field).name { "foo" } mock(field).field_type { type } mock(field).offset { 0 } result = field.layout_specification assert_equal [:foo, :bar, 0], result end it "keeps a complex typespec intact" do testclass = Class.new do include GirFFI::InfoExt::IFieldInfo end mock(type = Object.new).layout_specification_type { [:bar, 2] } field = testclass.new mock(field).name { "foo" } mock(field).field_type { type } mock(field).offset { 0 } result = field.layout_specification assert_equal [:foo, [:bar, 2], 0], result end end end
Version data entries
5 entries across 5 versions & 1 rubygems