Fix test/rebar_eunit_tests.erl

This commit is contained in:
Slava Yurin 2012-06-29 10:54:17 +07:00 committed by Tuncer Ayaz
parent cf24426c4f
commit 22dec4cbb7

View file

@ -77,18 +77,21 @@ cover_with_suite_test_() ->
setup, setup,
fun() -> fun() ->
setup_cover_project_with_suite(), setup_cover_project_with_suite(),
rebar("-v eunit suite=mysuite") rebar("-v eunit suites=mysuite")
end, end,
fun teardown/1, fun teardown/1,
[{"All cover reports are generated", [{"Cover reports are generated for module",
assert_files_in("the temporary eunit directory", assert_files_in("the temporary eunit directory",
expected_cover_generated_files())}, [".eunit/index.html",
".eunit/mysuite.COVER.html"])},
{"Only production modules get coverage reports", {"Only production modules get coverage reports",
assert_files_not_in("the temporary eunit directory", assert_files_not_in("the temporary eunit directory",
[".eunit/myapp_mymod_tests.COVER.html", [".eunit/myapp_app.COVER.html",
".eunit/mysuite.COVER.html"])}]}. ".eunit/myapp_mymod.COVER.html",
".eunit/myapp_sup.COVER.html",
".eunit/myapp_mymod_tests.COVER.html"])}]}.
expected_cover_generated_files() -> expected_cover_generated_files() ->
[".eunit/index.html", [".eunit/index.html",
@ -247,6 +250,5 @@ assert_full_coverage(Mod) ->
Result = [X || X <- string:tokens(binary_to_list(F), "\n"), Result = [X || X <- string:tokens(binary_to_list(F), "\n"),
string:str(X, Mod) =/= 0, string:str(X, Mod) =/= 0,
string:str(X, "100%") =/= 0], string:str(X, "100%") =/= 0],
ok = file:close(F),
?assert(length(Result) =:= 1) ?assert(length(Result) =:= 1)
end. end.