Skip to content

Commit

Permalink
Add test for nested threads.
Browse files Browse the repository at this point in the history
  • Loading branch information
ioquatix committed May 2, 2024
1 parent ac223df commit 49eda78
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/fiber/local.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,22 @@ class MyThing
MyThing.fiber_local_attribute_name => be_equal(instance)
)
end

it "inherits assigned values in nested threads" do
instance = Object.new

storage = Thread.new do
MyThing.instance = instance

Thread.new do
Fiber.current.storage
end.value
end.value

expect(storage).to have_keys(
MyThing.fiber_local_attribute_name => be_equal(instance)
)
end
end

with '#instance=' do
Expand Down

0 comments on commit 49eda78

Please sign in to comment.