diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/rebar_profiles_SUITE.erl | 12 | ||||
-rw-r--r-- | test/rebar_resource_SUITE.erl | 33 |
2 files changed, 43 insertions, 2 deletions
diff --git a/test/rebar_profiles_SUITE.erl b/test/rebar_profiles_SUITE.erl index 0b378cb..03a8090 100644 --- a/test/rebar_profiles_SUITE.erl +++ b/test/rebar_profiles_SUITE.erl @@ -85,10 +85,14 @@ profile_merge_keys(Config) -> profile_merges(_Config) -> RebarConfig = [{test1, [{key1, 1, 2}, key2]}, {test2, "hello"}, + {test3, [key3]}, + {test4, "oldvalue"}, {profiles, [{profile1, [{test1, [{key3, 5}, key1]}]}, - {profile2, [{test2, "goodbye"}]}]}], + {profile2, [{test2, "goodbye"}, + {test3, []}, + {test4, []}]}]}], State = rebar_state:new(RebarConfig), State1 = rebar_state:apply_profiles(State, [profile1, profile2]), @@ -97,4 +101,8 @@ profile_merges(_Config) -> lists:sort(rebar_state:get(State1, test1))), %% Use new value for strings - "goodbye" = rebar_state:get(State1, test2). + "goodbye" = rebar_state:get(State1, test2), + + %% Check that a newvalue of []/"" doesn't override non-string oldvalues + [key3] = rebar_state:get(State1, test3), + [] = rebar_state:get(State1, test4). diff --git a/test/rebar_resource_SUITE.erl b/test/rebar_resource_SUITE.erl new file mode 100644 index 0000000..088ab67 --- /dev/null +++ b/test/rebar_resource_SUITE.erl @@ -0,0 +1,33 @@ +-module(rebar_resource_SUITE). +-compile(export_all). +-include_lib("common_test/include/ct.hrl"). +-include_lib("eunit/include/eunit.hrl"). + +all() -> [{group, git}, {group, pkg}, {group, hg}]. + +groups() -> + [{all, [], [change_type_upgrade]}, + {git, [], [{group, all}]}, + {pkg, [], [{group, all}]}, + {hg, [], [{group, all}]}]. + +init_per_group(all, Config) -> + Config; +init_per_group(Name, Config) -> + [{type, Name}, + {resource, {Name, "https://example.org/user/app", "vsn"}} | Config]. + +%% Changing the resource type is seen as an upgrade +init_per_testcase(change_type_upgrade, Config) -> + Type = ?config(type, Config), + TypeStr = atom_to_list(Type), + DirName = filename:join([?config(priv_dir, Config), "resource_"++TypeStr]), + ec_file:mkdir_path(DirName), + [{path, DirName} | Config]. + +end_per_testcase(_, Config) -> + Config. + +change_type_upgrade(Config) -> + ?assert(rebar_fetch:needs_update(?config(path, Config), + ?config(resource, Config))). |