Skip to content

Commit

Permalink
Import specs for Fiber#[] from MRI
Browse files Browse the repository at this point in the history
This removes one of our tests, and the new test is very minimal. This should be
extended, but at least it enables us to run the spec under Ruby 3.4.
  • Loading branch information
herwinw committed Dec 31, 2024
1 parent ecb47be commit 98b8557
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions core/fiber/storage_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,14 @@
key = :"#{self.class.name}#.#{self.object_id}"
Fiber.new { Fiber[key] = 42; Fiber[key] }.resume.should == 42
end
end

it "can't use invalid keys" do
invalid_keys = [Object.new, "Foo", 12]
invalid_keys.each do |key|
-> { Fiber[key] }.should raise_error(TypeError)
end
ruby_bug "#20978", "3.2.3"..."3.4" do
it "can use keys as strings" do
key = Object.new
def key.to_str; "Foo"; end
Fiber[key] = 42
Fiber["Foo"].should == 42
end
end

Expand Down

0 comments on commit 98b8557

Please sign in to comment.