Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

not output exception stack trace in EUnit

Tags:

erlang

eunit

I'm write a test with EUnit, but not anything exception detail output in console.

exp_test() ->
  ?assertEqual(0, 1/0).

Run this module:exp_test() in the Erlang Shell output following

** exception error: bad argument in an arithmetic expression
 in function  exp_test:'-exp_test/0-fun-0-'/1 (src/test/eunit/xxx_test.erl, line 8)

But in EUnit output following

> eunit:test(xxx).
> xxx_test: exp_test...*failed*
  ::badarith

EUnit not output anything exception trace info

Im trying the verbose config in eunit, but no effect.

I want to output some exception detail in eunit test result.

Thanks~

like image 947
hpyhacking Avatar asked May 09 '12 02:05

hpyhacking


1 Answers

The problem seems to be that the version of eunit shipped with R15 does not understand the new stack trace format in R15. This has been fixed in the development version of eunit: github.com/richcarl/eunit

For example:

Eshell V5.10 (abort with ^G)
1> eunit:test(fun() -> (fun() -> exit(foo), ok end)() end).
erl_eval: expr...*failed*
in function erl_eval:do_apply/6 (erl_eval.erl, line 576)
in call from erl_eval:exprs/5 (erl_eval.erl, line 118)
**exit:foo

I hope this will make it into the next release of OTP R15.

like image 124
RichardC Avatar answered Sep 28 '22 04:09

RichardC