Sha256: 26fad86412042415ac7c8c620775654c2a94c9dfd34e464d79449aafb4002804
Contents?: true
Size: 964 Bytes
Versions: 3
Compression:
Stored size: 964 Bytes
Contents
# # This file is part of ruby-ffi. # For licensing, see LICENSE.SPECS # require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper")) require 'ffi' describe FFI::Struct, ' with an initialize function' do it "should call the initialize function" do class StructWithInitialize < FFI::Struct layout :string, :string attr_accessor :magic def initialize super self.magic = 42 end end StructWithInitialize.new.magic.should == 42 end end describe FFI::ManagedStruct, ' with an initialize function' do it "should call the initialize function" do class ManagedStructWithInitialize < FFI::ManagedStruct layout :string, :string attr_accessor :magic def initialize super FFI::MemoryPointer.new(:pointer).put_int(0, 0x1234).get_pointer(0) self.magic = 42 end def self.release;end end ManagedStructWithInitialize.new.magic.should == 42 end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ffi-1.9.5-x64-mingw32 | spec/ffi/struct_initialize_spec.rb |
ffi-1.9.5-x86-mingw32 | spec/ffi/struct_initialize_spec.rb |
ffi-1.9.5 | spec/ffi/struct_initialize_spec.rb |