optimize code (#579)

* optimize code

* optimize returns & unit test
This commit is contained in:
anqiansong
2021-03-27 17:33:17 +08:00
committed by GitHub
parent bd623aaac3
commit 888551627c
5 changed files with 108 additions and 73 deletions

View File

@@ -6,6 +6,8 @@ import (
"path/filepath"
"testing"
"github.com/tal-tech/go-zero/tools/goctl/model/sql/gen"
"github.com/stretchr/testify/assert"
"github.com/tal-tech/go-zero/tools/goctl/config"
"github.com/tal-tech/go-zero/tools/goctl/util"
@@ -19,7 +21,10 @@ var (
)
func TestFromDDl(t *testing.T) {
err := fromDDl("./user.sql", t.TempDir(), cfg, true, false)
err := gen.Clean()
assert.Nil(t, err)
err = fromDDl("./user.sql", t.TempDir(), cfg, true, false)
assert.Equal(t, errNotMatched, err)
// case dir is not exists