Reputation: 5053
have some function which performs html parsing of some content from web page.
I want to write some set of tests for it. In tests I'm going to fetch html content via httpc:request
and pass it to my function with result validation in the end. But http client required application inets
to be launched. After reading some docs about EUnit I came up with next chunk of code:
-module(dparser_tests).
-include_lib("eunit/include/eunit.hrl").
start() ->
inets:start(),
ok.
stop(_) ->
inets:stop(),
ok.
do_smth(_) ->
[?_assert(true =:= true)].
do_some_test_() ->
{"Performs some default parsing stuff!",
{setup,
fun start/0,
fun stop/1,
fun do_smth/1
}
}.
then
erlc dparser_tests.erl && erl -noshell -pa -eval "eunit:test(dparser)" -s init stop
and output is
*** context setup failed ***
::undef
=======================================================
Failed: 0. Skipped: 0. Passed: 0.
One or more tests were cancelled
UPDATE
problem was in typo in inets:start()
Upvotes: 0
Views: 203
Reputation: 5500
You have a typo in the start()
function. Replace intets
with inets
and the error will go away.
Upvotes: 2