From b55483c88960747d3951190c908ba9f7e8ee1134 Mon Sep 17 00:00:00 2001 From: Tuncer Ayaz Date: Fri, 18 Aug 2017 19:10:49 +0000 Subject: Fix Erlang 20 export_all warnings Fix other warnings and whitespace errors as well. --- test/rebar_compiler_tests.erl | 10 ------- test/rebar_dia_tests.erl | 14 +++------ test/rebar_eunit_tests.erl | 8 ------ test/rebar_file_utils_tests.erl | 2 -- test/rebar_require_vsn_tests.erl | 2 -- test/rebar_utils_tests.erl | 2 -- test/rebar_xref_eunit.erl | 61 ++++++++++++++++++---------------------- 7 files changed, 32 insertions(+), 67 deletions(-) diff --git a/test/rebar_compiler_tests.erl b/test/rebar_compiler_tests.erl index 104a7d8..2afbc92 100644 --- a/test/rebar_compiler_tests.erl +++ b/test/rebar_compiler_tests.erl @@ -30,8 +30,6 @@ %% ------------------------------------------------------------------- -module(rebar_compiler_tests). --compile(export_all). - -include_lib("eunit/include/eunit.hrl"). %% Assuming this test is run inside the rebar 'eunit' @@ -167,19 +165,11 @@ prepare_rebar_script() -> ?TMP_DIR ++ "rebar.cmd") end. -rebar() -> - rebar([]). - rebar(Args) when is_list(Args) -> Out = os:cmd(filename:nativename("./rebar") ++ " " ++ Args), %% ?debugMsg("**** Begin"), ?debugMsg(Out), ?debugMsg("**** End"), Out. -assert_dirs_in(Name, [Dir|T]) -> - [{Name ++ " has directory: " ++ Dir, ?_assert(filelib:is_dir(Dir))} | - assert_dirs_in(Name, T)]; -assert_dirs_in(_, []) -> []. - assert_files_in(Name, [File|T]) -> [{Name ++ " has file: " ++ File, ?_assert(filelib:is_regular(File))} | assert_files_in(Name, T)]; diff --git a/test/rebar_dia_tests.erl b/test/rebar_dia_tests.erl index 556a552..0561bbb 100644 --- a/test/rebar_dia_tests.erl +++ b/test/rebar_dia_tests.erl @@ -2,8 +2,6 @@ %% ex: ts=4 sw=4 et -module(rebar_dia_tests). --compile([export_all]). - -include_lib("eunit/include/eunit.hrl"). -define(REBAR_SCRIPT, "../rebar"). @@ -12,7 +10,7 @@ dia_test_() -> case supported_otp_version() of - true -> + true -> {"Test the dia compiler", setup, fun() -> setup_project(), rebar("compile") end, fun teardown/1, @@ -22,7 +20,7 @@ dia_test_() -> {"Check include is created", ?_assert(filelib:is_dir("include") =:= true)}, - + {"Check dia/a.dia is compiled", ?_assert(string:str(RebarOut, "Compiled dia/a.dia") /= 0)}, @@ -62,7 +60,7 @@ dia_test_() -> supported_otp_version() -> Min = rebar_require_vsn:version_tuple(keep_going, "15", "configured"), - Otp = rebar_require_vsn:version_tuple(keep_going, + Otp = rebar_require_vsn:version_tuple(keep_going, erlang:system_info(otp_release), "OTP Release"), Otp >= Min. @@ -108,9 +106,5 @@ prepare_rebar_script() -> ?TMP_DIR ++ "rebar.cmd") end. -rebar() -> - rebar([]). - rebar(Args) when is_list(Args) -> - Out = os:cmd(filename:nativename("./rebar") ++ " " ++ Args), - Out. + os:cmd(filename:nativename("./rebar") ++ " " ++ Args). diff --git a/test/rebar_eunit_tests.erl b/test/rebar_eunit_tests.erl index d481dae..cf1e696 100644 --- a/test/rebar_eunit_tests.erl +++ b/test/rebar_eunit_tests.erl @@ -30,8 +30,6 @@ %% ------------------------------------------------------------------- -module(rebar_eunit_tests). --compile(export_all). - -include_lib("eunit/include/eunit.hrl"). %% Assuming this test is run inside the rebar 'eunit' @@ -412,7 +410,6 @@ code_path_test_() -> -define(myapp_mymod_tests, ["-module(myapp_mymod_tests).\n", - "-compile([export_all]).\n", "-include_lib(\"eunit/include/eunit.hrl\").\n", "myfunc_test() -> ?assertMatch(ok, myapp_mymod:myfunc()).\n"]). @@ -426,7 +423,6 @@ code_path_test_() -> -define(myapp_mymod2_tests, ["-module(myapp_mymod2_tests).\n", - "-compile([export_all]).\n", "-include_lib(\"eunit/include/eunit.hrl\").\n", "myfunc2_test() -> ?assertMatch(ok, myapp_mymod2:myfunc2()).\n", "common_name_test() -> ?assert(true).\n"]). @@ -459,7 +455,6 @@ code_path_test_() -> -define(myapp_mymod_defined_in_mysuite_tests, ["-module(myapp_mymod_defined_in_mysuite_tests).\n", - "-compile([export_all]).\n", "-include_lib(\"eunit/include/eunit.hrl\").\n", "myfunc_test() -> ?assertMatch(ok, myapp_mymod:myfunc()).\n"]). @@ -537,9 +532,6 @@ prepare_rebar_script() -> ?TMP_DIR ++ "rebar.cmd") end. -rebar() -> - rebar([]). - rebar(Args) when is_list(Args) -> Out = os:cmd(filename:nativename("./rebar") ++ " " ++ Args), %% ?debugMsg("**** Begin"), ?debugMsg(Out), ?debugMsg("**** End"), diff --git a/test/rebar_file_utils_tests.erl b/test/rebar_file_utils_tests.erl index c9b4192..ca5edf0 100644 --- a/test/rebar_file_utils_tests.erl +++ b/test/rebar_file_utils_tests.erl @@ -30,8 +30,6 @@ %% ------------------------------------------------------------------- -module(rebar_file_utils_tests). --compile(export_all). - -include_lib("eunit/include/eunit.hrl"). -define(TMP_DIR, "tmp_file_utils"). diff --git a/test/rebar_require_vsn_tests.erl b/test/rebar_require_vsn_tests.erl index a934e8e..43333d3 100644 --- a/test/rebar_require_vsn_tests.erl +++ b/test/rebar_require_vsn_tests.erl @@ -2,8 +2,6 @@ %% ex: ts=4 sw=4 et -module(rebar_require_vsn_tests). --compile(export_all). - -include_lib("eunit/include/eunit.hrl"). version_tuple_test_() -> diff --git a/test/rebar_utils_tests.erl b/test/rebar_utils_tests.erl index 9bc393a..81f5c92 100644 --- a/test/rebar_utils_tests.erl +++ b/test/rebar_utils_tests.erl @@ -30,8 +30,6 @@ %% ------------------------------------------------------------------- -module(rebar_utils_tests). --compile(export_all). - -include_lib("eunit/include/eunit.hrl"). expand_env_variable_test_() -> diff --git a/test/rebar_xref_eunit.erl b/test/rebar_xref_eunit.erl index f32ea46..13d8a5e 100644 --- a/test/rebar_xref_eunit.erl +++ b/test/rebar_xref_eunit.erl @@ -2,8 +2,6 @@ %% ex: ts=4 sw=4 et -module(rebar_xref_eunit). --compile(export_all). - -include_lib("eunit/include/eunit.hrl"). -define(REBAR_SCRIPT, "../rebar"). @@ -16,31 +14,31 @@ xref_test_() -> fun teardown/1, fun(RebarOut) -> [ - {"Undefined function", ?_assert(string:str(RebarOut, + {"Undefined function", ?_assert(string:str(RebarOut, "myapp_somemod:notavailable/1 is undefined function") =/= 0)}, - {"Undefined function call", ?_assert(string:str(RebarOut, + {"Undefined function call", ?_assert(string:str(RebarOut, "myapp_othermod:somefunc/0 calls undefined function myapp_somemod:notavailable/1") =/= 0)}, - {"Deprecated function", ?_assert(string:str(RebarOut, + {"Deprecated function", ?_assert(string:str(RebarOut, "myapp_mymod:fdeprecated/0 is deprecated function") =/= 0)}, - {"Deprecated function call", ?_assert(string:str(RebarOut, + {"Deprecated function call", ?_assert(string:str(RebarOut, "myapp_othermod:somefunc/0 calls deprecated function myapp_mymod:fdeprecated/0") =/= 0)}, - {"Unused local", ?_assert(string:str(RebarOut, + {"Unused local", ?_assert(string:str(RebarOut, "myapp_mymod:localfunc2/0 is unused local function") =/= 0)}, - {"Unused export 1", ?_assert(string:str(RebarOut, + {"Unused export 1", ?_assert(string:str(RebarOut, "myapp_behaviour1:behaviour_info/1 is unused export") =/= 0)}, - {"Unused export 2", ?_assert(string:str(RebarOut, + {"Unused export 2", ?_assert(string:str(RebarOut, "myapp_behaviour2:behaviour_info/1 is unused export") =/= 0)}, - {"Unused export 3", ?_assert(string:str(RebarOut, + {"Unused export 3", ?_assert(string:str(RebarOut, "myapp_mymod:other2/1 is unused export") =/= 0)}, - {"Unused export 4", ?_assert(string:str(RebarOut, + {"Unused export 4", ?_assert(string:str(RebarOut, "myapp_othermod:somefunc/0 is unused export") =/= 0)}, - {"Suppressed behaviour export 1", ?_assert(string:str(RebarOut, + {"Suppressed behaviour export 1", ?_assert(string:str(RebarOut, "myapp_mymod:bh1_a/1 is unused export") =:= 0)}, - {"Suppressed behaviour export 2", ?_assert(string:str(RebarOut, + {"Suppressed behaviour export 2", ?_assert(string:str(RebarOut, "myapp_mymod:bh1_b/1 is unused export") =:= 0)}, - {"Suppressed behaviour export 3", ?_assert(string:str(RebarOut, + {"Suppressed behaviour export 3", ?_assert(string:str(RebarOut, "myapp_mymod:bh2_a/1 is unused export") =:= 0)}, - {"Suppressed behaviour export 4", ?_assert(string:str(RebarOut, + {"Suppressed behaviour export 4", ?_assert(string:str(RebarOut, "myapp_mymod:bh2_b/1 is unused export") =:= 0)} ] end}. @@ -51,31 +49,31 @@ xref_ignore_test_() -> fun teardown/1, fun(RebarOut) -> [ - {"Undefined function can not be suppressed.", ?_assert(string:str(RebarOut, + {"Undefined function can not be suppressed.", ?_assert(string:str(RebarOut, "myapp_somemod:notavailable/1 is undefined function") =/= 0)}, - {"Supppressed undefined function call", ?_assert(string:str(RebarOut, + {"Supppressed undefined function call", ?_assert(string:str(RebarOut, "myapp_othermod:somefunc/0 calls undefined function myapp_somemod:notavailable/1") =:= 0)}, - {"Supppressed deprecated function", ?_assert(string:str(RebarOut, + {"Supppressed deprecated function", ?_assert(string:str(RebarOut, "myapp_mymod:fdeprecated/0 is deprecated function") =:= 0)}, - {"Supppressed deprecated function call", ?_assert(string:str(RebarOut, + {"Supppressed deprecated function call", ?_assert(string:str(RebarOut, "myapp_othermod:somefunc/0 calls deprecated function myapp_mymod:fdeprecated/0") =:= 0)}, - {"Supppressed unused local", ?_assert(string:str(RebarOut, + {"Supppressed unused local", ?_assert(string:str(RebarOut, "myapp_mymod:localfunc2/0 is unused local function") =:= 0)}, - {"Supppressed unused export 1", ?_assert(string:str(RebarOut, + {"Supppressed unused export 1", ?_assert(string:str(RebarOut, "myapp_behaviour1:behaviour_info/1 is unused export") =:= 0)}, - {"Supppressed unused export 2", ?_assert(string:str(RebarOut, + {"Supppressed unused export 2", ?_assert(string:str(RebarOut, "myapp_behaviour2:behaviour_info/1 is unused export") =:= 0)}, - {"Supppressed unused export 3", ?_assert(string:str(RebarOut, + {"Supppressed unused export 3", ?_assert(string:str(RebarOut, "myapp_mymod:other2/1 is unused export") =:= 0)}, - {"Supppressed unused export 4", ?_assert(string:str(RebarOut, + {"Supppressed unused export 4", ?_assert(string:str(RebarOut, "myapp_othermod:somefunc/0 is unused export") =:= 0)}, - {"Suppressed behaviour export 1", ?_assert(string:str(RebarOut, + {"Suppressed behaviour export 1", ?_assert(string:str(RebarOut, "myapp_mymod:bh1_a/1 is unused export") =:= 0)}, - {"Suppressed behaviour export 2", ?_assert(string:str(RebarOut, + {"Suppressed behaviour export 2", ?_assert(string:str(RebarOut, "myapp_mymod:bh1_b/1 is unused export") =:= 0)}, - {"Suppressed behaviour export 3", ?_assert(string:str(RebarOut, + {"Suppressed behaviour export 3", ?_assert(string:str(RebarOut, "myapp_mymod:bh2_a/1 is unused export") =:= 0)}, - {"Suppressed behaviour export 4", ?_assert(string:str(RebarOut, + {"Suppressed behaviour export 4", ?_assert(string:str(RebarOut, "myapp_mymod:bh2_b/1 is unused export") =:= 0)} ] @@ -116,7 +114,7 @@ xref_ignore_test_() -> "bh2_a(A) -> localfunc1(bh2_a, A).\n", "bh2_b(A) -> localfunc1(bh2_b, A).\n", "other1(A) -> localfunc1(other1, A).\n", % regular exported functions - "other2(A) -> localfunc1(other2, A).\n", + "other2(A) -> localfunc1(other2, A).\n", "localfunc1(A, B) -> {A, B}.\n", % used local "localfunc2() -> ok.\n", % unused local "fdeprecated() -> ok.\n" % deprecated function @@ -155,7 +153,7 @@ setup_environment() -> prepare_project() -> setup_environment(), rebar("create-app appid=myapp"), - ok = file:make_dir("ebin"). + ok = file:make_dir("ebin"). setup_project(ignore_xref) -> prepare_project(), @@ -196,9 +194,6 @@ prepare_rebar_script() -> ?TMP_DIR ++ "rebar.cmd") end. -rebar() -> - rebar([]). - rebar(Args) when is_list(Args) -> Out = os:cmd(filename:nativename("./rebar") ++ " " ++ Args), %% ?debugMsg("**** Begin"), ?debugMsg(Out), ?debugMsg("**** End"), -- cgit v1.2.1