erlang-rebar/rebar-0008-Remove-pre-R15B02-workaround.patch

56 lines
2.2 KiB
Diff
Raw Normal View History

From: Peter Lemenkov <lemenkov@gmail.com>
Date: Wed, 2 Mar 2016 15:10:20 +0300
Subject: [PATCH] Remove pre-R15B02 workaround
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
diff --git a/src/rebar_eunit.erl b/src/rebar_eunit.erl
index f4d7b76..63f8c31 100644
--- a/src/rebar_eunit.erl
+++ b/src/rebar_eunit.erl
@@ -436,18 +436,6 @@ get_beam_test_exports(ModuleStr) ->
end.
make_test_primitives(RawTests) ->
- %% Use {test,M,F} and {generator,M,F} if at least R15B02. Otherwise,
- %% use eunit_test:function_wrapper/2 fallback.
- %% eunit_test:function_wrapper/2 was renamed to eunit_test:mf_wrapper/2
- %% in R15B02; use that as >= R15B02 check.
- %% TODO: remove fallback and use only {test,M,F} and {generator,M,F}
- %% primitives once at least R15B02 is required.
- {module, eunit_test} = code:ensure_loaded(eunit_test),
- MakePrimitive = case erlang:function_exported(eunit_test, mf_wrapper, 2) of
- true -> fun eunit_primitive/3;
- false -> fun pre15b02_eunit_primitive/3
- end,
-
?CONSOLE(" Running test function(s):~n", []),
F = fun({M, F2}, Acc) ->
?CONSOLE(" ~p:~p/0~n", [M, F2]),
@@ -456,23 +444,15 @@ make_test_primitives(RawTests) ->
case re:run(FNameStr, "_test_") of
nomatch ->
%% Normal test
- MakePrimitive(test, M, F2);
+ {test, M, F2};
_ ->
%% Generator
- MakePrimitive(generator, M, F2)
+ {generator, M, F2}
end,
[eunit_module_suite(M, NewFunction)|Acc]
end,
lists:foldl(F, [], RawTests).
-eunit_primitive(Type, M, F) ->
- {Type, M, F}.
-
-pre15b02_eunit_primitive(test, M, F) ->
- eunit_test:function_wrapper(M, F);
-pre15b02_eunit_primitive(generator, M, F) ->
- {generator, eunit_test:function_wrapper(M, F)}.
-
% Add a test group for eunit_surefire to be able to deduce the testsuite.
% Calling eunit:test({module, M}) does exactly this as well.
eunit_module_suite(M, X) ->