-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improved code gen by not initializing `Generic`
- Loading branch information
Showing
6 changed files
with
65 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
require "spec" | ||
require "../src/promise" | ||
|
||
describe "promise timeouts" do | ||
it "should timeout a promise" do | ||
p = Promise.new(Symbol, timeout: 2.milliseconds) | ||
expect_raises(Promise::Timeout) { p.get } | ||
end | ||
|
||
it "should timeout a defer" do | ||
p = Promise.defer(timeout: 1.millisecond) { sleep 1; "p1 wins" } | ||
expect_raises(Promise::Timeout) { p.get } | ||
end | ||
|
||
it "should timeout a race" do | ||
expect_raises(Promise::Timeout) do | ||
Promise.race( | ||
Promise.defer(timeout: 1.millisecond) { sleep 1; "p1 wins" }, | ||
Promise.defer { sleep 1; "p2 wins" } | ||
).get | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters