Pergunta

I am not an expert in EUnit and I mainly use ?assert_(fun1(Args) == Result) to test all the functions in my Erlang code (I define Result in the _tests module).

But in case a test fails it does not show what fun1 has actually returned.

Instead, it says something like "It should be true, but was false".

How can I make EUnit to show in its output what fun1(Args) has actually returned?

Foi útil?

Solução

You can use the ?assertEqual(Expect, Expr) macro:

?assertEqual(Result, fun1(Args))

For more ?assert macros, check eunit docs

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top