diff options
author | Tristan Sloughter <t@crashfast.com> | 2015-02-22 18:21:24 -0600 |
---|---|---|
committer | Tristan Sloughter <t@crashfast.com> | 2015-02-22 18:21:24 -0600 |
commit | 96f1b21ef87ad1c06329688eb2bf5b09b2b08080 (patch) | |
tree | 5c0921626c97fa74f013d8265786501762c758dd /test/rebar_profiles_SUITE.erl | |
parent | 558646adbc044d85aae4d972682d008a9c7554c7 (diff) |
basic profile deps tests
Diffstat (limited to 'test/rebar_profiles_SUITE.erl')
-rw-r--r-- | test/rebar_profiles_SUITE.erl | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/test/rebar_profiles_SUITE.erl b/test/rebar_profiles_SUITE.erl new file mode 100644 index 0000000..802b772 --- /dev/null +++ b/test/rebar_profiles_SUITE.erl @@ -0,0 +1,82 @@ +-module(rebar_profiles_SUITE). + +-export([init_per_suite/1, + end_per_suite/1, + init_per_testcase/2, + end_per_testcase/2, + all/0, + profile_new_key/1, + profile_merge_keys/1]). + +-include_lib("common_test/include/ct.hrl"). +-include_lib("eunit/include/eunit.hrl"). +-include_lib("kernel/include/file.hrl"). + +all() -> + [profile_new_key, profile_merge_keys]. + +init_per_suite(Config) -> + application:start(meck), + Config. + +end_per_suite(_Config) -> + application:stop(meck). + +init_per_testcase(_, Config) -> + rebar_test_utils:init_rebar_state(Config). + +end_per_testcase(_, Config) -> + meck:unload(), + Config. + +profile_new_key(Config) -> + AppDir = ?config(apps, Config), + + AllDeps = rebar_test_utils:expand_deps(git, [{"a", "1.0.0", []} + ,{"b", "1.0.0", []}]), + mock_git_resource:mock([{deps, rebar_test_utils:flat_deps(AllDeps)}]), + + Name = rebar_test_utils:create_random_name("profile_new_key_"), + Vsn = rebar_test_utils:create_random_vsn(), + rebar_test_utils:create_app(AppDir, Name, Vsn, [kernel, stdlib]), + + Deps = rebar_test_utils:top_level_deps( + rebar_test_utils:expand_deps(git, [{"a", "1.0.0", []} + ,{"b", "1.0.0", []}])), + ct:pal("Deps ~p", [Deps]), + RebarConfig = [{profiles, + [{ct, + [{deps, Deps}]}]}], + + rebar_test_utils:run_and_check(Config, RebarConfig, + ["as", "ct", "compile"], {ok, [{app, Name} + ,{dep, "a", "1.0.0"} + ,{dep, "b", "1.0.0"}]}). + +profile_merge_keys(Config) -> + AppDir = ?config(apps, Config), + + AllDeps = rebar_test_utils:expand_deps(git, [{"a", "1.0.0", []} + ,{"b", "1.0.0", []} + ,{"b", "2.0.0", []}]), + mock_git_resource:mock([{deps, rebar_test_utils:flat_deps(AllDeps)}]), + + Name = rebar_test_utils:create_random_name("profile_new_key_"), + Vsn = rebar_test_utils:create_random_vsn(), + rebar_test_utils:create_app(AppDir, Name, Vsn, [kernel, stdlib]), + + Deps = rebar_test_utils:top_level_deps( + rebar_test_utils:expand_deps(git, [{"a", "1.0.0", []} + ,{"b", "1.0.0", []}])), + ProfileDeps = rebar_test_utils:top_level_deps( + rebar_test_utils:expand_deps(git, [{"b", "2.0.0", []}])), + + RebarConfig = [{deps, Deps}, + {profiles, + [{ct, + [{deps, ProfileDeps}]}]}], + + rebar_test_utils:run_and_check(Config, RebarConfig, + ["as", "ct", "compile"], {ok, [{app, Name} + ,{dep, "a", "1.0.0"} + ,{dep, "b", "2.0.0"}]}). |