Eunit Expected Exception
- by dagda1
Hi,
Is there a way in Eunit to test whether an exception has been thrown under certain cicumstances?
Say I have a function sum like this:
sum(N, M) when N > M ->
throw({"start is bigger than end", N, M});
sum(N, M) when N =:= M ->
N;
sum(N, M) when N =< M ->
N + sum(N + 1, M).
Can I test that if N is bigger than M then an exception is thrown?
Cheers
Paul