From e300945a3d456af1b619447347cd19a779b7a8f5 Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Fri, 24 Apr 2015 12:59:29 +0200 Subject: tests: always clean up temporary repository dirs Some test repositories are not correctly removed after the tests did run. Fix by introducing a function that is to be used for cleaning up temporary test repositories. --- merge_test.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'merge_test.go') diff --git a/merge_test.go b/merge_test.go index 1eba806..0b1faca 100644 --- a/merge_test.go +++ b/merge_test.go @@ -1,13 +1,13 @@ package git import ( - "os" "testing" ) func TestMergeWithSelf(t *testing.T) { - repo := createTestRepo(t) + defer cleanupTestRepo(t, repo) + seedTestRepo(t, repo) master, err := repo.LookupReference("refs/heads/master") @@ -23,8 +23,9 @@ func TestMergeWithSelf(t *testing.T) { } func TestMergeAnalysisWithSelf(t *testing.T) { - repo := createTestRepo(t) + defer cleanupTestRepo(t, repo) + seedTestRepo(t, repo) master, err := repo.LookupReference("refs/heads/master") @@ -44,7 +45,6 @@ func TestMergeAnalysisWithSelf(t *testing.T) { } func TestMergeSameFile(t *testing.T) { - file := MergeFileInput{ Path: "test", Mode: 33188, @@ -68,8 +68,7 @@ func TestMergeSameFile(t *testing.T) { } func TestMergeTreesWithoutAncestor(t *testing.T) { repo := createTestRepo(t) - defer repo.Free() - defer os.RemoveAll(repo.Workdir()) + defer cleanupTestRepo(t, repo) _, originalTreeId := seedTestRepo(t, repo) originalTree, err := repo.LookupTree(originalTreeId) -- cgit v1.2.3