Skip to content

Commit

Permalink
Merge pull request #2 from schutm/master
Browse files Browse the repository at this point in the history
Add common_test besides eunit
  • Loading branch information
markusn committed Sep 26, 2014
2 parents d3734d8 + a589f3c commit 0798f95
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions src/rebar_coveralls.erl
Expand Up @@ -38,21 +38,28 @@
%%=============================================================================
%% Exports

-export([ eunit/2 ]).
-export([ ct/2, eunit/2 ]).

%%=============================================================================
%% API functions

ct(Conf, _) ->
coveralls(Conf).

eunit(Conf, _) ->
coveralls(Conf).

%%=============================================================================
%% Internal functions

coveralls(Conf) ->
ConvertAndSend = fun coveralls:convert_and_send_file/3,
Get = fun(Key, Def) -> rebar_config:get(Conf, Key, Def) end,
GetLocal = fun(Key, Def) -> rebar_config:get_local(Conf, Key, Def) end,
eunit(ConvertAndSend, Get, GetLocal).
do_coveralls(ConvertAndSend, Get, GetLocal).

%%=============================================================================
%% Internal functions

eunit(ConvertAndSend, Get, GetLocal) ->
do_coveralls(ConvertAndSend, Get, GetLocal) ->
File = GetLocal(coveralls_coverdata, undef),
ServiceName = GetLocal(coveralls_service_name, undef),
ServiceJobId = GetLocal(coveralls_service_job_id, undef),
Expand Down Expand Up @@ -86,8 +93,8 @@ eunit_test_() ->
(coveralls_service_job_id, _) -> ServiceJobId
end,
GetBroken = fun(cover_export_enabled, _) -> false end,
[ ?_assertEqual(ok, eunit(ConvertAndSend, Get, GetLocal))
, ?_assertThrow({error, _}, eunit(ConvertAndSend, GetBroken, GetLocal))
[ ?_assertEqual(ok, do_coveralls(ConvertAndSend, Get, GetLocal))
, ?_assertThrow({error, _}, do_coveralls(ConvertAndSend, GetBroken, GetLocal))
].

%%% Local Variables:
Expand Down

0 comments on commit 0798f95

Please sign in to comment.