Skip to content

Commit 50478a8

Browse files
committed
Add spec for Timeout.timeout with negative duration argument
1 parent c557b4a commit 50478a8

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

library/timeout/timeout_spec.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,12 @@
3939
42
4040
end.should == 42
4141
end
42+
43+
ruby_version_is "3.4" do
44+
it "raises an ArgumentError when provided with a negative duration" do
45+
-> {
46+
Timeout.timeout(-1)
47+
}.should raise_error(ArgumentError, "Timeout sec must be a non-negative number")
48+
end
49+
end
4250
end

0 commit comments

Comments
 (0)