From 60516dc406a2b556c07264a1fe067f24e63d8f97 Mon Sep 17 00:00:00 2001 From: Roberto Ostinelli Date: Sun, 19 Aug 2012 15:28:03 -0700 Subject: Fix tests= option not running generator tests --- src/rebar_eunit.erl | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/rebar_eunit.erl b/src/rebar_eunit.erl index 765f59f..06f0c60 100644 --- a/src/rebar_eunit.erl +++ b/src/rebar_eunit.erl @@ -219,8 +219,17 @@ build_tests(Config, Modules) -> RawTests -> ?CONSOLE(" Running test function(s):~n", []), F = fun({M, F2}, Acc) -> - ?CONSOLE(" ~p:~p/0~n", [M, F2]), - [eunit_test:function_wrapper(M, F2)|Acc] + ?CONSOLE(" ~p:~p/0~n", [M, F2]), + FNameStr = atom_to_list(F2), + NewFunction = case re:run(FNameStr, "_test_") =/= nomatch of + true -> + %% Generator + {generator, eunit_test:function_wrapper(M, F2)}; + _ -> + %% Normal test + eunit_test:function_wrapper(M, F2) + end, + [NewFunction|Acc] end, lists:foldl(F, [], RawTests) end -- cgit v1.1