summaryrefslogtreecommitdiff
path: root/spec/ffi/struct_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ffi/struct_spec.rb')
-rw-r--r--spec/ffi/struct_spec.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/ffi/struct_spec.rb b/spec/ffi/struct_spec.rb
index fb574d2..c28f372 100644
--- a/spec/ffi/struct_spec.rb
+++ b/spec/ffi/struct_spec.rb
@@ -1027,6 +1027,19 @@ describe "variable-length arrays" do
end
end
+describe "Struct memsize", skip: RUBY_ENGINE != "ruby" do
+ it "has a memsize function" do
+ base_size = ObjectSpace.memsize_of(Object.new)
+
+ c = Class.new(FFI::Struct) do
+ layout :b, :bool
+ end
+ struct = c.new
+ size = ObjectSpace.memsize_of(struct)
+ expect(size).to be > base_size
+ end
+end
+
describe "Struct order" do
before :all do
@struct = Class.new(FFI::Struct) do