diff --git a/test/async/task.rb b/test/async/task.rb index dd7fdcd3..4857a04e 100644 --- a/test/async/task.rb +++ b/test/async/task.rb @@ -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