如何使用eunit测试gen_fsm是否确实超时?
{ok, GH} = gen_fsm:start_link(myFSM, [], []),
//after 15 sec it should timeout if no messages received.
//What must I write here to test it?发布于 2012-03-22 21:13:54
我相信这是一种解决方案:
{ok, GH} = gen_fsm:start_link(myFSM, [], []),
Ref = erlang:monitor(process,GH),
receive
{'DOWN', Ref, process, GH, normal} ->
test_passed
after
15000 ->
?assert("FSM did not die.") % will always fail
end.https://stackoverflow.com/questions/9820605
复制相似问题