6
0
mirror of https://github.com/grdl/git-get.git synced 2026-02-10 09:04:25 +00:00

Use t.Cleanup instead of defer to cleanup after tests

This commit is contained in:
Grzegorz Dlugoszewski
2020-05-18 22:49:33 +02:00
parent 4ce4381c57
commit 242d17ceb5
2 changed files with 4 additions and 9 deletions

View File

@@ -32,6 +32,10 @@ func newTestRepo(t *testing.T) *git.Repository {
repo, err := git.InitRepository(dir, false)
checkFatal(t, errors.Wrap(err, "Failed initializing a temp repo"))
// Automatically remove repo when test is over
t.Cleanup(func() {
cleanupRepo(t, repo)
})
return repo
}