Sha256: bffa7c355380574c32a9a64434e1e3690feb4fde0e0d33c2913691a517e72c5e
Contents?: true
Size: 972 Bytes
Versions: 9
Compression:
Stored size: 972 Bytes
Contents
# frozen_string_literal: true require 'gir_ffi_test_helper' describe GirFFI::ObjectStore do let(:store) { GirFFI::ObjectStore.new } describe '#store' do it 'returns a non-null pointer when storing objects' do obj = Object.new ptr = store.store obj ptr.wont_be :null? end it 'returns a null pointer when storing nil' do ptr = store.store nil ptr.must_be :null? end end describe '#fetch' do it 'returns the stored object when passed the key pointer' do obj = Object.new ptr = store.store obj result = store.fetch ptr result.must_equal obj end it 'returns the nil object when passed a null pointer' do ptr = FFI::Pointer.new(0) result = store.fetch ptr result.must_be_nil end it 'returns the pointer itself when passed an unknown pointer' do ptr = FFI::Pointer.new(42) result = store.fetch ptr result.must_equal ptr end end end
Version data entries
9 entries across 9 versions & 1 rubygems