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.rb16
1 files changed, 15 insertions, 1 deletions
diff --git a/spec/ffi/struct_spec.rb b/spec/ffi/struct_spec.rb
index d09b7b6..ab62da1 100644
--- a/spec/ffi/struct_spec.rb
+++ b/spec/ffi/struct_spec.rb
@@ -545,7 +545,7 @@ module StructSpecsStructTests
expect(b.members).to eq([:a, :b])
end
- it "should be shareable for Ractor", :ractor do
+ it "can be made shareable for Ractor", :ractor do
a = Class.new(FFI::Struct) do
layout :a, :char
end.new
@@ -1109,6 +1109,20 @@ describe "Struct memsize functions", skip: RUBY_ENGINE != "ruby" do
size = ObjectSpace.memsize_of(layout[:pointer])
expect(size).to be > base_size
end
+
+ it "StructLayout should be shareable with Ractor", :ractor do
+ kl = Class.new(FFI::Struct) do
+ layout :ptr, :pointer
+ end
+ expect(Ractor.shareable?(kl.layout)).to eq(true)
+ end
+
+ it "StructField should be shareable with Ractor", :ractor do
+ kl = Class.new(FFI::Struct) do
+ layout :ptr, :pointer
+ end
+ expect(Ractor.shareable?(kl.layout[:ptr])).to eq(true)
+ end
end