Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions test/async/task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,22 @@ def after
expect(state).to be == :timeout
end

it "will timeout while getting from stdin" do
error = nil

reactor.async do |task|
begin
task.with_timeout(0.1) {STDIN.gets}
rescue Async::TimeoutError => error
# Ignore.
end
end

reactor.run

expect(error).to be_a(Async::TimeoutError)
end

it "won't timeout if execution completes in time" do
state = nil

Expand Down