Syntactic Confectionery Delight | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Wrap whatever thing you're doing that times out in a alarm and eval block.
You can do one of 2 things (or both): a. BAIL_OUT, or b. check $@ outside of the eval with an ok. In some case, you may actually want it to time out. However, that you're timing tells me that what is timing out should probably mocked. It also tells me that you may want to have a more robust wrapper around whatever it is that is timing out - because it may time out when run for real. Throwing Exception::Class is always good - and you can even test that you handle things like timeouts properly using Test::Exception. A quick and easy way to mock whatever it is that is timing out is to use a typeglob: Similarly, you can force a timeout: Or just straight up die throw an exception (i.e., from Exception::Class):
In reply to Re: Timeout on prove
by perlfan
|
|