Skip to content

Commit 98b8557

Browse files
committed
Import specs for Fiber#[] from MRI
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.
1 parent ecb47be commit 98b8557

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

core/fiber/storage_spec.rb

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,14 @@
9090
key = :"#{self.class.name}#.#{self.object_id}"
9191
Fiber.new { Fiber[key] = 42; Fiber[key] }.resume.should == 42
9292
end
93+
end
9394

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

0 commit comments

Comments
 (0)