diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/rebar_ct_SUITE.erl | 22 | ||||
-rw-r--r-- | test/rebar_hooks_SUITE.erl | 22 |
2 files changed, 41 insertions, 3 deletions
diff --git a/test/rebar_ct_SUITE.erl b/test/rebar_ct_SUITE.erl index 9532b15..73473b2 100644 --- a/test/rebar_ct_SUITE.erl +++ b/test/rebar_ct_SUITE.erl @@ -42,6 +42,7 @@ cfg_opts/1, cfg_arbitrary_opts/1, cfg_test_spec/1, + cfg_cover_spec/1, cfg_atom_suites/1, cover_compiled/1, misspecified_ct_opts/1, @@ -57,7 +58,7 @@ all() -> [{group, basic_app}, {group, ct_opts}, {group, cover}, cfg_opts, cfg_arbitrary_opts, - cfg_test_spec, + cfg_test_spec, cfg_cover_spec, cfg_atom_suites, misspecified_ct_opts, misspecified_ct_compile_opts, @@ -1050,7 +1051,24 @@ cfg_test_spec(Config) -> {error, {rebar_prv_common_test, Error}} = rebar_prv_common_test:prepare_tests(State), - {badconfig, "Test specs not supported"} = Error. + {badconfig, "Test specs not supported. See http://www.rebar3.org/docs/running-tests#common-test"} = Error. + +cfg_cover_spec(Config) -> + C = rebar_test_utils:init_rebar_state(Config, "ct_cfg_cover_spec_opts_"), + + AppDir = ?config(apps, C), + + Name = rebar_test_utils:create_random_name("ct_cfg_cover_spec_opts_"), + Vsn = rebar_test_utils:create_random_vsn(), + rebar_test_utils:create_app(AppDir, Name, Vsn, [kernel, stdlib]), + + RebarConfig = [{ct_opts, [{cover, "spec/foo.spec"}]}], + + {ok, State} = rebar_test_utils:run_and_check(C, RebarConfig, ["as", "test", "lock"], return), + + {error, {rebar_prv_common_test, Error}} = rebar_prv_common_test:prepare_tests(State), + + {badconfig, "Cover specs not supported. See http://www.rebar3.org/docs/running-tests#common-test"} = Error. cfg_atom_suites(Config) -> C = rebar_test_utils:init_rebar_state(Config, "ct_cfg_atom_suites_"), 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), |