diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/rebar_new_SUITE.erl | 28 | ||||
-rw-r--r-- | test/rebar_resource_SUITE.erl | 3 | ||||
-rw-r--r-- | test/rebar_xref_SUITE.erl | 19 |
3 files changed, 30 insertions, 20 deletions
diff --git a/test/rebar_new_SUITE.erl b/test/rebar_new_SUITE.erl index 6b57b74..e382ae4 100644 --- a/test/rebar_new_SUITE.erl +++ b/test/rebar_new_SUITE.erl @@ -6,7 +6,7 @@ -include_lib("common_test/include/ct.hrl"). -include_lib("eunit/include/eunit.hrl"). -all() -> [app]. +all() -> [app, app_with_fallbacks]. init_per_testcase(Case, Config0) -> @@ -32,6 +32,10 @@ mock_empty_escript_templates() -> meck:expect(rebar_utils, escript_foldl, fun(_,_,_) -> {ok, []} end). app(Config) -> + meck:expect(rebar_utils, sh, fun("git config --global user.name", _) -> {ok, "gitname"}; + ("git config --global user.email", _) -> {ok, "git@email.com"} + end), + Name = ?config(name, Config), rebar_test_utils:run_and_check( Config, [], @@ -40,7 +44,7 @@ app(Config) -> ), validate_files( Config, Name, - [{"LICENSE", ["some_name", "anonymous@example.org"]}, + [{"LICENSE", ["some_name", "git@email.com"]}, {"README.md", [Name]}, {".gitignore", []}, {"rebar.config", []}, @@ -49,6 +53,26 @@ app(Config) -> {filename:join(["src", Name++"_app.erl"]), [Name]} ]). +app_with_fallbacks(Config) -> + meck:expect(rebar_utils, sh, fun(_, _) -> {error, fallback} end), + + Name = ?config(name, Config), + rebar_test_utils:run_and_check( + Config, [], + ["new", "test_app", Name], + {ok, []} + ), + validate_files( + Config, Name, + [{"LICENSE", ["Anonymous", "anonymous@example.org"]}, + {"README.md", [Name]}, + {".gitignore", []}, + {"rebar.config", []}, + {filename:join(["src", Name++".app.src"]), [Name]}, + {filename:join(["src", Name++"_sup.erl"]), [Name]}, + {filename:join(["src", Name++"_app.erl"]), [Name]} + ]). + validate_files(_Config, Name, Checks) -> [begin Path = filename:join([Name, File]), diff --git a/test/rebar_resource_SUITE.erl b/test/rebar_resource_SUITE.erl index 088ab67..95263c7 100644 --- a/test/rebar_resource_SUITE.erl +++ b/test/rebar_resource_SUITE.erl @@ -17,6 +17,9 @@ init_per_group(Name, Config) -> [{type, Name}, {resource, {Name, "https://example.org/user/app", "vsn"}} | Config]. +end_per_group(_, _Config) -> + ok. + %% Changing the resource type is seen as an upgrade init_per_testcase(change_type_upgrade, Config) -> Type = ?config(type, Config), diff --git a/test/rebar_xref_SUITE.erl b/test/rebar_xref_SUITE.erl index 1b1d6d7..b2438cf 100644 --- a/test/rebar_xref_SUITE.erl +++ b/test/rebar_xref_SUITE.erl @@ -31,7 +31,6 @@ end_per_suite(_Config) -> init_per_testcase(Case, Config) -> UpdConfig = rebar_test_utils:init_rebar_state(Config), AppDir = ?config(apps, UpdConfig), - {ok, OrigDir} = file:get_cwd(), file:set_cwd(AppDir), Name = rebar_test_utils:create_random_name("xrefapp_"), Vsn = rebar_test_utils:create_random_vsn(), @@ -43,25 +42,9 @@ init_per_testcase(Case, Config) -> undefined_function_calls,undefined_functions, exports_not_used,locals_not_used]}], [{app_name, Name}, - {rebar_config, RebarConfig}, - {orig_dir, OrigDir} | UpdConfig]. + {rebar_config, RebarConfig} | UpdConfig]. end_per_testcase(_, Config) -> - ?debugMsg("End test case cleanup"), - AppDir = ?config(apps, Config), - OrigDir = ?config(orig_dir, Config), - %% Code path cleanup because we set the CWD to the `AppDir' prior - %% to launching rebar and these paths make it into the code path - %% before the xref module executes so they don't get cleaned up - %% automatically after the xref run. Only have to do this because - %% we are about to remove the directory and there may be - %% subsequent test cases that error out when the code path tries - %% to include one of these soon-to-be nonexistent directories. - Name = ?config(app_name, Config), - EbinDir = filename:join([AppDir, "_build", "default" "lib", Name, "ebin"]), - true = code:del_path(EbinDir), - file:set_cwd(OrigDir), - ec_file:remove(AppDir, [recursive]), ok. all() -> |