2020-11-05 14:12:47 +08:00
|
|
|
package generator
|
|
|
|
|
|
|
|
import (
|
|
|
|
"path/filepath"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
2022-01-25 23:15:07 +08:00
|
|
|
"github.com/zeromicro/go-zero/tools/goctl/util/pathx"
|
2020-11-05 14:12:47 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestProtoTmpl(t *testing.T) {
|
2020-11-18 15:32:53 +08:00
|
|
|
_ = Clean()
|
|
|
|
// exists dir
|
2022-01-03 21:32:40 +08:00
|
|
|
err := ProtoTmpl(pathx.MustTempDir())
|
2020-11-05 14:12:47 +08:00
|
|
|
assert.Nil(t, err)
|
2020-11-18 15:32:53 +08:00
|
|
|
|
|
|
|
// not exist dir
|
2022-01-03 21:32:40 +08:00
|
|
|
dir := filepath.Join(pathx.MustTempDir(), "test")
|
2020-11-18 15:32:53 +08:00
|
|
|
err = ProtoTmpl(dir)
|
2020-11-05 14:12:47 +08:00
|
|
|
assert.Nil(t, err)
|
|
|
|
}
|