1
0
mirror of https://github.com/json-iterator/go.git synced 2025-06-15 22:50:24 +02:00

consolidate more tests

This commit is contained in:
Tao Wen
2018-02-14 08:58:59 +08:00
parent 658ff9ef15
commit a8708bca85
6 changed files with 54 additions and 108 deletions

View File

@ -7,6 +7,9 @@ import (
)
func init() {
var pString = func(val string) *string {
return &val
}
unmarshalCases = append(unmarshalCases, unmarshalCase{
ptr: (*struct {
Field interface{}
@ -34,6 +37,18 @@ func init() {
Field1 string
})(nil),
input: `{"\u0046ield1":"hello"}`,
}, unmarshalCase{
ptr: (*struct {
Field1 *string
Field2 *string
})(nil),
input: `{"field1": null, "field2": "world"}`,
}, unmarshalCase{
ptr: (*struct {
Field1 string
Field2 json.RawMessage
})(nil),
input: `{"field1": "hello", "field2":[1,2,3]}`,
})
marshalCases = append(marshalCases,
struct {
@ -116,6 +131,10 @@ func init() {
MaxAge: 20,
},
structOrder{},
struct {
Field1 *string
Field2 *string
}{Field2: pString("world")},
)
}