aboutsummaryrefslogtreecommitdiff
path: root/beku_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'beku_test.go')
-rw-r--r--beku_test.go18
1 files changed, 12 insertions, 6 deletions
diff --git a/beku_test.go b/beku_test.go
index e972b64..7b23cc3 100644
--- a/beku_test.go
+++ b/beku_test.go
@@ -9,6 +9,7 @@ import (
"go/build"
"log"
"os"
+ "path/filepath"
"testing"
"github.com/shuLhan/share/lib/debug"
@@ -23,12 +24,12 @@ const (
)
var (
- testEnv *Env //nolint: gochecknoglobals
- testGitPkgCur *Package //nolint: gochecknoglobals
- testGitPkgNew *Package //nolint: gochecknoglobals
- testGitPkgInstall *Package //nolint: gochecknoglobals
+ testEnv *Env
+ testGitPkgCur *Package
+ testGitPkgNew *Package
+ testGitPkgInstall *Package
- testGitRepoSrcLocal = "/testdata/beku_test.git" //nolint: gochecknoglobals
+ testGitRepoSrcLocal = `/testdata/beku_test.git`
)
func TestMain(m *testing.M) {
@@ -39,7 +40,7 @@ func TestMain(m *testing.M) {
log.Fatal(err)
}
- testGOPATH += "/testdata"
+ testGOPATH = filepath.Join(testGOPATH, `testdata`)
build.Default.GOPATH = testGOPATH
defer func() {
@@ -54,6 +55,11 @@ func TestMain(m *testing.M) {
log.Fatal(err)
}
+ err = os.RemoveAll(testEnv.dirSrc)
+ if err != nil {
+ log.Fatal(err)
+ }
+
testGitPkgCur, _ = NewPackage(testEnv.dirSrc, testGitRepo, testGitRepo)
testGitPkgNew, _ = NewPackage(testEnv.dirSrc, testGitRepo, testGitRepo)
testGitPkgInstall, _ = NewPackage(testEnv.dirSrc, testGitRepo, testGitRepo)