Search Results

Search found 6 results on 1 pages for 'eunit'.

Page 1/1 | 1 

  • not output exception stack trace in EUnit

    - by hpyhacking
    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~

    Read the article

  • Start dependent application with eunit

    - by ruslander
    I start lager as a dependent application when I run a unit test but for some reason the code under test does not see it. -module(main_tests). -include_lib("eunit/include/eunit.hrl"). main_test_() -> {foreach, fun distr_setup/0, fun distr_cleanup/1, [ fun must_retain/1 ]}. must_retain(_) -> {"Should do ping pong when is fully initialized", fun() -> ?assertEqual(pong, abuse_counter:ping()) end}. %%------------------------------------------------------------------ distr_setup() -> abuse_counter:start_link(), ok. distr_cleanup(_) -> abuse_counter:stop(), ok. Here is the output of the log which is complaining that lager is not defined {undef,[{lager,info,["up and running"],[]} though in the run output is definitely there. Here is how I run it: erl -pa ebin/ ../../deps/*/ebin -s lager -eval 'eunit:test(main_tests,[verbose]), init:stop().' Fails with the output Eshell V5.10.2 (abort with ^G) 1> 17:13:31.506 [info] Application lager started on node nonode@nohost ======================== EUnit ======================== module 'main_tests' undefined 17:13:31.528 [error] CRASH REPORT Process <0.57.0> with 1 neighbours exited with reason: call to undefined function lager:info("up and running") in gen_server:init_it/6 line 328 *unexpected termination of test process* ::**{undef,[{lager,info,["up and running"],[]}**, {abuse_counter,init,1,[{file,"src/abuse_counter.erl"},{line,37}]}, {gen_server,init_it,6,[{file,"gen_server.erl"},{line,304}]}, {proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,239}]}]} ======================================================= Failed: 0. Skipped: 0. Passed: 0. One or more tests were cancelled. Already spent 3-4h hours on google and stack overflow but nothing seems to work. One option is to hide this call behind a ?INFO(Mgs) macro but do not like the idea. Any help will be highly appreciated.

    Read the article

  • 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

    Read the article

  • Tail recursion in Erlang

    - by dagda1
    Hi, I am really struggling to understand tail recursion in Erlang. I have the following eunit test: db_write_many_test() -> Db = db:new(), Db1 = db:write(francesco, london, Db), Db2 = db:write(lelle, stockholm, Db1), ?assertEqual([{lelle, stockholm},{francesco, london}], Db2). And here is my implementation: -module(db) . -include_lib("eunit/include/eunit.hrl"). -export([new/0,write/3]). new() -> []. write(Key, Value, Database) -> Record = {Key, Value}, [Record|append(Database)]. append([H|T]) -> [H|append(T)]; append([]) -> []. Is my implementation tail recursive and if not, how can I make it so? Thanks in advance

    Read the article

  • Erlang "must-have" development tools

    - by Jonas
    I am not a professional Erlang developer (not yet), but I would like to hear what Erlang development tools are "must-have" in the industry (besides emacs and git/mercurial) ? I do know about a few tools like: rebar, dialyzer, hipe, eunit and edoc but I have no idea if they are used by professional erlang developers or if there are other tools that are "must-have". This question is inspired by Java "must-have" development tools

    Read the article

  • lists:keyfind problems

    - by dagda1
    Hi, I cannot for the life of me get lists:keyfind to work as I expect in Erlang. I have the following eunit test: should_find_key_test() -> NewList = lists:keystore("key", 1, [], {"key", "value"}), Value = case lists:keyfind("key", 1, NewList) of false -> notfound; {_key, _value} -> _value end, ?debugVal(Value). Whenever I run this test I get the following error message: indextests:should_find_key_test (module 'indextests')...failed ::error:undef in function lists:keyfind/3 called as keyfind("key",1,[{"key","value"}]) in call from indextests:should_find_key_test/0 Can anyone see what I am doing wrong? Is it saying that lists:keyfind no longer exists? Cheers Paul

    Read the article

1