From b98d977c5dfb905e4d0eb0937d5a5a96452c2309 Mon Sep 17 00:00:00 2001 From: Fred Hebert Date: Mon, 2 Mar 2015 19:39:14 +0000 Subject: Some free tests from a debugging session The session was unfruitful, but I guess the tests were not necessarily --- test/rebar_resource_SUITE.erl | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 test/rebar_resource_SUITE.erl (limited to 'test') 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))). -- cgit v1.1