|
|
|
@ -8,9 +8,8 @@ import (
|
|
|
|
|
"strings"
|
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
|
|
"github.com/zeromicro/go-zero/tools/goctl/api/spec"
|
|
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
|
"github.com/zeromicro/go-zero/tools/goctl/api/spec"
|
|
|
|
|
"github.com/zeromicro/go-zero/tools/goctl/pkg/parser/api/assertx"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
@ -43,6 +42,7 @@ func Test_Parse(t *testing.T) {
|
|
|
|
|
return false
|
|
|
|
|
}())
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
t.Run("invalid", func(t *testing.T) {
|
|
|
|
|
data, err := os.ReadFile("./testdata/invalid.api")
|
|
|
|
|
assert.NoError(t, err)
|
|
|
|
@ -64,15 +64,17 @@ func Test_Parse(t *testing.T) {
|
|
|
|
|
assertx.Error(t, err)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
t.Run("circleImport", func(t *testing.T) {
|
|
|
|
|
_, err := Parse("./testdata/base.api", nil)
|
|
|
|
|
assertx.Error(t, err)
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
t.Run("link_import", func(t *testing.T) {
|
|
|
|
|
_, err := Parse("./testdata/link_import.api", nil)
|
|
|
|
|
assert.Nil(t, err)
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
t.Run("duplicate_types", func(t *testing.T) {
|
|
|
|
|
_, err := Parse("./testdata/duplicate_type.api", nil)
|
|
|
|
|
assertx.Error(t, err)
|
|
|
|
|