Skip to content

Commit

Permalink
Fix whitespace errors in unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Tuncer Ayaz committed Aug 4, 2011
1 parent fe75f8e commit 5f2930b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 17 deletions.
33 changes: 17 additions & 16 deletions test/rebar_eunit_tests.erl
Expand Up @@ -51,13 +51,13 @@ eunit_test_() ->
fun(RebarOut) ->
[{"Tests in 'test' directory are found and run",
?_assert(string:str(RebarOut, "myapp_mymod_tests:") =/= 0)},

{"Tests in 'src' directory are found and run",
?_assert(string:str(RebarOut, "myapp_mymod:") =/= 0)},

{"Tests are only run once",
?_assert(string:str(RebarOut, "All 2 tests passed") =/= 0)}]
end}.
end}.

cover_test_() ->
{"Ensure Cover runs with tests in a test dir and no defined suite",
Expand All @@ -67,7 +67,7 @@ cover_test_() ->
[{"All cover reports are generated",
assert_files_in("the temporary eunit directory",
expected_cover_generated_files())},

{"Only production modules get coverage reports",
assert_files_not_in("the temporary eunit directory",
[".eunit/myapp_mymod_tests.COVER.html"])}]}.
Expand Down Expand Up @@ -115,7 +115,7 @@ environment_test_() ->
{"Sanity check the testing environment",
setup, fun make_tmp_dir/0, fun remove_tmp_dir/1,

[{"Ensure a test project can be created",
[{"Ensure a test project can be created",
?_assert(filelib:is_dir(?TMP_DIR))},

{"Ensure the rebar script can be found, copied, and run",
Expand All @@ -134,21 +134,22 @@ basic_setup_test_() ->
%% Test the setup function
assert_dirs_in("Basic Project",
["src", "ebin", "test"]) ++
assert_files_in("Basic Project",
["test/myapp_mymod_tests.erl", "src/myapp_mymod.erl"])}.
assert_files_in("Basic Project",
["test/myapp_mymod_tests.erl",
"src/myapp_mymod.erl"])}.

%% ====================================================================
%% Setup and Teardown
%% ====================================================================

-define(myapp_mymod,
-define(myapp_mymod,
["-module(myapp_mymod).\n",
"-export([myfunc/0]).\n",
"-include_lib(\"eunit/include/eunit.hrl\").\n",
"myfunc() -> ok.\n",
"myprivate_test() -> ?assert(true).\n"]).

-define(myapp_mymod_tests,
-define(myapp_mymod_tests,
["-module(myapp_mymod_tests).\n",
"-compile([export_all]).\n",
"-include_lib(\"eunit/include/eunit.hrl\").\n",
Expand All @@ -160,7 +161,7 @@ basic_setup_test_() ->
"-include_lib(\"eunit/include/eunit.hrl\").\n",
"all_test_() -> [myapp_mymod_defined_in_mysuite_tests].\n"]).

-define(myapp_mymod_defined_in_mysuite_tests,
-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",
Expand Down Expand Up @@ -200,7 +201,7 @@ teardown(_) ->
remove_tmp_dir() ->
remove_tmp_dir(arg_for_eunit).

remove_tmp_dir(_) ->
remove_tmp_dir(_) ->
case os:type() of
{unix, _} ->
os:cmd("rm -rf " ++ ?TMP_DIR ++ " 2>/dev/null");
Expand All @@ -227,22 +228,22 @@ rebar() ->

rebar(Args) when is_list(Args) ->
Out = os:cmd(filename:nativename("./rebar") ++ " " ++ Args),
%?debugMsg("**** Begin"), ?debugMsg(Out), ?debugMsg("**** End"),
%% ?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(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)];
assert_files_in(Name, T)];
assert_files_in(_, []) -> [].

assert_files_not_in(Name, [File|T]) ->
[{Name ++ " does not have file: " ++ File, ?_assertNot(filelib:is_regular(File))} |
assert_files_not_in(Name, T)];
[{Name ++ " does not have file: " ++ File,
?_assertNot(filelib:is_regular(File))} | assert_files_not_in(Name, T)];
assert_files_not_in(_, []) -> [].

assert_full_coverage(Mod) ->
Expand Down
3 changes: 2 additions & 1 deletion test/rebar_file_utils_tests.erl
Expand Up @@ -225,7 +225,8 @@ mv_file_test_() ->
end,
fun teardown/1,
[?_assert(filelib:is_regular(filename:join([?TMP_DIR,"dest","file1"]))),
?_assertNot(filelib:is_regular(filename:join([?TMP_DIR,"source","file1"])))]}.
?_assertNot(filelib:is_regular(
filename:join([?TMP_DIR,"source","file1"])))]}.

%% ====================================================================
%% Utilities
Expand Down

0 comments on commit 5f2930b

Please sign in to comment.