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:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user