summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRoberto Ostinelli <roberto@ostinelli.net>2012-08-19 15:28:03 -0700
committerTuncer Ayaz <tuncer.ayaz@gmail.com>2012-08-20 12:58:34 +0200
commit60516dc406a2b556c07264a1fe067f24e63d8f97 (patch)
tree2d465bc78145eda3b7d44f02ea65b0aa34d84379 /src
parentfa6618f2b410c2b71877c1878dff3a0c8503000c (diff)
Fix tests= option not running generator tests
Diffstat (limited to 'src')
-rw-r--r--src/rebar_eunit.erl13
1 files changed, 11 insertions, 2 deletions
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