You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
go-zero/tools/goctl/util/ctx/context_test.go

23 lines
385 B
Go

package ctx
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestBackground(t *testing.T) {
workDir := "."
ctx, err := Prepare(workDir)
assert.Nil(t, err)
assert.True(t, true, func() bool {
return len(ctx.Dir) != 0 && len(ctx.Path) != 0
}())
}
func TestBackgroundNilWorkDir(t *testing.T) {
workDir := ""
_, err := Prepare(workDir)
assert.NotNil(t, err)
}