Skip to content

Commit 3fc2d19

Browse files
herwinweregon
authored andcommitted
Add spec for IO.select with -INFINITY as timeout
Since `(-Float::INFINITY).infinite?` returns a truthy value, this should probably be covered.
1 parent a13bfc4 commit 3fc2d19

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

core/io/select_spec.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,12 @@
115115
-> { IO.select(nil, nil, nil, -5)}.should raise_error(ArgumentError, "time interval must not be negative")
116116
end
117117

118+
ruby_version_is "4.0" do
119+
it "raises an ArgumentError when passed negative infinity as timeout" do
120+
-> { IO.select(nil, nil, nil, -Float::INFINITY)}.should raise_error(ArgumentError, "time interval must not be negative")
121+
end
122+
end
123+
118124
describe "returns the available descriptors when the file descriptor" do
119125
it "is in both read and error arrays" do
120126
@wr.write("foobar")

0 commit comments

Comments
 (0)