aboutsummaryrefslogtreecommitdiffstats
path: root/tests/read_bugs_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'tests/read_bugs_test.go')
-rw-r--r--tests/read_bugs_test.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/read_bugs_test.go b/tests/read_bugs_test.go
index c3c7d9ea..b28da49b 100644
--- a/tests/read_bugs_test.go
+++ b/tests/read_bugs_test.go
@@ -1,6 +1,8 @@
package tests
import (
+ "io/ioutil"
+ "log"
"testing"
"github.com/MichaelMure/git-bug/bug"
@@ -8,6 +10,30 @@ import (
"github.com/MichaelMure/git-bug/repository"
)
+func createRepo(bare bool) *repository.GitRepo {
+ dir, err := ioutil.TempDir("", "")
+ if err != nil {
+ log.Fatal(err)
+ }
+
+ // fmt.Println("Creating repo:", dir)
+
+ var creator func(string) (*repository.GitRepo, error)
+
+ if bare {
+ creator = repository.InitBareGitRepo
+ } else {
+ creator = repository.InitGitRepo
+ }
+
+ repo, err := creator(dir)
+ if err != nil {
+ log.Fatal(err)
+ }
+
+ return repo
+}
+
func createFilledRepo(bugNumber int) repository.ClockedRepo {
repo := createRepo(false)