Expected=lists:flatten(io_lib:format("[error] ~w gen_server crash terminated with reason: bad return value: bleh",[Pid])),
?assertEqual(Expected,lists:flatten(Msg))
end
},
{"case clause",
fun()->
Pid=whereis(crash),
crash(case_clause),
{_,_,Msg}=pop(),
Expected=lists:flatten(io_lib:format("[error] ~w gen_server crash terminated with reason: no case clause matching {} in crash:handle_call/3",[Pid])),
?assertEqual(Expected,lists:flatten(Msg))
end
},
{"function clause",
fun()->
Pid=whereis(crash),
crash(function_clause),
{_,_,Msg}=pop(),
Expected=lists:flatten(io_lib:format("[error] ~w gen_server crash terminated with reason: no function clause matching crash:function({})",[Pid])),
?assertEqual(Expected,lists:flatten(Msg))
end
},
{"if clause",
fun()->
Pid=whereis(crash),
crash(if_clause),
{_,_,Msg}=pop(),
Expected=lists:flatten(io_lib:format("[error] ~w gen_server crash terminated with reason: no true branch found while evaluating if expression in crash:handle_call/3",[Pid])),
?assertEqual(Expected,lists:flatten(Msg))
end
},
{"try clause",
fun()->
Pid=whereis(crash),
crash(try_clause),
{_,_,Msg}=pop(),
Expected=lists:flatten(io_lib:format("[error] ~w gen_server crash terminated with reason: no try clause matching [] in crash:handle_call/3",[Pid])),