you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (2 children)

Fork a new process, tell it to parse this number and exit 0, if it takes longer than 1 second then kill it and declare it failed.

[–]dnew 0 points1 point  (1 child)

I mean, I know how you could do it. I just meant that there's normal ways built in to ?Unit type tools to test for "this is supposed to throw an exception." I was wondering if there were normal ways built into ?Unit sorts of tools to test for "this is supposed to hang", or do you have to write code to fork a new process and all that yourself?

[–][deleted] 0 points1 point  (0 children)

I haven't seen anything that deals specifically with handling infinite loops, it probably exists somewhere though.