summaryrefslogtreecommitdiff
path: root/note_test.go
diff options
context:
space:
mode:
authorPatrick Steinhardt <[email protected]>2015-04-24 12:59:29 +0200
committerPatrick Steinhardt <[email protected]>2015-04-24 13:01:51 +0200
commite300945a3d456af1b619447347cd19a779b7a8f5 (patch)
tree3e37d99c8266d130ea54b2080e20199e8073e99e /note_test.go
parente021457f27654ea0f1ec41963c6da62c168be853 (diff)
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.
Diffstat (limited to 'note_test.go')
-rw-r--r--note_test.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/note_test.go b/note_test.go
index f5e9c01..e6c378d 100644
--- a/note_test.go
+++ b/note_test.go
@@ -2,7 +2,6 @@ package git
import (
"fmt"
- "os"
"reflect"
"testing"
"time"
@@ -10,7 +9,7 @@ import (
func TestCreateNote(t *testing.T) {
repo := createTestRepo(t)
- defer os.RemoveAll(repo.Workdir())
+ defer cleanupTestRepo(t, repo)
commitId, _ := seedTestRepo(t, repo)
@@ -29,7 +28,8 @@ func TestCreateNote(t *testing.T) {
func TestNoteIterator(t *testing.T) {
repo := createTestRepo(t)
- defer os.RemoveAll(repo.Workdir())
+ defer cleanupTestRepo(t, repo)
+
seedTestRepo(t, repo)
notes := make([]*Note, 5)
@@ -64,7 +64,7 @@ func TestNoteIterator(t *testing.T) {
func TestRemoveNote(t *testing.T) {
repo := createTestRepo(t)
- defer os.RemoveAll(repo.Workdir())
+ defer cleanupTestRepo(t, repo)
commitId, _ := seedTestRepo(t, repo)
@@ -87,7 +87,7 @@ func TestRemoveNote(t *testing.T) {
func TestDefaultNoteRef(t *testing.T) {
repo := createTestRepo(t)
- defer os.RemoveAll(repo.Workdir())
+ defer cleanupTestRepo(t, repo)
ref, err := repo.DefaultNoteRef()
checkFatal(t, err)