From b420b61c198845f036908af1f6cd7c1a0f436d3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Thu, 2 May 2013 19:40:01 +0200 Subject: [PATCH] Clean up after the repo tests --- test/repo_test.erl | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/test/repo_test.erl b/test/repo_test.erl index 20750b6..dfcc66f 100644 --- a/test/repo_test.erl +++ b/test/repo_test.erl @@ -32,5 +32,21 @@ create_ref_test(Repo) -> [?_assertEqual(geef_ref:target(Ref0), Id), ?_assertEqual(geef_ref:target(Ref1), <<"refs/heads/branch">>)]. +rm_r(Path) -> + case filelib:is_dir(Path) of + false -> + ok = file:delete(Path); + true -> + case file:list_dir(Path) of + {ok, []} -> + ok = file:del_dir(Path); + {ok, Filenames} -> + lists:foreach(fun(X) -> rm_r(filename:join([Path, X])) end, Filenames), + file:del_dir(Path) + end + end. + stop(Repo) -> - geef_repo:stop(Repo). + Path = geef_repo:path(Repo), + geef_repo:stop(Repo), + rm_r(Path).