summaryrefslogtreecommitdiff
path: root/src/rebar_eunit.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/rebar_eunit.erl')
-rw-r--r--src/rebar_eunit.erl41
1 files changed, 39 insertions, 2 deletions
diff --git a/src/rebar_eunit.erl b/src/rebar_eunit.erl
index a7f4aca..55e6a72 100644
--- a/src/rebar_eunit.erl
+++ b/src/rebar_eunit.erl
@@ -61,7 +61,7 @@
%% Additionally, for projects that have separate folders for the core
%% implementation, and for the unit tests, then the following
%% <code>rebar.config</code> option can be provided:
-%% <code>{test_compile_opts, [{src_dirs, ["dir"]}]}.</code>.
+%% <code>{eunit_compile_opts, [{src_dirs, ["src", "dir"]}]}.</code>.
%% @copyright 2009, 2010 Dave Smith
%% -------------------------------------------------------------------
-module(rebar_eunit).
@@ -69,6 +69,9 @@
-export([eunit/2,
clean/2]).
+%% for internal use only
+-export([info/2]).
+
-include("rebar.hrl").
-define(EUNIT_DIR, ".eunit").
@@ -100,6 +103,40 @@ clean(_Config, _File) ->
%% Internal functions
%% ===================================================================
+info(help, eunit) ->
+ info_help("Run eunit tests");
+info(help, clean) ->
+ Description = ?FMT("Delete eunit test dir (~s)", [?EUNIT_DIR]),
+ info_help(Description).
+
+info_help(Description) ->
+ ?CONSOLE(
+ "~s.~n"
+ "~n"
+ "Valid rebar.config options:~n"
+ " ~p~n"
+ " ~p~n"
+ " ~p~n"
+ " ~p~n"
+ " ~p~n"
+ " ~p~n"
+ "Valid command line options:~n"
+ " suites=\"foo,bar\" (Run tests in foo.erl, test/foo_tests.erl and~n"
+ " tests in bar.erl, test/bar_tests.erl)~n"
+ " tests=\"baz\" (For every existing suite, run the first test whose~n"
+ " name starts with bar and, if no such test exists,~n"
+ " run the test whose name starts with bar in the~n"
+ " suite's _tests module)~n",
+ [
+ Description,
+ {eunit_opts, []},
+ {eunit_compile_opts, []},
+ {eunit_first_files, []},
+ {cover_enabled, false},
+ {cover_print_enabled, false},
+ {cover_export_enabled, false}
+ ]).
+
run_eunit(Config, CodePath, SrcErls) ->
%% Build a list of all the .beams in ?EUNIT_DIR -- use this for
%% cover and eunit testing. Normally you can just tell cover
@@ -186,7 +223,7 @@ filter_suites(Config, Modules) ->
filter_suites1(Modules, []) ->
Modules;
filter_suites1(Modules, Suites) ->
- [M || M <- Modules, lists:member(M, Suites)].
+ [M || M <- Suites, lists:member(M, Modules)].
%%
%% == get matching tests ==