Browse Source

add test for test profile applied to project apps

pull/233/head
alisdair sullivan 10 years ago
parent
commit
67aca881c1
1 changed files with 24 additions and 2 deletions
  1. +24
    -2
      test/rebar_profiles_SUITE.erl

+ 24
- 2
test/rebar_profiles_SUITE.erl View File

@ -13,7 +13,8 @@
profiles_remain_applied_with_config_present/1, profiles_remain_applied_with_config_present/1,
test_profile_applied_at_completion/1, test_profile_applied_at_completion/1,
test_profile_applied_before_compile/1, test_profile_applied_before_compile/1,
test_profile_applied_before_eunit/1]).
test_profile_applied_before_eunit/1,
test_profile_applied_to_apps/1]).
-include_lib("common_test/include/ct.hrl"). -include_lib("common_test/include/ct.hrl").
-include_lib("eunit/include/eunit.hrl"). -include_lib("eunit/include/eunit.hrl").
@ -25,7 +26,8 @@ all() ->
profiles_remain_applied_with_config_present, profiles_remain_applied_with_config_present,
test_profile_applied_at_completion, test_profile_applied_at_completion,
test_profile_applied_before_compile, test_profile_applied_before_compile,
test_profile_applied_before_eunit].
test_profile_applied_before_eunit,
test_profile_applied_to_apps].
init_per_suite(Config) -> init_per_suite(Config) ->
application:start(meck), application:start(meck),
@ -197,3 +199,23 @@ test_profile_applied_before_eunit(Config) ->
T = list_to_atom("not_a_real_src_" ++ Name ++ "_tests"), T = list_to_atom("not_a_real_src_" ++ Name ++ "_tests"),
true = lists:member({d, 'TEST'}, proplists:get_value(options, T:module_info(compile), [])). true = lists:member({d, 'TEST'}, proplists:get_value(options, T:module_info(compile), [])).
test_profile_applied_to_apps(Config) ->
AppDir = ?config(apps, Config),
Name = rebar_test_utils:create_random_name("test_profile_applied_to_apps_"),
Vsn = rebar_test_utils:create_random_vsn(),
rebar_test_utils:create_app(AppDir, Name, Vsn, [kernel, stdlib]),
{ok, State} = rebar_test_utils:run_and_check(Config,
[],
["eunit"],
return),
Apps = rebar_state:project_apps(State),
lists:foreach(fun(App) ->
AppState = rebar_app_info:state(App),
Opts = rebar_state:opts(AppState),
ErlOpts = dict:fetch(erl_opts, Opts),
true = lists:member({d, 'TEST'}, ErlOpts)
end, Apps).

Loading…
Cancel
Save