add test failing to marshal json schema
This commit is contained in:
parent
82cb4ebfe2
commit
370ddcbdf1
@ -1,6 +1,7 @@
|
||||
package schema_test
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"strings"
|
||||
"sync"
|
||||
"testing"
|
||||
@ -297,3 +298,20 @@ func TestEmbeddedStructForCustomizedNamingStrategy(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
func TestSchemaParseMarshalJson(t *testing.T) {
|
||||
type model struct {
|
||||
gorm.Model
|
||||
Title string
|
||||
}
|
||||
v := &model{Title: "test"}
|
||||
schema, err := schema.Parse(v, &sync.Map{}, schema.NamingStrategy{})
|
||||
if err != nil {
|
||||
t.Fatalf("error while parsing schema %v", err)
|
||||
}
|
||||
_, err = json.MarshalIndent(schema, "", "\t")
|
||||
if err != nil {
|
||||
t.Fatalf("error while json marshaling schema %v", err)
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user