2021-01-16 16:16:26 +03:00
|
|
|
package json_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"bytes"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/goccy/go-json"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestCoverInt32(t *testing.T) {
|
|
|
|
type structInt32 struct {
|
|
|
|
A int32 `json:"a"`
|
|
|
|
}
|
2021-01-18 15:50:52 +03:00
|
|
|
type structInt32OmitEmpty struct {
|
|
|
|
A int32 `json:"a,omitempty"`
|
|
|
|
}
|
|
|
|
type structInt32String struct {
|
|
|
|
A int32 `json:"a,string"`
|
|
|
|
}
|
|
|
|
|
2021-01-16 16:16:26 +03:00
|
|
|
type structInt32Ptr struct {
|
|
|
|
A *int32 `json:"a"`
|
|
|
|
}
|
2021-01-18 15:50:52 +03:00
|
|
|
type structInt32PtrOmitEmpty struct {
|
|
|
|
A *int32 `json:"a,omitempty"`
|
|
|
|
}
|
|
|
|
type structInt32PtrString struct {
|
|
|
|
A *int32 `json:"a,string"`
|
|
|
|
}
|
2021-01-16 16:16:26 +03:00
|
|
|
|
|
|
|
tests := []struct {
|
2021-02-14 20:53:12 +03:00
|
|
|
name string
|
|
|
|
data interface{}
|
2021-01-16 16:16:26 +03:00
|
|
|
}{
|
2021-01-18 15:50:52 +03:00
|
|
|
// HeadInt32Zero
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "HeadInt32Zero",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
A int32 `json:"a"`
|
|
|
|
}{},
|
|
|
|
},
|
2021-01-18 15:50:52 +03:00
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "HeadInt32ZeroOmitEmpty",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
A int32 `json:"a,omitempty"`
|
|
|
|
}{},
|
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "HeadInt32ZeroString",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
A int32 `json:"a,string"`
|
|
|
|
}{},
|
|
|
|
},
|
|
|
|
|
|
|
|
// HeadInt32
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "HeadInt32",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
A int32 `json:"a"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: -1},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
2021-01-18 15:50:52 +03:00
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "HeadInt32OmitEmpty",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
A int32 `json:"a,omitempty"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: -1},
|
2021-01-18 15:50:52 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "HeadInt32String",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
A int32 `json:"a,string"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: -1},
|
2021-01-18 15:50:52 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
// HeadInt32Ptr
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "HeadInt32Ptr",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
A *int32 `json:"a"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: int32ptr(-1)},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
2021-01-18 15:50:52 +03:00
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "HeadInt32PtrOmitEmpty",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
A *int32 `json:"a,omitempty"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: int32ptr(-1)},
|
2021-01-18 15:50:52 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "HeadInt32PtrString",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
A *int32 `json:"a,string"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: int32ptr(-1)},
|
2021-01-18 15:50:52 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
// HeadInt32PtrNil
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "HeadInt32PtrNil",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
A *int32 `json:"a"`
|
|
|
|
}{A: nil},
|
|
|
|
},
|
2021-01-18 15:50:52 +03:00
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "HeadInt32PtrNilOmitEmpty",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
A *int32 `json:"a,omitempty"`
|
|
|
|
}{A: nil},
|
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "HeadInt32PtrNilString",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
A *int32 `json:"a,string"`
|
|
|
|
}{A: nil},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadInt32Zero
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32Zero",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: &struct {
|
|
|
|
A int32 `json:"a"`
|
|
|
|
}{},
|
|
|
|
},
|
2021-01-18 15:50:52 +03:00
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32ZeroOmitEmpty",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: &struct {
|
|
|
|
A int32 `json:"a,omitempty"`
|
|
|
|
}{},
|
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32ZeroString",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: &struct {
|
|
|
|
A int32 `json:"a,string"`
|
|
|
|
}{},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadInt32
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: &struct {
|
|
|
|
A int32 `json:"a"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: -1},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
2021-01-18 15:50:52 +03:00
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32OmitEmpty",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: &struct {
|
|
|
|
A int32 `json:"a,omitempty"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: -1},
|
2021-01-18 15:50:52 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32String",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: &struct {
|
|
|
|
A int32 `json:"a,string"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: -1},
|
2021-01-18 15:50:52 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadInt32Ptr
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32Ptr",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: &struct {
|
|
|
|
A *int32 `json:"a"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: int32ptr(-1)},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
2021-01-18 15:50:52 +03:00
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32PtrOmitEmpty",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: &struct {
|
|
|
|
A *int32 `json:"a,omitempty"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: int32ptr(-1)},
|
2021-01-18 15:50:52 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32PtrString",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: &struct {
|
|
|
|
A *int32 `json:"a,string"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: int32ptr(-1)},
|
2021-01-18 15:50:52 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadInt32PtrNil
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32PtrNil",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: &struct {
|
|
|
|
A *int32 `json:"a"`
|
|
|
|
}{A: nil},
|
|
|
|
},
|
2021-01-18 15:50:52 +03:00
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32PtrNilOmitEmpty",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: &struct {
|
|
|
|
A *int32 `json:"a,omitempty"`
|
|
|
|
}{A: nil},
|
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32PtrNilString",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: &struct {
|
|
|
|
A *int32 `json:"a,string"`
|
|
|
|
}{A: nil},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadInt32Nil
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32Nil",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: (*struct {
|
|
|
|
A *int32 `json:"a"`
|
|
|
|
})(nil),
|
|
|
|
},
|
2021-01-18 15:50:52 +03:00
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32NilOmitEmpty",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: (*struct {
|
|
|
|
A *int32 `json:"a,omitempty"`
|
|
|
|
})(nil),
|
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32NilString",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: (*struct {
|
|
|
|
A *int32 `json:"a,string"`
|
|
|
|
})(nil),
|
|
|
|
},
|
|
|
|
|
|
|
|
// HeadInt32ZeroMultiFields
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "HeadInt32ZeroMultiFields",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
A int32 `json:"a"`
|
|
|
|
B int32 `json:"b"`
|
2021-02-14 20:53:12 +03:00
|
|
|
C int32 `json:"c"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}{},
|
|
|
|
},
|
2021-01-18 15:50:52 +03:00
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "HeadInt32ZeroMultiFieldsOmitEmpty",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
A int32 `json:"a,omitempty"`
|
|
|
|
B int32 `json:"b,omitempty"`
|
2021-02-14 20:53:12 +03:00
|
|
|
C int32 `json:"c,omitempty"`
|
2021-01-18 15:50:52 +03:00
|
|
|
}{},
|
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "HeadInt32ZeroMultiFields",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
A int32 `json:"a,string"`
|
|
|
|
B int32 `json:"b,string"`
|
2021-02-14 20:53:12 +03:00
|
|
|
C int32 `json:"c,string"`
|
2021-01-18 15:50:52 +03:00
|
|
|
}{},
|
|
|
|
},
|
|
|
|
|
|
|
|
// HeadInt32MultiFields
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "HeadInt32MultiFields",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
A int32 `json:"a"`
|
|
|
|
B int32 `json:"b"`
|
2021-02-14 20:53:12 +03:00
|
|
|
C int32 `json:"c"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: -1, B: 2, C: 3},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "HeadInt32MultiFieldsOmitEmpty",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
2021-01-18 15:50:52 +03:00
|
|
|
A int32 `json:"a,omitempty"`
|
|
|
|
B int32 `json:"b,omitempty"`
|
2021-02-14 20:53:12 +03:00
|
|
|
C int32 `json:"c,omitempty"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: -1, B: 2, C: 3},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "HeadInt32MultiFieldsString",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
2021-01-18 15:50:52 +03:00
|
|
|
A int32 `json:"a,string"`
|
|
|
|
B int32 `json:"b,string"`
|
2021-02-14 20:53:12 +03:00
|
|
|
C int32 `json:"c,string"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: -1, B: 2, C: 3},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
2021-01-18 15:50:52 +03:00
|
|
|
|
|
|
|
// HeadInt32PtrMultiFields
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "HeadInt32PtrMultiFields",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
A *int32 `json:"a"`
|
|
|
|
B *int32 `json:"b"`
|
2021-02-14 20:53:12 +03:00
|
|
|
C *int32 `json:"c"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: int32ptr(-1), B: int32ptr(2), C: int32ptr(3)},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "HeadInt32PtrMultiFieldsOmitEmpty",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
A *int32 `json:"a,omitempty"`
|
|
|
|
B *int32 `json:"b,omitempty"`
|
2021-02-14 20:53:12 +03:00
|
|
|
C *int32 `json:"c,omitempty"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: int32ptr(-1), B: int32ptr(2), C: int32ptr(3)},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "HeadInt32PtrMultiFieldsString",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
A *int32 `json:"a,string"`
|
|
|
|
B *int32 `json:"b,string"`
|
2021-02-14 20:53:12 +03:00
|
|
|
C *int32 `json:"c,string"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: int32ptr(-1), B: int32ptr(2), C: int32ptr(3)},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
2021-01-18 15:50:52 +03:00
|
|
|
|
|
|
|
// HeadInt32PtrNilMultiFields
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "HeadInt32PtrNilMultiFields",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
2021-01-16 16:16:26 +03:00
|
|
|
A *int32 `json:"a"`
|
|
|
|
B *int32 `json:"b"`
|
2021-02-14 20:53:12 +03:00
|
|
|
C *int32 `json:"c"`
|
|
|
|
}{A: nil, B: nil, C: nil},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "HeadInt32PtrNilMultiFieldsOmitEmpty",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
A *int32 `json:"a,omitempty"`
|
|
|
|
B *int32 `json:"b,omitempty"`
|
2021-02-14 20:53:12 +03:00
|
|
|
C *int32 `json:"c,omitempty"`
|
|
|
|
}{A: nil, B: nil, C: nil},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "HeadInt32PtrNilMultiFieldsString",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
A *int32 `json:"a,string"`
|
|
|
|
B *int32 `json:"b,string"`
|
2021-02-14 20:53:12 +03:00
|
|
|
C *int32 `json:"c,string"`
|
|
|
|
}{A: nil, B: nil, C: nil},
|
2021-01-18 15:50:52 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadInt32ZeroMultiFields
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32ZeroMultiFields",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: &struct {
|
|
|
|
A int32 `json:"a"`
|
|
|
|
B int32 `json:"b"`
|
|
|
|
}{},
|
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32ZeroMultiFieldsOmitEmpty",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: &struct {
|
|
|
|
A int32 `json:"a,omitempty"`
|
|
|
|
B int32 `json:"b,omitempty"`
|
|
|
|
}{},
|
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32ZeroMultiFieldsString",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: &struct {
|
|
|
|
A int32 `json:"a,string"`
|
|
|
|
B int32 `json:"b,string"`
|
|
|
|
}{},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadInt32MultiFields
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32MultiFields",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: &struct {
|
|
|
|
A int32 `json:"a"`
|
|
|
|
B int32 `json:"b"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: -1, B: 2},
|
2021-01-18 15:50:52 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32MultiFieldsOmitEmpty",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: &struct {
|
|
|
|
A int32 `json:"a,omitempty"`
|
|
|
|
B int32 `json:"b,omitempty"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: -1, B: 2},
|
2021-01-18 15:50:52 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32MultiFieldsString",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: &struct {
|
|
|
|
A int32 `json:"a,string"`
|
|
|
|
B int32 `json:"b,string"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: -1, B: 2},
|
2021-01-18 15:50:52 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadInt32PtrMultiFields
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32PtrMultiFields",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: &struct {
|
|
|
|
A *int32 `json:"a"`
|
|
|
|
B *int32 `json:"b"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: int32ptr(-1), B: int32ptr(2)},
|
2021-01-18 15:50:52 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32PtrMultiFieldsOmitEmpty",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: &struct {
|
|
|
|
A *int32 `json:"a,omitempty"`
|
|
|
|
B *int32 `json:"b,omitempty"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: int32ptr(-1), B: int32ptr(2)},
|
2021-01-18 15:50:52 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32PtrMultiFieldsString",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: &struct {
|
|
|
|
A *int32 `json:"a,string"`
|
|
|
|
B *int32 `json:"b,string"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: int32ptr(-1), B: int32ptr(2)},
|
2021-01-18 15:50:52 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadInt32PtrNilMultiFields
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32PtrNilMultiFields",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: &struct {
|
|
|
|
A *int32 `json:"a"`
|
|
|
|
B *int32 `json:"b"`
|
|
|
|
}{A: nil, B: nil},
|
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32PtrNilMultiFieldsOmitEmpty",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: &struct {
|
|
|
|
A *int32 `json:"a,omitempty"`
|
|
|
|
B *int32 `json:"b,omitempty"`
|
|
|
|
}{A: nil, B: nil},
|
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32PtrNilMultiFieldsString",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: &struct {
|
|
|
|
A *int32 `json:"a,string"`
|
|
|
|
B *int32 `json:"b,string"`
|
|
|
|
}{A: nil, B: nil},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadInt32NilMultiFields
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32NilMultiFields",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: (*struct {
|
|
|
|
A *int32 `json:"a"`
|
|
|
|
B *int32 `json:"b"`
|
|
|
|
})(nil),
|
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32NilMultiFieldsOmitEmpty",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: (*struct {
|
|
|
|
A *int32 `json:"a,omitempty"`
|
|
|
|
B *int32 `json:"b,omitempty"`
|
|
|
|
})(nil),
|
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32NilMultiFieldsString",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: (*struct {
|
|
|
|
A *int32 `json:"a,string"`
|
|
|
|
B *int32 `json:"b,string"`
|
|
|
|
})(nil),
|
|
|
|
},
|
|
|
|
|
|
|
|
// HeadInt32ZeroNotRoot
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "HeadInt32ZeroNotRoot",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A int32 `json:"a"`
|
|
|
|
}
|
|
|
|
}{},
|
|
|
|
},
|
2021-01-18 15:50:52 +03:00
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "HeadInt32ZeroNotRootOmitEmpty",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A int32 `json:"a,omitempty"`
|
|
|
|
}
|
|
|
|
}{},
|
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "HeadInt32ZeroNotRootString",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A int32 `json:"a,string"`
|
|
|
|
}
|
|
|
|
}{},
|
|
|
|
},
|
|
|
|
|
|
|
|
// HeadInt32NotRoot
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "HeadInt32NotRoot",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A int32 `json:"a"`
|
|
|
|
}
|
|
|
|
}{A: struct {
|
|
|
|
A int32 `json:"a"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: -1}},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "HeadInt32NotRootOmitEmpty",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
2021-01-18 15:50:52 +03:00
|
|
|
A int32 `json:"a,omitempty"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
|
|
|
}{A: struct {
|
2021-01-18 15:50:52 +03:00
|
|
|
A int32 `json:"a,omitempty"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: -1}},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "HeadInt32NotRootString",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
2021-01-18 15:50:52 +03:00
|
|
|
A int32 `json:"a,string"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
2021-01-18 15:50:52 +03:00
|
|
|
}{A: struct {
|
|
|
|
A int32 `json:"a,string"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: -1}},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
2021-01-18 15:50:52 +03:00
|
|
|
|
|
|
|
// HeadInt32PtrNotRoot
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "HeadInt32PtrNotRoot",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
2021-01-18 15:50:52 +03:00
|
|
|
A struct {
|
|
|
|
A *int32 `json:"a"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
2021-01-18 15:50:52 +03:00
|
|
|
}{A: struct {
|
|
|
|
A *int32 `json:"a"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{int32ptr(-1)}},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "HeadInt32PtrNotRootOmitEmpty",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
2021-01-18 15:50:52 +03:00
|
|
|
A struct {
|
|
|
|
A *int32 `json:"a,omitempty"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
2021-01-18 15:50:52 +03:00
|
|
|
}{A: struct {
|
|
|
|
A *int32 `json:"a,omitempty"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{int32ptr(-1)}},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "HeadInt32PtrNotRootString",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
2021-01-18 15:50:52 +03:00
|
|
|
A struct {
|
|
|
|
A *int32 `json:"a,string"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
2021-01-18 15:50:52 +03:00
|
|
|
}{A: struct {
|
|
|
|
A *int32 `json:"a,string"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{int32ptr(-1)}},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
2021-01-18 15:50:52 +03:00
|
|
|
|
|
|
|
// HeadInt32PtrNilNotRoot
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "HeadInt32PtrNilNotRoot",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A *int32 `json:"a"`
|
|
|
|
}
|
|
|
|
}{},
|
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "HeadInt32PtrNilNotRootOmitEmpty",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A *int32 `json:"a,omitempty"`
|
|
|
|
}
|
|
|
|
}{},
|
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "HeadInt32PtrNilNotRootString",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A *int32 `json:"a,string"`
|
|
|
|
}
|
|
|
|
}{},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadInt32ZeroNotRoot
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32ZeroNotRoot",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
A *struct {
|
|
|
|
A int32 `json:"a"`
|
|
|
|
}
|
|
|
|
}{A: new(struct {
|
|
|
|
A int32 `json:"a"`
|
|
|
|
})},
|
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32ZeroNotRootOmitEmpty",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
A *struct {
|
|
|
|
A int32 `json:"a,omitempty"`
|
|
|
|
}
|
|
|
|
}{A: new(struct {
|
|
|
|
A int32 `json:"a,omitempty"`
|
|
|
|
})},
|
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32ZeroNotRootString",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
A *struct {
|
|
|
|
A int32 `json:"a,string"`
|
|
|
|
}
|
|
|
|
}{A: new(struct {
|
|
|
|
A int32 `json:"a,string"`
|
|
|
|
})},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadInt32NotRoot
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32NotRoot",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
A *struct {
|
|
|
|
A int32 `json:"a"`
|
|
|
|
}
|
|
|
|
}{A: &(struct {
|
|
|
|
A int32 `json:"a"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: -1})},
|
2021-01-18 15:50:52 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32NotRootOmitEmpty",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
A *struct {
|
|
|
|
A int32 `json:"a,omitempty"`
|
|
|
|
}
|
|
|
|
}{A: &(struct {
|
|
|
|
A int32 `json:"a,omitempty"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: -1})},
|
2021-01-18 15:50:52 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32NotRootString",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
A *struct {
|
|
|
|
A int32 `json:"a,string"`
|
|
|
|
}
|
|
|
|
}{A: &(struct {
|
|
|
|
A int32 `json:"a,string"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: -1})},
|
2021-01-18 15:50:52 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadInt32PtrNotRoot
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32PtrNotRoot",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
A *struct {
|
|
|
|
A *int32 `json:"a"`
|
|
|
|
}
|
|
|
|
}{A: &(struct {
|
|
|
|
A *int32 `json:"a"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: int32ptr(-1)})},
|
2021-01-18 15:50:52 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32PtrNotRootOmitEmpty",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
A *struct {
|
|
|
|
A *int32 `json:"a,omitempty"`
|
|
|
|
}
|
|
|
|
}{A: &(struct {
|
|
|
|
A *int32 `json:"a,omitempty"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: int32ptr(-1)})},
|
2021-01-18 15:50:52 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32PtrNotRootString",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
A *struct {
|
|
|
|
A *int32 `json:"a,string"`
|
|
|
|
}
|
|
|
|
}{A: &(struct {
|
|
|
|
A *int32 `json:"a,string"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: int32ptr(-1)})},
|
2021-01-18 15:50:52 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadInt32PtrNilNotRoot
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32PtrNilNotRoot",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
A *struct {
|
|
|
|
A *int32 `json:"a"`
|
|
|
|
}
|
|
|
|
}{A: &(struct {
|
|
|
|
A *int32 `json:"a"`
|
|
|
|
}{A: nil})},
|
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32PtrNilNotRootOmitEmpty",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
A *struct {
|
|
|
|
A *int32 `json:"a,omitempty"`
|
|
|
|
}
|
|
|
|
}{A: &(struct {
|
|
|
|
A *int32 `json:"a,omitempty"`
|
|
|
|
}{A: nil})},
|
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32PtrNilNotRootString",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
A *struct {
|
|
|
|
A *int32 `json:"a,string"`
|
|
|
|
}
|
|
|
|
}{A: &(struct {
|
|
|
|
A *int32 `json:"a,string"`
|
|
|
|
}{A: nil})},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadInt32NilNotRoot
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32NilNotRoot",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
A *struct {
|
|
|
|
A *int32 `json:"a"`
|
|
|
|
}
|
|
|
|
}{A: nil},
|
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32NilNotRootOmitEmpty",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
A *struct {
|
|
|
|
A *int32 `json:"a,omitempty"`
|
|
|
|
} `json:",omitempty"`
|
|
|
|
}{A: nil},
|
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32NilNotRootString",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
A *struct {
|
|
|
|
A *int32 `json:"a,string"`
|
|
|
|
} `json:",string"`
|
|
|
|
}{A: nil},
|
|
|
|
},
|
|
|
|
|
|
|
|
// HeadInt32ZeroMultiFieldsNotRoot
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "HeadInt32ZeroMultiFieldsNotRoot",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A int32 `json:"a"`
|
|
|
|
}
|
|
|
|
B struct {
|
|
|
|
B int32 `json:"b"`
|
|
|
|
}
|
|
|
|
}{},
|
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "HeadInt32ZeroMultiFieldsNotRootOmitEmpty",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A int32 `json:"a,omitempty"`
|
|
|
|
}
|
|
|
|
B struct {
|
|
|
|
B int32 `json:"b,omitempty"`
|
|
|
|
}
|
|
|
|
}{},
|
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "HeadInt32ZeroMultiFieldsNotRootString",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A int32 `json:"a,string"`
|
|
|
|
}
|
|
|
|
B struct {
|
|
|
|
B int32 `json:"b,string"`
|
|
|
|
}
|
|
|
|
}{},
|
|
|
|
},
|
|
|
|
|
|
|
|
// HeadInt32MultiFieldsNotRoot
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "HeadInt32MultiFieldsNotRoot",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A int32 `json:"a"`
|
|
|
|
}
|
|
|
|
B struct {
|
|
|
|
B int32 `json:"b"`
|
|
|
|
}
|
|
|
|
}{A: struct {
|
|
|
|
A int32 `json:"a"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: -1}, B: struct {
|
2021-01-18 15:50:52 +03:00
|
|
|
B int32 `json:"b"`
|
|
|
|
}{B: 2}},
|
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "HeadInt32MultiFieldsNotRootOmitEmpty",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A int32 `json:"a,omitempty"`
|
|
|
|
}
|
|
|
|
B struct {
|
|
|
|
B int32 `json:"b,omitempty"`
|
|
|
|
}
|
|
|
|
}{A: struct {
|
|
|
|
A int32 `json:"a,omitempty"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: -1}, B: struct {
|
2021-01-18 15:50:52 +03:00
|
|
|
B int32 `json:"b,omitempty"`
|
|
|
|
}{B: 2}},
|
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "HeadInt32MultiFieldsNotRootString",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A int32 `json:"a,string"`
|
|
|
|
}
|
|
|
|
B struct {
|
|
|
|
B int32 `json:"b,string"`
|
|
|
|
}
|
|
|
|
}{A: struct {
|
|
|
|
A int32 `json:"a,string"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: -1}, B: struct {
|
2021-01-18 15:50:52 +03:00
|
|
|
B int32 `json:"b,string"`
|
|
|
|
}{B: 2}},
|
|
|
|
},
|
|
|
|
|
|
|
|
// HeadInt32PtrMultiFieldsNotRoot
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "HeadInt32PtrMultiFieldsNotRoot",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A *int32 `json:"a"`
|
|
|
|
}
|
|
|
|
B struct {
|
|
|
|
B *int32 `json:"b"`
|
|
|
|
}
|
|
|
|
}{A: struct {
|
|
|
|
A *int32 `json:"a"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: int32ptr(-1)}, B: struct {
|
2021-01-18 15:50:52 +03:00
|
|
|
B *int32 `json:"b"`
|
|
|
|
}{B: int32ptr(2)}},
|
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "HeadInt32PtrMultiFieldsNotRootOmitEmpty",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A *int32 `json:"a,omitempty"`
|
|
|
|
}
|
|
|
|
B struct {
|
|
|
|
B *int32 `json:"b,omitempty"`
|
|
|
|
}
|
|
|
|
}{A: struct {
|
|
|
|
A *int32 `json:"a,omitempty"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: int32ptr(-1)}, B: struct {
|
2021-01-18 15:50:52 +03:00
|
|
|
B *int32 `json:"b,omitempty"`
|
|
|
|
}{B: int32ptr(2)}},
|
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "HeadInt32PtrMultiFieldsNotRootString",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A *int32 `json:"a,string"`
|
|
|
|
}
|
|
|
|
B struct {
|
|
|
|
B *int32 `json:"b,string"`
|
|
|
|
}
|
|
|
|
}{A: struct {
|
|
|
|
A *int32 `json:"a,string"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: int32ptr(-1)}, B: struct {
|
2021-01-18 15:50:52 +03:00
|
|
|
B *int32 `json:"b,string"`
|
|
|
|
}{B: int32ptr(2)}},
|
|
|
|
},
|
|
|
|
|
|
|
|
// HeadInt32PtrNilMultiFieldsNotRoot
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "HeadInt32PtrNilMultiFieldsNotRoot",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A *int32 `json:"a"`
|
|
|
|
}
|
|
|
|
B struct {
|
|
|
|
B *int32 `json:"b"`
|
|
|
|
}
|
|
|
|
}{A: struct {
|
|
|
|
A *int32 `json:"a"`
|
|
|
|
}{A: nil}, B: struct {
|
|
|
|
B *int32 `json:"b"`
|
|
|
|
}{B: nil}},
|
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "HeadInt32PtrNilMultiFieldsNotRootOmitEmpty",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A *int32 `json:"a,omitempty"`
|
|
|
|
}
|
|
|
|
B struct {
|
|
|
|
B *int32 `json:"b,omitempty"`
|
|
|
|
}
|
|
|
|
}{A: struct {
|
|
|
|
A *int32 `json:"a,omitempty"`
|
|
|
|
}{A: nil}, B: struct {
|
|
|
|
B *int32 `json:"b,omitempty"`
|
|
|
|
}{B: nil}},
|
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "HeadInt32PtrNilMultiFieldsNotRootString",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A *int32 `json:"a,string"`
|
|
|
|
}
|
|
|
|
B struct {
|
|
|
|
B *int32 `json:"b,string"`
|
|
|
|
}
|
|
|
|
}{A: struct {
|
|
|
|
A *int32 `json:"a,string"`
|
|
|
|
}{A: nil}, B: struct {
|
|
|
|
B *int32 `json:"b,string"`
|
|
|
|
}{B: nil}},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadInt32ZeroMultiFieldsNotRoot
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32ZeroMultiFieldsNotRoot",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: &struct {
|
|
|
|
A struct {
|
|
|
|
A int32 `json:"a"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
2021-01-18 15:50:52 +03:00
|
|
|
B struct {
|
|
|
|
B int32 `json:"b"`
|
|
|
|
}
|
|
|
|
}{},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32ZeroMultiFieldsNotRootOmitEmpty",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: &struct {
|
|
|
|
A struct {
|
|
|
|
A int32 `json:"a,omitempty"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
2021-01-18 15:50:52 +03:00
|
|
|
B struct {
|
|
|
|
B int32 `json:"b,omitempty"`
|
|
|
|
}
|
|
|
|
}{},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32ZeroMultiFieldsNotRootString",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: &struct {
|
2021-01-16 16:16:26 +03:00
|
|
|
A struct {
|
2021-01-18 15:50:52 +03:00
|
|
|
A int32 `json:"a,string"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
|
|
|
B struct {
|
2021-01-18 15:50:52 +03:00
|
|
|
B int32 `json:"b,string"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
|
|
|
}{},
|
|
|
|
},
|
2021-01-18 15:50:52 +03:00
|
|
|
|
|
|
|
// PtrHeadInt32MultiFieldsNotRoot
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32MultiFieldsNotRoot",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: &struct {
|
2021-01-16 16:16:26 +03:00
|
|
|
A struct {
|
|
|
|
A int32 `json:"a"`
|
|
|
|
}
|
|
|
|
B struct {
|
|
|
|
B int32 `json:"b"`
|
|
|
|
}
|
|
|
|
}{A: struct {
|
|
|
|
A int32 `json:"a"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: -1}, B: struct {
|
2021-01-16 16:16:26 +03:00
|
|
|
B int32 `json:"b"`
|
|
|
|
}{B: 2}},
|
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32MultiFieldsNotRootOmitEmpty",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: &struct {
|
2021-01-16 16:16:26 +03:00
|
|
|
A struct {
|
2021-01-18 15:50:52 +03:00
|
|
|
A int32 `json:"a,omitempty"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
|
|
|
B struct {
|
2021-01-18 15:50:52 +03:00
|
|
|
B int32 `json:"b,omitempty"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
|
|
|
}{A: struct {
|
2021-01-18 15:50:52 +03:00
|
|
|
A int32 `json:"a,omitempty"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: -1}, B: struct {
|
2021-01-18 15:50:52 +03:00
|
|
|
B int32 `json:"b,omitempty"`
|
|
|
|
}{B: 2}},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32MultiFieldsNotRootString",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: &struct {
|
2021-01-16 16:16:26 +03:00
|
|
|
A struct {
|
2021-01-18 15:50:52 +03:00
|
|
|
A int32 `json:"a,string"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
|
|
|
B struct {
|
2021-01-18 15:50:52 +03:00
|
|
|
B int32 `json:"b,string"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
|
|
|
}{A: struct {
|
2021-01-18 15:50:52 +03:00
|
|
|
A int32 `json:"a,string"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: -1}, B: struct {
|
2021-01-18 15:50:52 +03:00
|
|
|
B int32 `json:"b,string"`
|
|
|
|
}{B: 2}},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
2021-01-18 15:50:52 +03:00
|
|
|
|
|
|
|
// PtrHeadInt32PtrMultiFieldsNotRoot
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32PtrMultiFieldsNotRoot",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: &struct {
|
2021-01-18 15:50:52 +03:00
|
|
|
A *struct {
|
|
|
|
A *int32 `json:"a"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
2021-01-18 15:50:52 +03:00
|
|
|
B *struct {
|
|
|
|
B *int32 `json:"b"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
2021-01-18 15:50:52 +03:00
|
|
|
}{A: &(struct {
|
|
|
|
A *int32 `json:"a"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: int32ptr(-1)}), B: &(struct {
|
2021-01-18 15:50:52 +03:00
|
|
|
B *int32 `json:"b"`
|
|
|
|
}{B: int32ptr(2)})},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32PtrMultiFieldsNotRootOmitEmpty",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: &struct {
|
2021-01-18 15:50:52 +03:00
|
|
|
A *struct {
|
|
|
|
A *int32 `json:"a,omitempty"`
|
|
|
|
}
|
|
|
|
B *struct {
|
|
|
|
B *int32 `json:"b,omitempty"`
|
|
|
|
}
|
|
|
|
}{A: &(struct {
|
|
|
|
A *int32 `json:"a,omitempty"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: int32ptr(-1)}), B: &(struct {
|
2021-01-18 15:50:52 +03:00
|
|
|
B *int32 `json:"b,omitempty"`
|
|
|
|
}{B: int32ptr(2)})},
|
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32PtrMultiFieldsNotRootString",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: &struct {
|
|
|
|
A *struct {
|
|
|
|
A *int32 `json:"a,string"`
|
|
|
|
}
|
|
|
|
B *struct {
|
|
|
|
B *int32 `json:"b,string"`
|
|
|
|
}
|
|
|
|
}{A: &(struct {
|
|
|
|
A *int32 `json:"a,string"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: int32ptr(-1)}), B: &(struct {
|
2021-01-18 15:50:52 +03:00
|
|
|
B *int32 `json:"b,string"`
|
|
|
|
}{B: int32ptr(2)})},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadInt32PtrNilMultiFieldsNotRoot
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32PtrNilMultiFieldsNotRoot",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: &struct {
|
|
|
|
A *struct {
|
|
|
|
A *int32 `json:"a"`
|
|
|
|
}
|
|
|
|
B *struct {
|
|
|
|
B *int32 `json:"b"`
|
|
|
|
}
|
|
|
|
}{A: nil, B: nil},
|
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32PtrNilMultiFieldsNotRootOmitEmpty",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: &struct {
|
|
|
|
A *struct {
|
|
|
|
A *int32 `json:"a,omitempty"`
|
|
|
|
} `json:",omitempty"`
|
|
|
|
B *struct {
|
|
|
|
B *int32 `json:"b,omitempty"`
|
|
|
|
} `json:",omitempty"`
|
|
|
|
}{A: nil, B: nil},
|
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32PtrNilMultiFieldsNotRootString",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: &struct {
|
|
|
|
A *struct {
|
|
|
|
A *int32 `json:"a,string"`
|
|
|
|
} `json:",string"`
|
|
|
|
B *struct {
|
|
|
|
B *int32 `json:"b,string"`
|
|
|
|
} `json:",string"`
|
|
|
|
}{A: nil, B: nil},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadInt32NilMultiFieldsNotRoot
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32NilMultiFieldsNotRoot",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: (*struct {
|
|
|
|
A *struct {
|
|
|
|
A *int32 `json:"a"`
|
|
|
|
}
|
|
|
|
B *struct {
|
|
|
|
B *int32 `json:"b"`
|
|
|
|
}
|
|
|
|
})(nil),
|
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32NilMultiFieldsNotRootOmitEmpty",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: (*struct {
|
|
|
|
A *struct {
|
|
|
|
A *int32 `json:"a,omitempty"`
|
|
|
|
}
|
|
|
|
B *struct {
|
|
|
|
B *int32 `json:"b,omitempty"`
|
|
|
|
}
|
|
|
|
})(nil),
|
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32NilMultiFieldsNotRootString",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: (*struct {
|
|
|
|
A *struct {
|
|
|
|
A *int32 `json:"a,string"`
|
|
|
|
}
|
|
|
|
B *struct {
|
|
|
|
B *int32 `json:"b,string"`
|
|
|
|
}
|
|
|
|
})(nil),
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadInt32DoubleMultiFieldsNotRoot
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32DoubleMultiFieldsNotRoot",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: &struct {
|
|
|
|
A *struct {
|
2021-01-16 16:16:26 +03:00
|
|
|
A int32 `json:"a"`
|
2021-01-18 15:50:52 +03:00
|
|
|
B int32 `json:"b"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
2021-01-18 15:50:52 +03:00
|
|
|
B *struct {
|
|
|
|
A int32 `json:"a"`
|
2021-01-16 16:16:26 +03:00
|
|
|
B int32 `json:"b"`
|
|
|
|
}
|
2021-01-18 15:50:52 +03:00
|
|
|
}{A: &(struct {
|
2021-01-16 16:16:26 +03:00
|
|
|
A int32 `json:"a"`
|
|
|
|
B int32 `json:"b"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: -1, B: 2}), B: &(struct {
|
2021-01-18 15:50:52 +03:00
|
|
|
A int32 `json:"a"`
|
|
|
|
B int32 `json:"b"`
|
|
|
|
}{A: 3, B: 4})},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32DoubleMultiFieldsNotRootOmitEmpty",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: &struct {
|
|
|
|
A *struct {
|
|
|
|
A int32 `json:"a,omitempty"`
|
|
|
|
B int32 `json:"b,omitempty"`
|
|
|
|
}
|
|
|
|
B *struct {
|
|
|
|
A int32 `json:"a,omitempty"`
|
|
|
|
B int32 `json:"b,omitempty"`
|
|
|
|
}
|
|
|
|
}{A: &(struct {
|
|
|
|
A int32 `json:"a,omitempty"`
|
|
|
|
B int32 `json:"b,omitempty"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: -1, B: 2}), B: &(struct {
|
2021-01-18 15:50:52 +03:00
|
|
|
A int32 `json:"a,omitempty"`
|
|
|
|
B int32 `json:"b,omitempty"`
|
|
|
|
}{A: 3, B: 4})},
|
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32DoubleMultiFieldsNotRootString",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: &struct {
|
|
|
|
A *struct {
|
2021-01-18 15:50:52 +03:00
|
|
|
A int32 `json:"a,string"`
|
|
|
|
B int32 `json:"b,string"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
|
|
|
B *struct {
|
2021-01-18 15:50:52 +03:00
|
|
|
A int32 `json:"a,string"`
|
|
|
|
B int32 `json:"b,string"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
|
|
|
}{A: &(struct {
|
2021-01-18 15:50:52 +03:00
|
|
|
A int32 `json:"a,string"`
|
|
|
|
B int32 `json:"b,string"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: -1, B: 2}), B: &(struct {
|
2021-01-18 15:50:52 +03:00
|
|
|
A int32 `json:"a,string"`
|
|
|
|
B int32 `json:"b,string"`
|
|
|
|
}{A: 3, B: 4})},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
2021-01-18 15:50:52 +03:00
|
|
|
|
|
|
|
// PtrHeadInt32NilDoubleMultiFieldsNotRoot
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32NilDoubleMultiFieldsNotRoot",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: &struct {
|
|
|
|
A *struct {
|
2021-01-18 15:50:52 +03:00
|
|
|
A int32 `json:"a"`
|
|
|
|
B int32 `json:"b"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
|
|
|
B *struct {
|
2021-01-18 15:50:52 +03:00
|
|
|
A int32 `json:"a"`
|
|
|
|
B int32 `json:"b"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
|
|
|
}{A: nil, B: nil},
|
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32NilDoubleMultiFieldsNotRootOmitEmpty",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: &struct {
|
2021-01-16 16:16:26 +03:00
|
|
|
A *struct {
|
2021-01-18 15:50:52 +03:00
|
|
|
A int32 `json:"a,omitempty"`
|
|
|
|
B int32 `json:"b,omitempty"`
|
|
|
|
} `json:",omitempty"`
|
2021-01-16 16:16:26 +03:00
|
|
|
B *struct {
|
2021-01-18 15:50:52 +03:00
|
|
|
A int32 `json:"a,omitempty"`
|
|
|
|
B int32 `json:"b,omitempty"`
|
|
|
|
} `json:",omitempty"`
|
|
|
|
}{A: nil, B: nil},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32NilDoubleMultiFieldsNotRootString",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: &struct {
|
|
|
|
A *struct {
|
2021-01-18 15:50:52 +03:00
|
|
|
A int32 `json:"a,string"`
|
|
|
|
B int32 `json:"b,string"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
|
|
|
B *struct {
|
2021-01-18 15:50:52 +03:00
|
|
|
A int32 `json:"a,string"`
|
|
|
|
B int32 `json:"b,string"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
2021-01-18 15:50:52 +03:00
|
|
|
}{A: nil, B: nil},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
2021-01-18 15:50:52 +03:00
|
|
|
|
|
|
|
// PtrHeadInt32NilDoubleMultiFieldsNotRoot
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32NilDoubleMultiFieldsNotRoot",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: (*struct {
|
2021-01-16 16:16:26 +03:00
|
|
|
A *struct {
|
|
|
|
A int32 `json:"a"`
|
|
|
|
B int32 `json:"b"`
|
|
|
|
}
|
|
|
|
B *struct {
|
|
|
|
A int32 `json:"a"`
|
|
|
|
B int32 `json:"b"`
|
|
|
|
}
|
2021-01-18 15:50:52 +03:00
|
|
|
})(nil),
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32NilDoubleMultiFieldsNotRootOmitEmpty",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: (*struct {
|
|
|
|
A *struct {
|
2021-01-18 15:50:52 +03:00
|
|
|
A int32 `json:"a,omitempty"`
|
|
|
|
B int32 `json:"b,omitempty"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
|
|
|
B *struct {
|
2021-01-18 15:50:52 +03:00
|
|
|
A int32 `json:"a,omitempty"`
|
|
|
|
B int32 `json:"b,omitempty"`
|
|
|
|
}
|
|
|
|
})(nil),
|
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32NilDoubleMultiFieldsNotRootString",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: (*struct {
|
|
|
|
A *struct {
|
|
|
|
A int32 `json:"a,string"`
|
|
|
|
B int32 `json:"b,string"`
|
|
|
|
}
|
|
|
|
B *struct {
|
|
|
|
A int32 `json:"a,string"`
|
|
|
|
B int32 `json:"b,string"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
|
|
|
})(nil),
|
|
|
|
},
|
2021-01-18 15:50:52 +03:00
|
|
|
|
|
|
|
// PtrHeadInt32PtrDoubleMultiFieldsNotRoot
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32PtrDoubleMultiFieldsNotRoot",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: &struct {
|
|
|
|
A *struct {
|
|
|
|
A *int32 `json:"a"`
|
|
|
|
B *int32 `json:"b"`
|
|
|
|
}
|
|
|
|
B *struct {
|
|
|
|
A *int32 `json:"a"`
|
|
|
|
B *int32 `json:"b"`
|
|
|
|
}
|
|
|
|
}{A: &(struct {
|
|
|
|
A *int32 `json:"a"`
|
|
|
|
B *int32 `json:"b"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: int32ptr(-1), B: int32ptr(2)}), B: &(struct {
|
2021-01-16 16:16:26 +03:00
|
|
|
A *int32 `json:"a"`
|
|
|
|
B *int32 `json:"b"`
|
|
|
|
}{A: int32ptr(3), B: int32ptr(4)})},
|
|
|
|
},
|
2021-01-18 15:50:52 +03:00
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32PtrDoubleMultiFieldsNotRootOmitEmpty",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: &struct {
|
|
|
|
A *struct {
|
|
|
|
A *int32 `json:"a,omitempty"`
|
|
|
|
B *int32 `json:"b,omitempty"`
|
|
|
|
}
|
|
|
|
B *struct {
|
|
|
|
A *int32 `json:"a,omitempty"`
|
|
|
|
B *int32 `json:"b,omitempty"`
|
|
|
|
}
|
|
|
|
}{A: &(struct {
|
|
|
|
A *int32 `json:"a,omitempty"`
|
|
|
|
B *int32 `json:"b,omitempty"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: int32ptr(-1), B: int32ptr(2)}), B: &(struct {
|
2021-01-18 15:50:52 +03:00
|
|
|
A *int32 `json:"a,omitempty"`
|
|
|
|
B *int32 `json:"b,omitempty"`
|
|
|
|
}{A: int32ptr(3), B: int32ptr(4)})},
|
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32PtrDoubleMultiFieldsNotRootString",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: &struct {
|
|
|
|
A *struct {
|
|
|
|
A *int32 `json:"a,string"`
|
|
|
|
B *int32 `json:"b,string"`
|
|
|
|
}
|
|
|
|
B *struct {
|
|
|
|
A *int32 `json:"a,string"`
|
|
|
|
B *int32 `json:"b,string"`
|
|
|
|
}
|
|
|
|
}{A: &(struct {
|
|
|
|
A *int32 `json:"a,string"`
|
|
|
|
B *int32 `json:"b,string"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: int32ptr(-1), B: int32ptr(2)}), B: &(struct {
|
2021-01-18 15:50:52 +03:00
|
|
|
A *int32 `json:"a,string"`
|
|
|
|
B *int32 `json:"b,string"`
|
|
|
|
}{A: int32ptr(3), B: int32ptr(4)})},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadInt32PtrNilDoubleMultiFieldsNotRoot
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32PtrNilDoubleMultiFieldsNotRoot",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: &struct {
|
|
|
|
A *struct {
|
|
|
|
A *int32 `json:"a"`
|
|
|
|
B *int32 `json:"b"`
|
|
|
|
}
|
|
|
|
B *struct {
|
|
|
|
A *int32 `json:"a"`
|
|
|
|
B *int32 `json:"b"`
|
|
|
|
}
|
|
|
|
}{A: nil, B: nil},
|
|
|
|
},
|
2021-01-18 15:50:52 +03:00
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32PtrNilDoubleMultiFieldsNotRootOmitEmpty",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: &struct {
|
|
|
|
A *struct {
|
|
|
|
A *int32 `json:"a,omitempty"`
|
|
|
|
B *int32 `json:"b,omitempty"`
|
|
|
|
} `json:",omitempty"`
|
|
|
|
B *struct {
|
|
|
|
A *int32 `json:"a,omitempty"`
|
|
|
|
B *int32 `json:"b,omitempty"`
|
|
|
|
} `json:",omitempty"`
|
|
|
|
}{A: nil, B: nil},
|
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32PtrNilDoubleMultiFieldsNotRootString",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: &struct {
|
|
|
|
A *struct {
|
|
|
|
A *int32 `json:"a,string"`
|
|
|
|
B *int32 `json:"b,string"`
|
|
|
|
}
|
|
|
|
B *struct {
|
|
|
|
A *int32 `json:"a,string"`
|
|
|
|
B *int32 `json:"b,string"`
|
|
|
|
}
|
|
|
|
}{A: nil, B: nil},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadInt32PtrNilDoubleMultiFieldsNotRoot
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32PtrNilDoubleMultiFieldsNotRoot",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: (*struct {
|
|
|
|
A *struct {
|
|
|
|
A *int32 `json:"a"`
|
|
|
|
B *int32 `json:"b"`
|
|
|
|
}
|
|
|
|
B *struct {
|
|
|
|
A *int32 `json:"a"`
|
|
|
|
B *int32 `json:"b"`
|
|
|
|
}
|
|
|
|
})(nil),
|
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32PtrNilDoubleMultiFieldsNotRootOmitEmpty",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: (*struct {
|
|
|
|
A *struct {
|
|
|
|
A *int32 `json:"a,omitempty"`
|
|
|
|
B *int32 `json:"b,omitempty"`
|
|
|
|
}
|
|
|
|
B *struct {
|
|
|
|
A *int32 `json:"a,omitempty"`
|
|
|
|
B *int32 `json:"b,omitempty"`
|
|
|
|
}
|
|
|
|
})(nil),
|
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrHeadInt32PtrNilDoubleMultiFieldsNotRootString",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: (*struct {
|
|
|
|
A *struct {
|
|
|
|
A *int32 `json:"a,string"`
|
|
|
|
B *int32 `json:"b,string"`
|
|
|
|
}
|
|
|
|
B *struct {
|
|
|
|
A *int32 `json:"a,string"`
|
|
|
|
B *int32 `json:"b,string"`
|
|
|
|
}
|
|
|
|
})(nil),
|
|
|
|
},
|
|
|
|
|
|
|
|
// AnonymousHeadInt32
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "AnonymousHeadInt32",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
structInt32
|
|
|
|
B int32 `json:"b"`
|
|
|
|
}{
|
2021-02-19 09:08:30 +03:00
|
|
|
structInt32: structInt32{A: -1},
|
2021-01-18 15:50:52 +03:00
|
|
|
B: 2,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "AnonymousHeadInt32OmitEmpty",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
structInt32OmitEmpty
|
|
|
|
B int32 `json:"b,omitempty"`
|
|
|
|
}{
|
2021-02-19 09:08:30 +03:00
|
|
|
structInt32OmitEmpty: structInt32OmitEmpty{A: -1},
|
2021-01-18 15:50:52 +03:00
|
|
|
B: 2,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "AnonymousHeadInt32String",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
structInt32String
|
|
|
|
B int32 `json:"b,string"`
|
|
|
|
}{
|
2021-02-19 09:08:30 +03:00
|
|
|
structInt32String: structInt32String{A: -1},
|
2021-01-18 15:50:52 +03:00
|
|
|
B: 2,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrAnonymousHeadInt32
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrAnonymousHeadInt32",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
*structInt32
|
|
|
|
B int32 `json:"b"`
|
|
|
|
}{
|
2021-02-19 09:08:30 +03:00
|
|
|
structInt32: &structInt32{A: -1},
|
2021-01-18 15:50:52 +03:00
|
|
|
B: 2,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrAnonymousHeadInt32OmitEmpty",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
*structInt32OmitEmpty
|
|
|
|
B int32 `json:"b,omitempty"`
|
|
|
|
}{
|
2021-02-19 09:08:30 +03:00
|
|
|
structInt32OmitEmpty: &structInt32OmitEmpty{A: -1},
|
2021-01-18 15:50:52 +03:00
|
|
|
B: 2,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrAnonymousHeadInt32String",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
*structInt32String
|
|
|
|
B int32 `json:"b,string"`
|
|
|
|
}{
|
2021-02-19 09:08:30 +03:00
|
|
|
structInt32String: &structInt32String{A: -1},
|
2021-01-18 15:50:52 +03:00
|
|
|
B: 2,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// NilPtrAnonymousHeadInt32
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "NilPtrAnonymousHeadInt32",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
2021-01-18 15:50:52 +03:00
|
|
|
*structInt32
|
2021-01-16 16:16:26 +03:00
|
|
|
B int32 `json:"b"`
|
|
|
|
}{
|
2021-01-18 15:50:52 +03:00
|
|
|
structInt32: nil,
|
2021-01-16 16:16:26 +03:00
|
|
|
B: 2,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "NilPtrAnonymousHeadInt32OmitEmpty",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
2021-01-18 15:50:52 +03:00
|
|
|
*structInt32OmitEmpty
|
|
|
|
B int32 `json:"b,omitempty"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}{
|
2021-01-18 15:50:52 +03:00
|
|
|
structInt32OmitEmpty: nil,
|
|
|
|
B: 2,
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "NilPtrAnonymousHeadInt32String",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
2021-01-18 15:50:52 +03:00
|
|
|
*structInt32String
|
|
|
|
B int32 `json:"b,string"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}{
|
2021-01-18 15:50:52 +03:00
|
|
|
structInt32String: nil,
|
|
|
|
B: 2,
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
},
|
2021-01-18 15:50:52 +03:00
|
|
|
|
|
|
|
// AnonymousHeadInt32Ptr
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "AnonymousHeadInt32Ptr",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
structInt32Ptr
|
|
|
|
B *int32 `json:"b"`
|
|
|
|
}{
|
2021-02-19 09:08:30 +03:00
|
|
|
structInt32Ptr: structInt32Ptr{A: int32ptr(-1)},
|
2021-01-16 16:16:26 +03:00
|
|
|
B: int32ptr(2),
|
|
|
|
},
|
|
|
|
},
|
2021-01-18 15:50:52 +03:00
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "AnonymousHeadInt32PtrOmitEmpty",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
structInt32PtrOmitEmpty
|
|
|
|
B *int32 `json:"b,omitempty"`
|
|
|
|
}{
|
2021-02-19 09:08:30 +03:00
|
|
|
structInt32PtrOmitEmpty: structInt32PtrOmitEmpty{A: int32ptr(-1)},
|
2021-01-18 15:50:52 +03:00
|
|
|
B: int32ptr(2),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "AnonymousHeadInt32PtrString",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
structInt32PtrString
|
|
|
|
B *int32 `json:"b,string"`
|
|
|
|
}{
|
2021-02-19 09:08:30 +03:00
|
|
|
structInt32PtrString: structInt32PtrString{A: int32ptr(-1)},
|
2021-01-18 15:50:52 +03:00
|
|
|
B: int32ptr(2),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// AnonymousHeadInt32PtrNil
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "AnonymousHeadInt32PtrNil",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
structInt32Ptr
|
|
|
|
B *int32 `json:"b"`
|
|
|
|
}{
|
|
|
|
structInt32Ptr: structInt32Ptr{A: nil},
|
|
|
|
B: int32ptr(2),
|
|
|
|
},
|
|
|
|
},
|
2021-01-18 15:50:52 +03:00
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "AnonymousHeadInt32PtrNilOmitEmpty",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
structInt32PtrOmitEmpty
|
|
|
|
B *int32 `json:"b,omitempty"`
|
|
|
|
}{
|
|
|
|
structInt32PtrOmitEmpty: structInt32PtrOmitEmpty{A: nil},
|
|
|
|
B: int32ptr(2),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "AnonymousHeadInt32PtrNilString",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
structInt32PtrString
|
|
|
|
B *int32 `json:"b,string"`
|
|
|
|
}{
|
|
|
|
structInt32PtrString: structInt32PtrString{A: nil},
|
|
|
|
B: int32ptr(2),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrAnonymousHeadInt32Ptr
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrAnonymousHeadInt32Ptr",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
*structInt32Ptr
|
|
|
|
B *int32 `json:"b"`
|
|
|
|
}{
|
2021-02-19 09:08:30 +03:00
|
|
|
structInt32Ptr: &structInt32Ptr{A: int32ptr(-1)},
|
2021-01-16 16:16:26 +03:00
|
|
|
B: int32ptr(2),
|
|
|
|
},
|
|
|
|
},
|
2021-01-18 15:50:52 +03:00
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrAnonymousHeadInt32PtrOmitEmpty",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
*structInt32PtrOmitEmpty
|
|
|
|
B *int32 `json:"b,omitempty"`
|
|
|
|
}{
|
2021-02-19 09:08:30 +03:00
|
|
|
structInt32PtrOmitEmpty: &structInt32PtrOmitEmpty{A: int32ptr(-1)},
|
2021-01-18 15:50:52 +03:00
|
|
|
B: int32ptr(2),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrAnonymousHeadInt32PtrString",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
*structInt32PtrString
|
|
|
|
B *int32 `json:"b,string"`
|
|
|
|
}{
|
2021-02-19 09:08:30 +03:00
|
|
|
structInt32PtrString: &structInt32PtrString{A: int32ptr(-1)},
|
2021-01-18 15:50:52 +03:00
|
|
|
B: int32ptr(2),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// NilPtrAnonymousHeadInt32Ptr
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "NilPtrAnonymousHeadInt32Ptr",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
*structInt32Ptr
|
|
|
|
B *int32 `json:"b"`
|
|
|
|
}{
|
|
|
|
structInt32Ptr: nil,
|
|
|
|
B: int32ptr(2),
|
|
|
|
},
|
|
|
|
},
|
2021-01-18 15:50:52 +03:00
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "NilPtrAnonymousHeadInt32PtrOmitEmpty",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
*structInt32PtrOmitEmpty
|
|
|
|
B *int32 `json:"b,omitempty"`
|
|
|
|
}{
|
|
|
|
structInt32PtrOmitEmpty: nil,
|
|
|
|
B: int32ptr(2),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "NilPtrAnonymousHeadInt32PtrString",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
*structInt32PtrString
|
|
|
|
B *int32 `json:"b,string"`
|
|
|
|
}{
|
|
|
|
structInt32PtrString: nil,
|
|
|
|
B: int32ptr(2),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// AnonymousHeadInt32Only
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "AnonymousHeadInt32Only",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
structInt32
|
|
|
|
}{
|
2021-02-19 09:08:30 +03:00
|
|
|
structInt32: structInt32{A: -1},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
},
|
2021-01-18 15:50:52 +03:00
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "AnonymousHeadInt32OnlyOmitEmpty",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
structInt32OmitEmpty
|
|
|
|
}{
|
2021-02-19 09:08:30 +03:00
|
|
|
structInt32OmitEmpty: structInt32OmitEmpty{A: -1},
|
2021-01-18 15:50:52 +03:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "AnonymousHeadInt32OnlyString",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
structInt32String
|
|
|
|
}{
|
2021-02-19 09:08:30 +03:00
|
|
|
structInt32String: structInt32String{A: -1},
|
2021-01-18 15:50:52 +03:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrAnonymousHeadInt32Only
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrAnonymousHeadInt32Only",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
*structInt32
|
|
|
|
}{
|
2021-02-19 09:08:30 +03:00
|
|
|
structInt32: &structInt32{A: -1},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
},
|
2021-01-18 15:50:52 +03:00
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrAnonymousHeadInt32OnlyOmitEmpty",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
*structInt32OmitEmpty
|
|
|
|
}{
|
2021-02-19 09:08:30 +03:00
|
|
|
structInt32OmitEmpty: &structInt32OmitEmpty{A: -1},
|
2021-01-18 15:50:52 +03:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrAnonymousHeadInt32OnlyString",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
*structInt32String
|
|
|
|
}{
|
2021-02-19 09:08:30 +03:00
|
|
|
structInt32String: &structInt32String{A: -1},
|
2021-01-18 15:50:52 +03:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// NilPtrAnonymousHeadInt32Only
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "NilPtrAnonymousHeadInt32Only",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
*structInt32
|
|
|
|
}{
|
|
|
|
structInt32: nil,
|
|
|
|
},
|
|
|
|
},
|
2021-01-18 15:50:52 +03:00
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "NilPtrAnonymousHeadInt32OnlyOmitEmpty",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
*structInt32OmitEmpty
|
|
|
|
}{
|
|
|
|
structInt32OmitEmpty: nil,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "NilPtrAnonymousHeadInt32OnlyString",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
*structInt32String
|
|
|
|
}{
|
|
|
|
structInt32String: nil,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// AnonymousHeadInt32PtrOnly
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "AnonymousHeadInt32PtrOnly",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
structInt32Ptr
|
|
|
|
}{
|
2021-02-19 09:08:30 +03:00
|
|
|
structInt32Ptr: structInt32Ptr{A: int32ptr(-1)},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
},
|
2021-01-18 15:50:52 +03:00
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "AnonymousHeadInt32PtrOnlyOmitEmpty",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
structInt32PtrOmitEmpty
|
|
|
|
}{
|
2021-02-19 09:08:30 +03:00
|
|
|
structInt32PtrOmitEmpty: structInt32PtrOmitEmpty{A: int32ptr(-1)},
|
2021-01-18 15:50:52 +03:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "AnonymousHeadInt32PtrOnlyString",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
structInt32PtrString
|
|
|
|
}{
|
2021-02-19 09:08:30 +03:00
|
|
|
structInt32PtrString: structInt32PtrString{A: int32ptr(-1)},
|
2021-01-18 15:50:52 +03:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// AnonymousHeadInt32PtrNilOnly
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "AnonymousHeadInt32PtrNilOnly",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
structInt32Ptr
|
|
|
|
}{
|
|
|
|
structInt32Ptr: structInt32Ptr{A: nil},
|
|
|
|
},
|
|
|
|
},
|
2021-01-18 15:50:52 +03:00
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "AnonymousHeadInt32PtrNilOnlyOmitEmpty",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
structInt32PtrOmitEmpty
|
|
|
|
}{
|
|
|
|
structInt32PtrOmitEmpty: structInt32PtrOmitEmpty{A: nil},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "AnonymousHeadInt32PtrNilOnlyString",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
structInt32PtrString
|
|
|
|
}{
|
|
|
|
structInt32PtrString: structInt32PtrString{A: nil},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrAnonymousHeadInt32PtrOnly
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrAnonymousHeadInt32PtrOnly",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
*structInt32Ptr
|
|
|
|
}{
|
2021-02-19 09:08:30 +03:00
|
|
|
structInt32Ptr: &structInt32Ptr{A: int32ptr(-1)},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
},
|
2021-01-18 15:50:52 +03:00
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrAnonymousHeadInt32PtrOnlyOmitEmpty",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
*structInt32PtrOmitEmpty
|
|
|
|
}{
|
2021-02-19 09:08:30 +03:00
|
|
|
structInt32PtrOmitEmpty: &structInt32PtrOmitEmpty{A: int32ptr(-1)},
|
2021-01-18 15:50:52 +03:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "PtrAnonymousHeadInt32PtrOnlyString",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
*structInt32PtrString
|
|
|
|
}{
|
2021-02-19 09:08:30 +03:00
|
|
|
structInt32PtrString: &structInt32PtrString{A: int32ptr(-1)},
|
2021-01-18 15:50:52 +03:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// NilPtrAnonymousHeadInt32PtrOnly
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "NilPtrAnonymousHeadInt32PtrOnly",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
*structInt32Ptr
|
|
|
|
}{
|
|
|
|
structInt32Ptr: nil,
|
|
|
|
},
|
|
|
|
},
|
2021-01-18 15:50:52 +03:00
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "NilPtrAnonymousHeadInt32PtrOnlyOmitEmpty",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
*structInt32PtrOmitEmpty
|
|
|
|
}{
|
|
|
|
structInt32PtrOmitEmpty: nil,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-02-14 20:53:12 +03:00
|
|
|
name: "NilPtrAnonymousHeadInt32PtrOnlyString",
|
2021-01-18 15:50:52 +03:00
|
|
|
data: struct {
|
|
|
|
*structInt32PtrString
|
|
|
|
}{
|
|
|
|
structInt32PtrString: nil,
|
|
|
|
},
|
|
|
|
},
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
|
|
|
for _, test := range tests {
|
|
|
|
for _, indent := range []bool{true, false} {
|
|
|
|
for _, htmlEscape := range []bool{true, false} {
|
|
|
|
var buf bytes.Buffer
|
|
|
|
enc := json.NewEncoder(&buf)
|
|
|
|
enc.SetEscapeHTML(htmlEscape)
|
|
|
|
if indent {
|
|
|
|
enc.SetIndent("", " ")
|
|
|
|
}
|
|
|
|
if err := enc.Encode(test.data); err != nil {
|
2021-02-14 20:53:12 +03:00
|
|
|
t.Fatalf("%s(htmlEscape:%T): %+v: %s", test.name, htmlEscape, test.data, err)
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
2021-01-19 08:01:43 +03:00
|
|
|
stdresult := encodeByEncodingJSON(test.data, indent, htmlEscape)
|
|
|
|
if buf.String() != stdresult {
|
|
|
|
t.Errorf("%s(htmlEscape:%T): doesn't compatible with encoding/json. expected %q but got %q", test.name, htmlEscape, stdresult, buf.String())
|
|
|
|
}
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|