mirror of
https://github.com/beego/bee.git
synced 2024-11-14 22:10:55 +00:00
34 lines
513 B
Go
34 lines
513 B
Go
package beeParser
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestFormat(t *testing.T) {
|
|
except := `{
|
|
"Name": [
|
|
"Field1"
|
|
],
|
|
"Path":[
|
|
"https://github.com/beego/bee",
|
|
"https://github.com/beego"
|
|
],
|
|
"test":[
|
|
"test comment"
|
|
]
|
|
}`
|
|
|
|
field := &StructField{
|
|
Comment: "@test test comment",
|
|
Doc: `@Name Field1
|
|
@Path https://github.com/beego/bee
|
|
https://github.com/beego`,
|
|
}
|
|
|
|
actual := NewAnnotationFormatter().Format(field)
|
|
|
|
assert.JSONEq(t, except, actual)
|
|
}
|