goc/pkg/build/install_test.go
lyyyuna a5f358576d add unit test
add unit test for install

fix unit test

add  license

add test
2020-06-17 15:01:20 +08:00

25 lines
655 B
Go

package build
import (
"github.com/stretchr/testify/assert"
"os"
"path/filepath"
"testing"
)
func TestBasicInstallForModProject(t *testing.T) {
workingDir := filepath.Join(baseDir, "../tests/samples/simple_project")
gopath := filepath.Join(baseDir, "../tests/samples/simple_project", "testhome")
os.Chdir(workingDir)
os.Setenv("GOPATH", gopath)
os.Setenv("GO111MODULE", "on")
buildFlags, packages := "", "."
gocBuild, err := NewInstall(buildFlags, packages)
assert.Equal(t, err, nil, "should create temporary directory successfully")
err = gocBuild.Install()
assert.Equal(t, err, nil, "temporary directory should build successfully")
}