[erlang-questions] Problems with dynamically compiled eunit test

Martin Koroudjiev mrtndimitrov@REDACTED
Fri Jun 13 12:30:28 CEST 2014


Just for the record.

It turned out I had a module in the code path called eunit_test. There
is a module called the same in eunit lib.

Martin

On 6/12/2014 8:20 AM, Martin Koroudjiev wrote:
> Hello,
>
> I've used eunit framework many times before with no problems but now I
> try to compile dynamically a test module and to run the tests. I get
> this error:
>
> undefined
> *unexpected termination of test process*
> ::{undef,[{eunit_test,mf_wrapper,[my_test,fib_test_],[]},
>           {eunit_data,parse,1,[{file,"eunit_data.erl"},{line,245}]},
>           {eunit_data,next,1,[{file,"eunit_data.erl"},{line,170}]},
>           {eunit_data,lookahead,1,[{file,"eunit_data.erl"},{line,530}]},
>           {eunit_data,group,1,[{file,[...]},{line,...}]},
>           {eunit_data,next,1,[{file,...},{...}]},
>           {eunit_data,iter_next,1,[{...}|...]},
>           {eunit_proc,get_next_item,1,[...]}]}
>
> =======================================================
>   Failed: 0.  Skipped: 0.  Passed: 0.
> One or more tests were cancelled.
>
> =ERROR REPORT==== 12-Jun-2014::08:10:16 ===
> Error in process <0.185.0> on node 'dilbert@REDACTED' with exit value:
> {undef,[{eunit_test,mf_wrapper,[my_test,fib_test_],[]},{eunit_data,parse,1,[{file,"eunit_data.erl"},{line,245}]},{eunit_data,next,1,[{file,"eunit_data.erl"},{line,170}]},{eunit_data,lookahead,1,[{file,"eunit_data.erl"},{line...
>
>
> error
>
> The test module is the fib example from the doc page:
>
> -module(my_test).
>
> -include_lib("eunit/include/eunit.hrl").
>
> -export([fib/1]).
>
> fib(0) -> 1;
>    fib(1) -> 1;
>    fib(N) when N > 1 -> fib(N-1) + fib(N-2).
>
> fib_test_() ->
>    [?_assert(fib(0) =:= 1),
>     ?_assert(fib(1) =:= 1),
>     ?_assert(fib(2) =:= 2),
>     ?_assert(fib(3) =:= 3),
>     ?_assert(fib(4) =:= 5),
>     ?_assert(fib(5) =:= 8),
>     ?_assertException(error, function_clause, fib(-1)),
>     ?_assert(fib(31) =:= 2178309)
>        ].
>
> Does anyone know what can be wrong? Thanks in advance for your time.
>
> Regards,
> Martin




More information about the erlang-questions mailing list