diff options
author | Michael Muré <batolettre@gmail.com> | 2018-09-28 20:39:39 +0200 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2018-09-29 00:51:54 +0200 |
commit | 1bf268cebc84a9de1e538cbb54bcc0f434022192 (patch) | |
tree | daeb92cd6b15d56a7a7102f95b73756e5b9597d0 /tests/read_bugs_test.go | |
parent | 8af6f7d98f2fd98f85d6a17bcda49983c272cf48 (diff) | |
download | git-bug-1bf268cebc84a9de1e538cbb54bcc0f434022192.tar.gz |
merge package operations into bug, they are tightly coupled anyway
Diffstat (limited to 'tests/read_bugs_test.go')
-rw-r--r-- | tests/read_bugs_test.go | 26 |
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) |