summaryrefslogtreecommitdiff
path: root/test/rebar_hooks_SUITE.erl
diff options
context:
space:
mode:
authorFred Hebert <mononcqc@ferd.ca>2016-02-28 11:50:40 -0500
committerFred Hebert <mononcqc@ferd.ca>2016-02-28 11:50:40 -0500
commita0b2c743566fcfae543ba758b954ec465db6fcfd (patch)
treebc05b44242ac7df355194440c7946002e3ee1d7b /test/rebar_hooks_SUITE.erl
parent47a0a20a3cc649303a31368dee82012983512d72 (diff)
parentc36e9bf791e90b27cb0c9657cf245049a3595572 (diff)
Merge pull request #1091 from tsloughter/all_hooks
Run all hooks
Diffstat (limited to 'test/rebar_hooks_SUITE.erl')
-rw-r--r--test/rebar_hooks_SUITE.erl22
1 files changed, 21 insertions, 1 deletions
diff --git a/test/rebar_hooks_SUITE.erl b/test/rebar_hooks_SUITE.erl
index 188fb34..b121dd5 100644
--- a/test/rebar_hooks_SUITE.erl
+++ b/test/rebar_hooks_SUITE.erl
@@ -10,6 +10,7 @@
escriptize_artifacts/1,
run_hooks_once/1,
run_hooks_for_plugins/1,
+ eunit_app_hooks/1,
deps_hook_namespace/1]).
-include_lib("common_test/include/ct.hrl").
@@ -33,7 +34,7 @@ end_per_testcase(_, _Config) ->
all() ->
[build_and_clean_app, run_hooks_once, escriptize_artifacts,
- run_hooks_for_plugins, deps_hook_namespace].
+ run_hooks_for_plugins, deps_hook_namespace, eunit_app_hooks].
%% Test post provider hook cleans compiled project app, leaving it invalid
build_and_clean_app(Config) ->
@@ -119,6 +120,25 @@ deps_hook_namespace(Config) ->
{ok, [{dep, "some_dep"}]}
).
+%% Checks that a hook that is defined on an app (not a top level hook of a project with subapps) is run
+eunit_app_hooks(Config) ->
+ AppDir = ?config(apps, Config),
+ Name = rebar_test_utils:create_random_name("app1_"),
+ Vsn = rebar_test_utils:create_random_vsn(),
+ rebar_test_utils:create_app(AppDir, Name, Vsn, [kernel, stdlib]),
+
+ RConfFile =
+ rebar_test_utils:create_config(AppDir,
+ [
+ {escript_name, list_to_atom(Name)}
+ ,{provider_hooks, [{post, [{eunit, escriptize}]}]}
+ ]),
+ {ok, RConf} = file:consult(RConfFile),
+
+ rebar_test_utils:run_and_check(Config, RConf,
+ ["eunit"], {ok, [{app, Name, valid}
+ ,{file, filename:join([AppDir, "_build/test/bin", Name])}]}).
+
run_hooks_for_plugins(Config) ->
AppDir = ?config(apps, Config),