[erlang-bugs] EUnit treats a process that kills itself as a successful test

John Hughes john.hughes@REDACTED
Wed Dec 31 15:04:49 CET 2008


Here's my code:

-module(eunit_example).
-include_lib("eunit/include/eunit.hrl").

exit_test() ->
    exit(self(),die).

In the shell, I run:

1> c(eunit_example).
{ok,eunit_example}
2> eunit_example:test().
  Test successful.
ok


Is that really the intention?

Likewise, this test passes:

spawn_test() ->
    spawn_link(erlang,exit,[dying]),
    timer:sleep(1).

(The sleep is there to allow time for the child process to die, and the exit signal to be propagated).

Presumably the process running the test is trapping exits--but is that really appropriate? As in this last example, crashes in child processes won't cause the test to fail.

John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20081231/5eb2fffe/attachment.htm>


More information about the erlang-bugs mailing list