* add comment support * add comment support * 1. group support multi level folder 2. remove force flag * bug fix * refactor parser and remove deprecated code * refactor parser and remove deprecated code * refactor parser and remove deprecated code * refactor parser and remove deprecated code * refactor parser and remove deprecated code * refactor parser and remove deprecated code * refactor parser and remove deprecated code * support type def without struct token * support type def without struct token * support type def without struct token * support type def without struct token * support type def without struct token * support type def without struct token * support type def without struct token * optimized * optimized * optimized Co-authored-by: kim <xutao@xiaoheiban.cn>
47 lines
618 B
Go
47 lines
618 B
Go
package format
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
const (
|
|
notFormattedStr = `
|
|
type Request struct {
|
|
Name string
|
|
}
|
|
|
|
type Response struct {
|
|
Message string
|
|
}
|
|
|
|
service A-api {
|
|
@server(
|
|
handler: GreetHandler
|
|
)
|
|
get /greet/from/:name(Request) returns (Response)
|
|
}
|
|
`
|
|
|
|
formattedStr = `type Request struct {
|
|
Name string
|
|
}
|
|
|
|
type Response struct {
|
|
Message string
|
|
}
|
|
|
|
service A-api {
|
|
@server(
|
|
handler: GreetHandler
|
|
)
|
|
get /greet/from/:name(Request) returns (Response)
|
|
}`
|
|
)
|
|
|
|
func TestInlineTypeNotExist(t *testing.T) {
|
|
r := apiFormat(notFormattedStr)
|
|
assert.Equal(t, r, formattedStr)
|
|
}
|