2021-01-16 16:16:26 +03:00
|
|
|
package json_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"bytes"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/goccy/go-json"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestCoverInt64(t *testing.T) {
|
|
|
|
type structInt64 struct {
|
|
|
|
A int64 `json:"a"`
|
|
|
|
}
|
2021-01-18 16:35:10 +03:00
|
|
|
type structInt64OmitEmpty struct {
|
|
|
|
A int64 `json:"a,omitempty"`
|
|
|
|
}
|
|
|
|
type structInt64String struct {
|
|
|
|
A int64 `json:"a,string"`
|
|
|
|
}
|
|
|
|
|
2021-01-16 16:16:26 +03:00
|
|
|
type structInt64Ptr struct {
|
|
|
|
A *int64 `json:"a"`
|
|
|
|
}
|
2021-01-18 16:35:10 +03:00
|
|
|
type structInt64PtrOmitEmpty struct {
|
|
|
|
A *int64 `json:"a,omitempty"`
|
|
|
|
}
|
|
|
|
type structInt64PtrString struct {
|
|
|
|
A *int64 `json:"a,string"`
|
|
|
|
}
|
2021-01-16 16:16:26 +03:00
|
|
|
|
|
|
|
tests := []struct {
|
2021-02-15 05:20:23 +03:00
|
|
|
name string
|
|
|
|
data interface{}
|
2021-01-16 16:16:26 +03:00
|
|
|
}{
|
2021-01-18 16:35:10 +03:00
|
|
|
// HeadInt64Zero
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "HeadInt64Zero",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
A int64 `json:"a"`
|
|
|
|
}{},
|
|
|
|
},
|
2021-01-18 16:35:10 +03:00
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "HeadInt64ZeroOmitEmpty",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
A int64 `json:"a,omitempty"`
|
|
|
|
}{},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "HeadInt64ZeroString",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
A int64 `json:"a,string"`
|
|
|
|
}{},
|
|
|
|
},
|
|
|
|
|
|
|
|
// HeadInt64
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "HeadInt64",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
A int64 `json:"a"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: -1},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
2021-01-18 16:35:10 +03:00
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "HeadInt64OmitEmpty",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
A int64 `json:"a,omitempty"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: -1},
|
2021-01-18 16:35:10 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "HeadInt64String",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
A int64 `json:"a,string"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: -1},
|
2021-01-18 16:35:10 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
// HeadInt64Ptr
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "HeadInt64Ptr",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
A *int64 `json:"a"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: int64ptr(-1)},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
2021-01-18 16:35:10 +03:00
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "HeadInt64PtrOmitEmpty",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
A *int64 `json:"a,omitempty"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: int64ptr(-1)},
|
2021-01-18 16:35:10 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "HeadInt64PtrString",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
A *int64 `json:"a,string"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: int64ptr(-1)},
|
2021-01-18 16:35:10 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
// HeadInt64PtrNil
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "HeadInt64PtrNil",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
A *int64 `json:"a"`
|
|
|
|
}{A: nil},
|
|
|
|
},
|
2021-01-18 16:35:10 +03:00
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "HeadInt64PtrNilOmitEmpty",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
A *int64 `json:"a,omitempty"`
|
|
|
|
}{A: nil},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "HeadInt64PtrNilString",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
A *int64 `json:"a,string"`
|
|
|
|
}{A: nil},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadInt64Zero
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64Zero",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: &struct {
|
|
|
|
A int64 `json:"a"`
|
|
|
|
}{},
|
|
|
|
},
|
2021-01-18 16:35:10 +03:00
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64ZeroOmitEmpty",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: &struct {
|
|
|
|
A int64 `json:"a,omitempty"`
|
|
|
|
}{},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64ZeroString",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: &struct {
|
|
|
|
A int64 `json:"a,string"`
|
|
|
|
}{},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadInt64
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: &struct {
|
|
|
|
A int64 `json:"a"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: -1},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
2021-01-18 16:35:10 +03:00
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64OmitEmpty",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: &struct {
|
|
|
|
A int64 `json:"a,omitempty"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: -1},
|
2021-01-18 16:35:10 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64String",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: &struct {
|
|
|
|
A int64 `json:"a,string"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: -1},
|
2021-01-18 16:35:10 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadInt64Ptr
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64Ptr",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: &struct {
|
|
|
|
A *int64 `json:"a"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: int64ptr(-1)},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
2021-01-18 16:35:10 +03:00
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64PtrOmitEmpty",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: &struct {
|
|
|
|
A *int64 `json:"a,omitempty"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: int64ptr(-1)},
|
2021-01-18 16:35:10 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64PtrString",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: &struct {
|
|
|
|
A *int64 `json:"a,string"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: int64ptr(-1)},
|
2021-01-18 16:35:10 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadInt64PtrNil
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64PtrNil",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: &struct {
|
|
|
|
A *int64 `json:"a"`
|
|
|
|
}{A: nil},
|
|
|
|
},
|
2021-01-18 16:35:10 +03:00
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64PtrNilOmitEmpty",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: &struct {
|
|
|
|
A *int64 `json:"a,omitempty"`
|
|
|
|
}{A: nil},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64PtrNilString",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: &struct {
|
|
|
|
A *int64 `json:"a,string"`
|
|
|
|
}{A: nil},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadInt64Nil
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64Nil",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: (*struct {
|
|
|
|
A *int64 `json:"a"`
|
|
|
|
})(nil),
|
|
|
|
},
|
2021-01-18 16:35:10 +03:00
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64NilOmitEmpty",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: (*struct {
|
|
|
|
A *int64 `json:"a,omitempty"`
|
|
|
|
})(nil),
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64NilString",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: (*struct {
|
|
|
|
A *int64 `json:"a,string"`
|
|
|
|
})(nil),
|
|
|
|
},
|
|
|
|
|
|
|
|
// HeadInt64ZeroMultiFields
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "HeadInt64ZeroMultiFields",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
A int64 `json:"a"`
|
|
|
|
B int64 `json:"b"`
|
2021-02-15 05:20:23 +03:00
|
|
|
C int64 `json:"c"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}{},
|
|
|
|
},
|
2021-01-18 16:35:10 +03:00
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "HeadInt64ZeroMultiFieldsOmitEmpty",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
A int64 `json:"a,omitempty"`
|
|
|
|
B int64 `json:"b,omitempty"`
|
2021-02-15 05:20:23 +03:00
|
|
|
C int64 `json:"c,omitempty"`
|
2021-01-18 16:35:10 +03:00
|
|
|
}{},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "HeadInt64ZeroMultiFields",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
A int64 `json:"a,string"`
|
|
|
|
B int64 `json:"b,string"`
|
2021-02-15 05:20:23 +03:00
|
|
|
C int64 `json:"c,string"`
|
2021-01-18 16:35:10 +03:00
|
|
|
}{},
|
|
|
|
},
|
|
|
|
|
|
|
|
// HeadInt64MultiFields
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "HeadInt64MultiFields",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
A int64 `json:"a"`
|
|
|
|
B int64 `json:"b"`
|
2021-02-15 05:20:23 +03:00
|
|
|
C int64 `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-15 05:20:23 +03:00
|
|
|
name: "HeadInt64MultiFieldsOmitEmpty",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
2021-01-18 16:35:10 +03:00
|
|
|
A int64 `json:"a,omitempty"`
|
|
|
|
B int64 `json:"b,omitempty"`
|
2021-02-15 05:20:23 +03:00
|
|
|
C int64 `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-15 05:20:23 +03:00
|
|
|
name: "HeadInt64MultiFieldsString",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
2021-01-18 16:35:10 +03:00
|
|
|
A int64 `json:"a,string"`
|
|
|
|
B int64 `json:"b,string"`
|
2021-02-15 05:20:23 +03:00
|
|
|
C int64 `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 16:35:10 +03:00
|
|
|
|
|
|
|
// HeadInt64PtrMultiFields
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "HeadInt64PtrMultiFields",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
A *int64 `json:"a"`
|
|
|
|
B *int64 `json:"b"`
|
2021-02-15 05:20:23 +03:00
|
|
|
C *int64 `json:"c"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: int64ptr(-1), B: int64ptr(2), C: int64ptr(3)},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "HeadInt64PtrMultiFieldsOmitEmpty",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
A *int64 `json:"a,omitempty"`
|
|
|
|
B *int64 `json:"b,omitempty"`
|
2021-02-15 05:20:23 +03:00
|
|
|
C *int64 `json:"c,omitempty"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: int64ptr(-1), B: int64ptr(2), C: int64ptr(3)},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "HeadInt64PtrMultiFieldsString",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
A *int64 `json:"a,string"`
|
|
|
|
B *int64 `json:"b,string"`
|
2021-02-15 05:20:23 +03:00
|
|
|
C *int64 `json:"c,string"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: int64ptr(-1), B: int64ptr(2), C: int64ptr(3)},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
2021-01-18 16:35:10 +03:00
|
|
|
|
|
|
|
// HeadInt64PtrNilMultiFields
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "HeadInt64PtrNilMultiFields",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
2021-01-16 16:16:26 +03:00
|
|
|
A *int64 `json:"a"`
|
|
|
|
B *int64 `json:"b"`
|
2021-02-15 05:20:23 +03:00
|
|
|
C *int64 `json:"c"`
|
|
|
|
}{A: nil, B: nil, C: nil},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "HeadInt64PtrNilMultiFieldsOmitEmpty",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
A *int64 `json:"a,omitempty"`
|
|
|
|
B *int64 `json:"b,omitempty"`
|
2021-02-15 05:20:23 +03:00
|
|
|
C *int64 `json:"c,omitempty"`
|
|
|
|
}{A: nil, B: nil, C: nil},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "HeadInt64PtrNilMultiFieldsString",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
A *int64 `json:"a,string"`
|
|
|
|
B *int64 `json:"b,string"`
|
2021-02-15 05:20:23 +03:00
|
|
|
C *int64 `json:"c,string"`
|
|
|
|
}{A: nil, B: nil, C: nil},
|
2021-01-18 16:35:10 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadInt64ZeroMultiFields
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64ZeroMultiFields",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: &struct {
|
|
|
|
A int64 `json:"a"`
|
|
|
|
B int64 `json:"b"`
|
|
|
|
}{},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64ZeroMultiFieldsOmitEmpty",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: &struct {
|
|
|
|
A int64 `json:"a,omitempty"`
|
|
|
|
B int64 `json:"b,omitempty"`
|
|
|
|
}{},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64ZeroMultiFieldsString",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: &struct {
|
|
|
|
A int64 `json:"a,string"`
|
|
|
|
B int64 `json:"b,string"`
|
|
|
|
}{},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadInt64MultiFields
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64MultiFields",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: &struct {
|
|
|
|
A int64 `json:"a"`
|
|
|
|
B int64 `json:"b"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: -1, B: 2},
|
2021-01-18 16:35:10 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64MultiFieldsOmitEmpty",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: &struct {
|
|
|
|
A int64 `json:"a,omitempty"`
|
|
|
|
B int64 `json:"b,omitempty"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: -1, B: 2},
|
2021-01-18 16:35:10 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64MultiFieldsString",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: &struct {
|
|
|
|
A int64 `json:"a,string"`
|
|
|
|
B int64 `json:"b,string"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: -1, B: 2},
|
2021-01-18 16:35:10 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadInt64PtrMultiFields
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64PtrMultiFields",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: &struct {
|
|
|
|
A *int64 `json:"a"`
|
|
|
|
B *int64 `json:"b"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: int64ptr(-1), B: int64ptr(2)},
|
2021-01-18 16:35:10 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64PtrMultiFieldsOmitEmpty",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: &struct {
|
|
|
|
A *int64 `json:"a,omitempty"`
|
|
|
|
B *int64 `json:"b,omitempty"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: int64ptr(-1), B: int64ptr(2)},
|
2021-01-18 16:35:10 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64PtrMultiFieldsString",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: &struct {
|
|
|
|
A *int64 `json:"a,string"`
|
|
|
|
B *int64 `json:"b,string"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: int64ptr(-1), B: int64ptr(2)},
|
2021-01-18 16:35:10 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadInt64PtrNilMultiFields
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64PtrNilMultiFields",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: &struct {
|
|
|
|
A *int64 `json:"a"`
|
|
|
|
B *int64 `json:"b"`
|
|
|
|
}{A: nil, B: nil},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64PtrNilMultiFieldsOmitEmpty",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: &struct {
|
|
|
|
A *int64 `json:"a,omitempty"`
|
|
|
|
B *int64 `json:"b,omitempty"`
|
|
|
|
}{A: nil, B: nil},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64PtrNilMultiFieldsString",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: &struct {
|
|
|
|
A *int64 `json:"a,string"`
|
|
|
|
B *int64 `json:"b,string"`
|
|
|
|
}{A: nil, B: nil},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadInt64NilMultiFields
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64NilMultiFields",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: (*struct {
|
|
|
|
A *int64 `json:"a"`
|
|
|
|
B *int64 `json:"b"`
|
|
|
|
})(nil),
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64NilMultiFieldsOmitEmpty",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: (*struct {
|
|
|
|
A *int64 `json:"a,omitempty"`
|
|
|
|
B *int64 `json:"b,omitempty"`
|
|
|
|
})(nil),
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64NilMultiFieldsString",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: (*struct {
|
|
|
|
A *int64 `json:"a,string"`
|
|
|
|
B *int64 `json:"b,string"`
|
|
|
|
})(nil),
|
|
|
|
},
|
|
|
|
|
|
|
|
// HeadInt64ZeroNotRoot
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "HeadInt64ZeroNotRoot",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A int64 `json:"a"`
|
|
|
|
}
|
|
|
|
}{},
|
|
|
|
},
|
2021-01-18 16:35:10 +03:00
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "HeadInt64ZeroNotRootOmitEmpty",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A int64 `json:"a,omitempty"`
|
|
|
|
}
|
|
|
|
}{},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "HeadInt64ZeroNotRootString",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A int64 `json:"a,string"`
|
|
|
|
}
|
|
|
|
}{},
|
|
|
|
},
|
|
|
|
|
|
|
|
// HeadInt64NotRoot
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "HeadInt64NotRoot",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A int64 `json:"a"`
|
|
|
|
}
|
|
|
|
}{A: struct {
|
|
|
|
A int64 `json:"a"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: -1}},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "HeadInt64NotRootOmitEmpty",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
2021-01-18 16:35:10 +03:00
|
|
|
A int64 `json:"a,omitempty"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
|
|
|
}{A: struct {
|
2021-01-18 16:35:10 +03:00
|
|
|
A int64 `json:"a,omitempty"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: -1}},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "HeadInt64NotRootString",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
2021-01-18 16:35:10 +03:00
|
|
|
A int64 `json:"a,string"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
2021-01-18 16:35:10 +03:00
|
|
|
}{A: struct {
|
|
|
|
A int64 `json:"a,string"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: -1}},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
2021-01-18 16:35:10 +03:00
|
|
|
|
|
|
|
// HeadInt64PtrNotRoot
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "HeadInt64PtrNotRoot",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
2021-01-18 16:35:10 +03:00
|
|
|
A struct {
|
|
|
|
A *int64 `json:"a"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
2021-01-18 16:35:10 +03:00
|
|
|
}{A: struct {
|
|
|
|
A *int64 `json:"a"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{int64ptr(-1)}},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "HeadInt64PtrNotRootOmitEmpty",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
2021-01-18 16:35:10 +03:00
|
|
|
A struct {
|
|
|
|
A *int64 `json:"a,omitempty"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
2021-01-18 16:35:10 +03:00
|
|
|
}{A: struct {
|
|
|
|
A *int64 `json:"a,omitempty"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{int64ptr(-1)}},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "HeadInt64PtrNotRootString",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
2021-01-18 16:35:10 +03:00
|
|
|
A struct {
|
|
|
|
A *int64 `json:"a,string"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
2021-01-18 16:35:10 +03:00
|
|
|
}{A: struct {
|
|
|
|
A *int64 `json:"a,string"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{int64ptr(-1)}},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
2021-01-18 16:35:10 +03:00
|
|
|
|
|
|
|
// HeadInt64PtrNilNotRoot
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "HeadInt64PtrNilNotRoot",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A *int64 `json:"a"`
|
|
|
|
}
|
|
|
|
}{},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "HeadInt64PtrNilNotRootOmitEmpty",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A *int64 `json:"a,omitempty"`
|
|
|
|
}
|
|
|
|
}{},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "HeadInt64PtrNilNotRootString",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A *int64 `json:"a,string"`
|
|
|
|
}
|
|
|
|
}{},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadInt64ZeroNotRoot
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64ZeroNotRoot",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
A *struct {
|
|
|
|
A int64 `json:"a"`
|
|
|
|
}
|
|
|
|
}{A: new(struct {
|
|
|
|
A int64 `json:"a"`
|
|
|
|
})},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64ZeroNotRootOmitEmpty",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
A *struct {
|
|
|
|
A int64 `json:"a,omitempty"`
|
|
|
|
}
|
|
|
|
}{A: new(struct {
|
|
|
|
A int64 `json:"a,omitempty"`
|
|
|
|
})},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64ZeroNotRootString",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
A *struct {
|
|
|
|
A int64 `json:"a,string"`
|
|
|
|
}
|
|
|
|
}{A: new(struct {
|
|
|
|
A int64 `json:"a,string"`
|
|
|
|
})},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadInt64NotRoot
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64NotRoot",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
A *struct {
|
|
|
|
A int64 `json:"a"`
|
|
|
|
}
|
|
|
|
}{A: &(struct {
|
|
|
|
A int64 `json:"a"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: -1})},
|
2021-01-18 16:35:10 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64NotRootOmitEmpty",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
A *struct {
|
|
|
|
A int64 `json:"a,omitempty"`
|
|
|
|
}
|
|
|
|
}{A: &(struct {
|
|
|
|
A int64 `json:"a,omitempty"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: -1})},
|
2021-01-18 16:35:10 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64NotRootString",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
A *struct {
|
|
|
|
A int64 `json:"a,string"`
|
|
|
|
}
|
|
|
|
}{A: &(struct {
|
|
|
|
A int64 `json:"a,string"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: -1})},
|
2021-01-18 16:35:10 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadInt64PtrNotRoot
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64PtrNotRoot",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
A *struct {
|
|
|
|
A *int64 `json:"a"`
|
|
|
|
}
|
|
|
|
}{A: &(struct {
|
|
|
|
A *int64 `json:"a"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: int64ptr(-1)})},
|
2021-01-18 16:35:10 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64PtrNotRootOmitEmpty",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
A *struct {
|
|
|
|
A *int64 `json:"a,omitempty"`
|
|
|
|
}
|
|
|
|
}{A: &(struct {
|
|
|
|
A *int64 `json:"a,omitempty"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: int64ptr(-1)})},
|
2021-01-18 16:35:10 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64PtrNotRootString",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
A *struct {
|
|
|
|
A *int64 `json:"a,string"`
|
|
|
|
}
|
|
|
|
}{A: &(struct {
|
|
|
|
A *int64 `json:"a,string"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: int64ptr(-1)})},
|
2021-01-18 16:35:10 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadInt64PtrNilNotRoot
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64PtrNilNotRoot",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
A *struct {
|
|
|
|
A *int64 `json:"a"`
|
|
|
|
}
|
|
|
|
}{A: &(struct {
|
|
|
|
A *int64 `json:"a"`
|
|
|
|
}{A: nil})},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64PtrNilNotRootOmitEmpty",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
A *struct {
|
|
|
|
A *int64 `json:"a,omitempty"`
|
|
|
|
}
|
|
|
|
}{A: &(struct {
|
|
|
|
A *int64 `json:"a,omitempty"`
|
|
|
|
}{A: nil})},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64PtrNilNotRootString",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
A *struct {
|
|
|
|
A *int64 `json:"a,string"`
|
|
|
|
}
|
|
|
|
}{A: &(struct {
|
|
|
|
A *int64 `json:"a,string"`
|
|
|
|
}{A: nil})},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadInt64NilNotRoot
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64NilNotRoot",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
A *struct {
|
|
|
|
A *int64 `json:"a"`
|
|
|
|
}
|
|
|
|
}{A: nil},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64NilNotRootOmitEmpty",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
A *struct {
|
|
|
|
A *int64 `json:"a,omitempty"`
|
|
|
|
} `json:",omitempty"`
|
|
|
|
}{A: nil},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64NilNotRootString",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
A *struct {
|
|
|
|
A *int64 `json:"a,string"`
|
|
|
|
} `json:",string"`
|
|
|
|
}{A: nil},
|
|
|
|
},
|
|
|
|
|
|
|
|
// HeadInt64ZeroMultiFieldsNotRoot
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "HeadInt64ZeroMultiFieldsNotRoot",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A int64 `json:"a"`
|
|
|
|
}
|
|
|
|
B struct {
|
|
|
|
B int64 `json:"b"`
|
|
|
|
}
|
|
|
|
}{},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "HeadInt64ZeroMultiFieldsNotRootOmitEmpty",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A int64 `json:"a,omitempty"`
|
|
|
|
}
|
|
|
|
B struct {
|
|
|
|
B int64 `json:"b,omitempty"`
|
|
|
|
}
|
|
|
|
}{},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "HeadInt64ZeroMultiFieldsNotRootString",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A int64 `json:"a,string"`
|
|
|
|
}
|
|
|
|
B struct {
|
|
|
|
B int64 `json:"b,string"`
|
|
|
|
}
|
|
|
|
}{},
|
|
|
|
},
|
|
|
|
|
|
|
|
// HeadInt64MultiFieldsNotRoot
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "HeadInt64MultiFieldsNotRoot",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A int64 `json:"a"`
|
|
|
|
}
|
|
|
|
B struct {
|
|
|
|
B int64 `json:"b"`
|
|
|
|
}
|
|
|
|
}{A: struct {
|
|
|
|
A int64 `json:"a"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: -1}, B: struct {
|
2021-01-18 16:35:10 +03:00
|
|
|
B int64 `json:"b"`
|
|
|
|
}{B: 2}},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "HeadInt64MultiFieldsNotRootOmitEmpty",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A int64 `json:"a,omitempty"`
|
|
|
|
}
|
|
|
|
B struct {
|
|
|
|
B int64 `json:"b,omitempty"`
|
|
|
|
}
|
|
|
|
}{A: struct {
|
|
|
|
A int64 `json:"a,omitempty"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: -1}, B: struct {
|
2021-01-18 16:35:10 +03:00
|
|
|
B int64 `json:"b,omitempty"`
|
|
|
|
}{B: 2}},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "HeadInt64MultiFieldsNotRootString",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A int64 `json:"a,string"`
|
|
|
|
}
|
|
|
|
B struct {
|
|
|
|
B int64 `json:"b,string"`
|
|
|
|
}
|
|
|
|
}{A: struct {
|
|
|
|
A int64 `json:"a,string"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: -1}, B: struct {
|
2021-01-18 16:35:10 +03:00
|
|
|
B int64 `json:"b,string"`
|
|
|
|
}{B: 2}},
|
|
|
|
},
|
|
|
|
|
|
|
|
// HeadInt64PtrMultiFieldsNotRoot
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "HeadInt64PtrMultiFieldsNotRoot",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A *int64 `json:"a"`
|
|
|
|
}
|
|
|
|
B struct {
|
|
|
|
B *int64 `json:"b"`
|
|
|
|
}
|
|
|
|
}{A: struct {
|
|
|
|
A *int64 `json:"a"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: int64ptr(-1)}, B: struct {
|
2021-01-18 16:35:10 +03:00
|
|
|
B *int64 `json:"b"`
|
|
|
|
}{B: int64ptr(2)}},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "HeadInt64PtrMultiFieldsNotRootOmitEmpty",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A *int64 `json:"a,omitempty"`
|
|
|
|
}
|
|
|
|
B struct {
|
|
|
|
B *int64 `json:"b,omitempty"`
|
|
|
|
}
|
|
|
|
}{A: struct {
|
|
|
|
A *int64 `json:"a,omitempty"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: int64ptr(-1)}, B: struct {
|
2021-01-18 16:35:10 +03:00
|
|
|
B *int64 `json:"b,omitempty"`
|
|
|
|
}{B: int64ptr(2)}},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "HeadInt64PtrMultiFieldsNotRootString",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A *int64 `json:"a,string"`
|
|
|
|
}
|
|
|
|
B struct {
|
|
|
|
B *int64 `json:"b,string"`
|
|
|
|
}
|
|
|
|
}{A: struct {
|
|
|
|
A *int64 `json:"a,string"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: int64ptr(-1)}, B: struct {
|
2021-01-18 16:35:10 +03:00
|
|
|
B *int64 `json:"b,string"`
|
|
|
|
}{B: int64ptr(2)}},
|
|
|
|
},
|
|
|
|
|
|
|
|
// HeadInt64PtrNilMultiFieldsNotRoot
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "HeadInt64PtrNilMultiFieldsNotRoot",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A *int64 `json:"a"`
|
|
|
|
}
|
|
|
|
B struct {
|
|
|
|
B *int64 `json:"b"`
|
|
|
|
}
|
|
|
|
}{A: struct {
|
|
|
|
A *int64 `json:"a"`
|
|
|
|
}{A: nil}, B: struct {
|
|
|
|
B *int64 `json:"b"`
|
|
|
|
}{B: nil}},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "HeadInt64PtrNilMultiFieldsNotRootOmitEmpty",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A *int64 `json:"a,omitempty"`
|
|
|
|
}
|
|
|
|
B struct {
|
|
|
|
B *int64 `json:"b,omitempty"`
|
|
|
|
}
|
|
|
|
}{A: struct {
|
|
|
|
A *int64 `json:"a,omitempty"`
|
|
|
|
}{A: nil}, B: struct {
|
|
|
|
B *int64 `json:"b,omitempty"`
|
|
|
|
}{B: nil}},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "HeadInt64PtrNilMultiFieldsNotRootString",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A *int64 `json:"a,string"`
|
|
|
|
}
|
|
|
|
B struct {
|
|
|
|
B *int64 `json:"b,string"`
|
|
|
|
}
|
|
|
|
}{A: struct {
|
|
|
|
A *int64 `json:"a,string"`
|
|
|
|
}{A: nil}, B: struct {
|
|
|
|
B *int64 `json:"b,string"`
|
|
|
|
}{B: nil}},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadInt64ZeroMultiFieldsNotRoot
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64ZeroMultiFieldsNotRoot",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: &struct {
|
|
|
|
A struct {
|
|
|
|
A int64 `json:"a"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
2021-01-18 16:35:10 +03:00
|
|
|
B struct {
|
|
|
|
B int64 `json:"b"`
|
|
|
|
}
|
|
|
|
}{},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64ZeroMultiFieldsNotRootOmitEmpty",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: &struct {
|
|
|
|
A struct {
|
|
|
|
A int64 `json:"a,omitempty"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
2021-01-18 16:35:10 +03:00
|
|
|
B struct {
|
|
|
|
B int64 `json:"b,omitempty"`
|
|
|
|
}
|
|
|
|
}{},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64ZeroMultiFieldsNotRootString",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: &struct {
|
2021-01-16 16:16:26 +03:00
|
|
|
A struct {
|
2021-01-18 16:35:10 +03:00
|
|
|
A int64 `json:"a,string"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
|
|
|
B struct {
|
2021-01-18 16:35:10 +03:00
|
|
|
B int64 `json:"b,string"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
|
|
|
}{},
|
|
|
|
},
|
2021-01-18 16:35:10 +03:00
|
|
|
|
|
|
|
// PtrHeadInt64MultiFieldsNotRoot
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64MultiFieldsNotRoot",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: &struct {
|
2021-01-16 16:16:26 +03:00
|
|
|
A struct {
|
|
|
|
A int64 `json:"a"`
|
|
|
|
}
|
|
|
|
B struct {
|
|
|
|
B int64 `json:"b"`
|
|
|
|
}
|
|
|
|
}{A: struct {
|
|
|
|
A int64 `json:"a"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: -1}, B: struct {
|
2021-01-16 16:16:26 +03:00
|
|
|
B int64 `json:"b"`
|
|
|
|
}{B: 2}},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64MultiFieldsNotRootOmitEmpty",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: &struct {
|
2021-01-16 16:16:26 +03:00
|
|
|
A struct {
|
2021-01-18 16:35:10 +03:00
|
|
|
A int64 `json:"a,omitempty"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
|
|
|
B struct {
|
2021-01-18 16:35:10 +03:00
|
|
|
B int64 `json:"b,omitempty"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
|
|
|
}{A: struct {
|
2021-01-18 16:35:10 +03:00
|
|
|
A int64 `json:"a,omitempty"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: -1}, B: struct {
|
2021-01-18 16:35:10 +03:00
|
|
|
B int64 `json:"b,omitempty"`
|
|
|
|
}{B: 2}},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64MultiFieldsNotRootString",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: &struct {
|
2021-01-16 16:16:26 +03:00
|
|
|
A struct {
|
2021-01-18 16:35:10 +03:00
|
|
|
A int64 `json:"a,string"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
|
|
|
B struct {
|
2021-01-18 16:35:10 +03:00
|
|
|
B int64 `json:"b,string"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
|
|
|
}{A: struct {
|
2021-01-18 16:35:10 +03:00
|
|
|
A int64 `json:"a,string"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: -1}, B: struct {
|
2021-01-18 16:35:10 +03:00
|
|
|
B int64 `json:"b,string"`
|
|
|
|
}{B: 2}},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
2021-01-18 16:35:10 +03:00
|
|
|
|
|
|
|
// PtrHeadInt64PtrMultiFieldsNotRoot
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64PtrMultiFieldsNotRoot",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: &struct {
|
2021-01-18 16:35:10 +03:00
|
|
|
A *struct {
|
|
|
|
A *int64 `json:"a"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
2021-01-18 16:35:10 +03:00
|
|
|
B *struct {
|
|
|
|
B *int64 `json:"b"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
2021-01-18 16:35:10 +03:00
|
|
|
}{A: &(struct {
|
|
|
|
A *int64 `json:"a"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: int64ptr(-1)}), B: &(struct {
|
2021-01-18 16:35:10 +03:00
|
|
|
B *int64 `json:"b"`
|
|
|
|
}{B: int64ptr(2)})},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64PtrMultiFieldsNotRootOmitEmpty",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: &struct {
|
2021-01-18 16:35:10 +03:00
|
|
|
A *struct {
|
|
|
|
A *int64 `json:"a,omitempty"`
|
|
|
|
}
|
|
|
|
B *struct {
|
|
|
|
B *int64 `json:"b,omitempty"`
|
|
|
|
}
|
|
|
|
}{A: &(struct {
|
|
|
|
A *int64 `json:"a,omitempty"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: int64ptr(-1)}), B: &(struct {
|
2021-01-18 16:35:10 +03:00
|
|
|
B *int64 `json:"b,omitempty"`
|
|
|
|
}{B: int64ptr(2)})},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64PtrMultiFieldsNotRootString",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: &struct {
|
|
|
|
A *struct {
|
|
|
|
A *int64 `json:"a,string"`
|
|
|
|
}
|
|
|
|
B *struct {
|
|
|
|
B *int64 `json:"b,string"`
|
|
|
|
}
|
|
|
|
}{A: &(struct {
|
|
|
|
A *int64 `json:"a,string"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: int64ptr(-1)}), B: &(struct {
|
2021-01-18 16:35:10 +03:00
|
|
|
B *int64 `json:"b,string"`
|
|
|
|
}{B: int64ptr(2)})},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadInt64PtrNilMultiFieldsNotRoot
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64PtrNilMultiFieldsNotRoot",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: &struct {
|
|
|
|
A *struct {
|
|
|
|
A *int64 `json:"a"`
|
|
|
|
}
|
|
|
|
B *struct {
|
|
|
|
B *int64 `json:"b"`
|
|
|
|
}
|
|
|
|
}{A: nil, B: nil},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64PtrNilMultiFieldsNotRootOmitEmpty",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: &struct {
|
|
|
|
A *struct {
|
|
|
|
A *int64 `json:"a,omitempty"`
|
|
|
|
} `json:",omitempty"`
|
|
|
|
B *struct {
|
|
|
|
B *int64 `json:"b,omitempty"`
|
|
|
|
} `json:",omitempty"`
|
|
|
|
}{A: nil, B: nil},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64PtrNilMultiFieldsNotRootString",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: &struct {
|
|
|
|
A *struct {
|
|
|
|
A *int64 `json:"a,string"`
|
|
|
|
} `json:",string"`
|
|
|
|
B *struct {
|
|
|
|
B *int64 `json:"b,string"`
|
|
|
|
} `json:",string"`
|
|
|
|
}{A: nil, B: nil},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadInt64NilMultiFieldsNotRoot
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64NilMultiFieldsNotRoot",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: (*struct {
|
|
|
|
A *struct {
|
|
|
|
A *int64 `json:"a"`
|
|
|
|
}
|
|
|
|
B *struct {
|
|
|
|
B *int64 `json:"b"`
|
|
|
|
}
|
|
|
|
})(nil),
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64NilMultiFieldsNotRootOmitEmpty",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: (*struct {
|
|
|
|
A *struct {
|
|
|
|
A *int64 `json:"a,omitempty"`
|
|
|
|
}
|
|
|
|
B *struct {
|
|
|
|
B *int64 `json:"b,omitempty"`
|
|
|
|
}
|
|
|
|
})(nil),
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64NilMultiFieldsNotRootString",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: (*struct {
|
|
|
|
A *struct {
|
|
|
|
A *int64 `json:"a,string"`
|
|
|
|
}
|
|
|
|
B *struct {
|
|
|
|
B *int64 `json:"b,string"`
|
|
|
|
}
|
|
|
|
})(nil),
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadInt64DoubleMultiFieldsNotRoot
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64DoubleMultiFieldsNotRoot",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: &struct {
|
|
|
|
A *struct {
|
2021-01-16 16:16:26 +03:00
|
|
|
A int64 `json:"a"`
|
2021-01-18 16:35:10 +03:00
|
|
|
B int64 `json:"b"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
2021-01-18 16:35:10 +03:00
|
|
|
B *struct {
|
|
|
|
A int64 `json:"a"`
|
2021-01-16 16:16:26 +03:00
|
|
|
B int64 `json:"b"`
|
|
|
|
}
|
2021-01-18 16:35:10 +03:00
|
|
|
}{A: &(struct {
|
2021-01-16 16:16:26 +03:00
|
|
|
A int64 `json:"a"`
|
|
|
|
B int64 `json:"b"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: -1, B: 2}), B: &(struct {
|
2021-01-18 16:35:10 +03:00
|
|
|
A int64 `json:"a"`
|
|
|
|
B int64 `json:"b"`
|
|
|
|
}{A: 3, B: 4})},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64DoubleMultiFieldsNotRootOmitEmpty",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: &struct {
|
|
|
|
A *struct {
|
|
|
|
A int64 `json:"a,omitempty"`
|
|
|
|
B int64 `json:"b,omitempty"`
|
|
|
|
}
|
|
|
|
B *struct {
|
|
|
|
A int64 `json:"a,omitempty"`
|
|
|
|
B int64 `json:"b,omitempty"`
|
|
|
|
}
|
|
|
|
}{A: &(struct {
|
|
|
|
A int64 `json:"a,omitempty"`
|
|
|
|
B int64 `json:"b,omitempty"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: -1, B: 2}), B: &(struct {
|
2021-01-18 16:35:10 +03:00
|
|
|
A int64 `json:"a,omitempty"`
|
|
|
|
B int64 `json:"b,omitempty"`
|
|
|
|
}{A: 3, B: 4})},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64DoubleMultiFieldsNotRootString",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: &struct {
|
|
|
|
A *struct {
|
2021-01-18 16:35:10 +03:00
|
|
|
A int64 `json:"a,string"`
|
|
|
|
B int64 `json:"b,string"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
|
|
|
B *struct {
|
2021-01-18 16:35:10 +03:00
|
|
|
A int64 `json:"a,string"`
|
|
|
|
B int64 `json:"b,string"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
|
|
|
}{A: &(struct {
|
2021-01-18 16:35:10 +03:00
|
|
|
A int64 `json:"a,string"`
|
|
|
|
B int64 `json:"b,string"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: -1, B: 2}), B: &(struct {
|
2021-01-18 16:35:10 +03:00
|
|
|
A int64 `json:"a,string"`
|
|
|
|
B int64 `json:"b,string"`
|
|
|
|
}{A: 3, B: 4})},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
2021-01-18 16:35:10 +03:00
|
|
|
|
|
|
|
// PtrHeadInt64NilDoubleMultiFieldsNotRoot
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64NilDoubleMultiFieldsNotRoot",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: &struct {
|
|
|
|
A *struct {
|
2021-01-18 16:35:10 +03:00
|
|
|
A int64 `json:"a"`
|
|
|
|
B int64 `json:"b"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
|
|
|
B *struct {
|
2021-01-18 16:35:10 +03:00
|
|
|
A int64 `json:"a"`
|
|
|
|
B int64 `json:"b"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
|
|
|
}{A: nil, B: nil},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64NilDoubleMultiFieldsNotRootOmitEmpty",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: &struct {
|
2021-01-16 16:16:26 +03:00
|
|
|
A *struct {
|
2021-01-18 16:35:10 +03:00
|
|
|
A int64 `json:"a,omitempty"`
|
|
|
|
B int64 `json:"b,omitempty"`
|
|
|
|
} `json:",omitempty"`
|
2021-01-16 16:16:26 +03:00
|
|
|
B *struct {
|
2021-01-18 16:35:10 +03:00
|
|
|
A int64 `json:"a,omitempty"`
|
|
|
|
B int64 `json:"b,omitempty"`
|
|
|
|
} `json:",omitempty"`
|
|
|
|
}{A: nil, B: nil},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64NilDoubleMultiFieldsNotRootString",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: &struct {
|
|
|
|
A *struct {
|
2021-01-18 16:35:10 +03:00
|
|
|
A int64 `json:"a,string"`
|
|
|
|
B int64 `json:"b,string"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
|
|
|
B *struct {
|
2021-01-18 16:35:10 +03:00
|
|
|
A int64 `json:"a,string"`
|
|
|
|
B int64 `json:"b,string"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
2021-01-18 16:35:10 +03:00
|
|
|
}{A: nil, B: nil},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
2021-01-18 16:35:10 +03:00
|
|
|
|
|
|
|
// PtrHeadInt64NilDoubleMultiFieldsNotRoot
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64NilDoubleMultiFieldsNotRoot",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: (*struct {
|
2021-01-16 16:16:26 +03:00
|
|
|
A *struct {
|
|
|
|
A int64 `json:"a"`
|
|
|
|
B int64 `json:"b"`
|
|
|
|
}
|
|
|
|
B *struct {
|
|
|
|
A int64 `json:"a"`
|
|
|
|
B int64 `json:"b"`
|
|
|
|
}
|
2021-01-18 16:35:10 +03:00
|
|
|
})(nil),
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64NilDoubleMultiFieldsNotRootOmitEmpty",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: (*struct {
|
|
|
|
A *struct {
|
2021-01-18 16:35:10 +03:00
|
|
|
A int64 `json:"a,omitempty"`
|
|
|
|
B int64 `json:"b,omitempty"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
|
|
|
B *struct {
|
2021-01-18 16:35:10 +03:00
|
|
|
A int64 `json:"a,omitempty"`
|
|
|
|
B int64 `json:"b,omitempty"`
|
|
|
|
}
|
|
|
|
})(nil),
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64NilDoubleMultiFieldsNotRootString",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: (*struct {
|
|
|
|
A *struct {
|
|
|
|
A int64 `json:"a,string"`
|
|
|
|
B int64 `json:"b,string"`
|
|
|
|
}
|
|
|
|
B *struct {
|
|
|
|
A int64 `json:"a,string"`
|
|
|
|
B int64 `json:"b,string"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
|
|
|
})(nil),
|
|
|
|
},
|
2021-01-18 16:35:10 +03:00
|
|
|
|
|
|
|
// PtrHeadInt64PtrDoubleMultiFieldsNotRoot
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64PtrDoubleMultiFieldsNotRoot",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: &struct {
|
|
|
|
A *struct {
|
|
|
|
A *int64 `json:"a"`
|
|
|
|
B *int64 `json:"b"`
|
|
|
|
}
|
|
|
|
B *struct {
|
|
|
|
A *int64 `json:"a"`
|
|
|
|
B *int64 `json:"b"`
|
|
|
|
}
|
|
|
|
}{A: &(struct {
|
|
|
|
A *int64 `json:"a"`
|
|
|
|
B *int64 `json:"b"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: int64ptr(-1), B: int64ptr(2)}), B: &(struct {
|
2021-01-16 16:16:26 +03:00
|
|
|
A *int64 `json:"a"`
|
|
|
|
B *int64 `json:"b"`
|
|
|
|
}{A: int64ptr(3), B: int64ptr(4)})},
|
|
|
|
},
|
2021-01-18 16:35:10 +03:00
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64PtrDoubleMultiFieldsNotRootOmitEmpty",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: &struct {
|
|
|
|
A *struct {
|
|
|
|
A *int64 `json:"a,omitempty"`
|
|
|
|
B *int64 `json:"b,omitempty"`
|
|
|
|
}
|
|
|
|
B *struct {
|
|
|
|
A *int64 `json:"a,omitempty"`
|
|
|
|
B *int64 `json:"b,omitempty"`
|
|
|
|
}
|
|
|
|
}{A: &(struct {
|
|
|
|
A *int64 `json:"a,omitempty"`
|
|
|
|
B *int64 `json:"b,omitempty"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: int64ptr(-1), B: int64ptr(2)}), B: &(struct {
|
2021-01-18 16:35:10 +03:00
|
|
|
A *int64 `json:"a,omitempty"`
|
|
|
|
B *int64 `json:"b,omitempty"`
|
|
|
|
}{A: int64ptr(3), B: int64ptr(4)})},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64PtrDoubleMultiFieldsNotRootString",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: &struct {
|
|
|
|
A *struct {
|
|
|
|
A *int64 `json:"a,string"`
|
|
|
|
B *int64 `json:"b,string"`
|
|
|
|
}
|
|
|
|
B *struct {
|
|
|
|
A *int64 `json:"a,string"`
|
|
|
|
B *int64 `json:"b,string"`
|
|
|
|
}
|
|
|
|
}{A: &(struct {
|
|
|
|
A *int64 `json:"a,string"`
|
|
|
|
B *int64 `json:"b,string"`
|
2021-02-19 09:08:30 +03:00
|
|
|
}{A: int64ptr(-1), B: int64ptr(2)}), B: &(struct {
|
2021-01-18 16:35:10 +03:00
|
|
|
A *int64 `json:"a,string"`
|
|
|
|
B *int64 `json:"b,string"`
|
|
|
|
}{A: int64ptr(3), B: int64ptr(4)})},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadInt64PtrNilDoubleMultiFieldsNotRoot
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64PtrNilDoubleMultiFieldsNotRoot",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: &struct {
|
|
|
|
A *struct {
|
|
|
|
A *int64 `json:"a"`
|
|
|
|
B *int64 `json:"b"`
|
|
|
|
}
|
|
|
|
B *struct {
|
|
|
|
A *int64 `json:"a"`
|
|
|
|
B *int64 `json:"b"`
|
|
|
|
}
|
|
|
|
}{A: nil, B: nil},
|
|
|
|
},
|
2021-01-18 16:35:10 +03:00
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64PtrNilDoubleMultiFieldsNotRootOmitEmpty",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: &struct {
|
|
|
|
A *struct {
|
|
|
|
A *int64 `json:"a,omitempty"`
|
|
|
|
B *int64 `json:"b,omitempty"`
|
|
|
|
} `json:",omitempty"`
|
|
|
|
B *struct {
|
|
|
|
A *int64 `json:"a,omitempty"`
|
|
|
|
B *int64 `json:"b,omitempty"`
|
|
|
|
} `json:",omitempty"`
|
|
|
|
}{A: nil, B: nil},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64PtrNilDoubleMultiFieldsNotRootString",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: &struct {
|
|
|
|
A *struct {
|
|
|
|
A *int64 `json:"a,string"`
|
|
|
|
B *int64 `json:"b,string"`
|
|
|
|
}
|
|
|
|
B *struct {
|
|
|
|
A *int64 `json:"a,string"`
|
|
|
|
B *int64 `json:"b,string"`
|
|
|
|
}
|
|
|
|
}{A: nil, B: nil},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadInt64PtrNilDoubleMultiFieldsNotRoot
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64PtrNilDoubleMultiFieldsNotRoot",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: (*struct {
|
|
|
|
A *struct {
|
|
|
|
A *int64 `json:"a"`
|
|
|
|
B *int64 `json:"b"`
|
|
|
|
}
|
|
|
|
B *struct {
|
|
|
|
A *int64 `json:"a"`
|
|
|
|
B *int64 `json:"b"`
|
|
|
|
}
|
|
|
|
})(nil),
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64PtrNilDoubleMultiFieldsNotRootOmitEmpty",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: (*struct {
|
|
|
|
A *struct {
|
|
|
|
A *int64 `json:"a,omitempty"`
|
|
|
|
B *int64 `json:"b,omitempty"`
|
|
|
|
}
|
|
|
|
B *struct {
|
|
|
|
A *int64 `json:"a,omitempty"`
|
|
|
|
B *int64 `json:"b,omitempty"`
|
|
|
|
}
|
|
|
|
})(nil),
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrHeadInt64PtrNilDoubleMultiFieldsNotRootString",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: (*struct {
|
|
|
|
A *struct {
|
|
|
|
A *int64 `json:"a,string"`
|
|
|
|
B *int64 `json:"b,string"`
|
|
|
|
}
|
|
|
|
B *struct {
|
|
|
|
A *int64 `json:"a,string"`
|
|
|
|
B *int64 `json:"b,string"`
|
|
|
|
}
|
|
|
|
})(nil),
|
|
|
|
},
|
|
|
|
|
|
|
|
// AnonymousHeadInt64
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "AnonymousHeadInt64",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
structInt64
|
|
|
|
B int64 `json:"b"`
|
|
|
|
}{
|
2021-02-19 09:08:30 +03:00
|
|
|
structInt64: structInt64{A: -1},
|
2021-01-18 16:35:10 +03:00
|
|
|
B: 2,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "AnonymousHeadInt64OmitEmpty",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
structInt64OmitEmpty
|
|
|
|
B int64 `json:"b,omitempty"`
|
|
|
|
}{
|
2021-02-19 09:08:30 +03:00
|
|
|
structInt64OmitEmpty: structInt64OmitEmpty{A: -1},
|
2021-01-18 16:35:10 +03:00
|
|
|
B: 2,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "AnonymousHeadInt64String",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
structInt64String
|
|
|
|
B int64 `json:"b,string"`
|
|
|
|
}{
|
2021-02-19 09:08:30 +03:00
|
|
|
structInt64String: structInt64String{A: -1},
|
2021-01-18 16:35:10 +03:00
|
|
|
B: 2,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrAnonymousHeadInt64
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrAnonymousHeadInt64",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
*structInt64
|
|
|
|
B int64 `json:"b"`
|
|
|
|
}{
|
2021-02-19 09:08:30 +03:00
|
|
|
structInt64: &structInt64{A: -1},
|
2021-01-18 16:35:10 +03:00
|
|
|
B: 2,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrAnonymousHeadInt64OmitEmpty",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
*structInt64OmitEmpty
|
|
|
|
B int64 `json:"b,omitempty"`
|
|
|
|
}{
|
2021-02-19 09:08:30 +03:00
|
|
|
structInt64OmitEmpty: &structInt64OmitEmpty{A: -1},
|
2021-01-18 16:35:10 +03:00
|
|
|
B: 2,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrAnonymousHeadInt64String",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
*structInt64String
|
|
|
|
B int64 `json:"b,string"`
|
|
|
|
}{
|
2021-02-19 09:08:30 +03:00
|
|
|
structInt64String: &structInt64String{A: -1},
|
2021-01-18 16:35:10 +03:00
|
|
|
B: 2,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// NilPtrAnonymousHeadInt64
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "NilPtrAnonymousHeadInt64",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
2021-01-18 16:35:10 +03:00
|
|
|
*structInt64
|
2021-01-16 16:16:26 +03:00
|
|
|
B int64 `json:"b"`
|
|
|
|
}{
|
2021-01-18 16:35:10 +03:00
|
|
|
structInt64: nil,
|
2021-01-16 16:16:26 +03:00
|
|
|
B: 2,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "NilPtrAnonymousHeadInt64OmitEmpty",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
2021-01-18 16:35:10 +03:00
|
|
|
*structInt64OmitEmpty
|
|
|
|
B int64 `json:"b,omitempty"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}{
|
2021-01-18 16:35:10 +03:00
|
|
|
structInt64OmitEmpty: nil,
|
|
|
|
B: 2,
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "NilPtrAnonymousHeadInt64String",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
2021-01-18 16:35:10 +03:00
|
|
|
*structInt64String
|
|
|
|
B int64 `json:"b,string"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}{
|
2021-01-18 16:35:10 +03:00
|
|
|
structInt64String: nil,
|
|
|
|
B: 2,
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
},
|
2021-01-18 16:35:10 +03:00
|
|
|
|
|
|
|
// AnonymousHeadInt64Ptr
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "AnonymousHeadInt64Ptr",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
structInt64Ptr
|
|
|
|
B *int64 `json:"b"`
|
|
|
|
}{
|
2021-02-19 09:08:30 +03:00
|
|
|
structInt64Ptr: structInt64Ptr{A: int64ptr(-1)},
|
2021-01-16 16:16:26 +03:00
|
|
|
B: int64ptr(2),
|
|
|
|
},
|
|
|
|
},
|
2021-01-18 16:35:10 +03:00
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "AnonymousHeadInt64PtrOmitEmpty",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
structInt64PtrOmitEmpty
|
|
|
|
B *int64 `json:"b,omitempty"`
|
|
|
|
}{
|
2021-02-19 09:08:30 +03:00
|
|
|
structInt64PtrOmitEmpty: structInt64PtrOmitEmpty{A: int64ptr(-1)},
|
2021-01-18 16:35:10 +03:00
|
|
|
B: int64ptr(2),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "AnonymousHeadInt64PtrString",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
structInt64PtrString
|
|
|
|
B *int64 `json:"b,string"`
|
|
|
|
}{
|
2021-02-19 09:08:30 +03:00
|
|
|
structInt64PtrString: structInt64PtrString{A: int64ptr(-1)},
|
2021-01-18 16:35:10 +03:00
|
|
|
B: int64ptr(2),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// AnonymousHeadInt64PtrNil
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "AnonymousHeadInt64PtrNil",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
structInt64Ptr
|
|
|
|
B *int64 `json:"b"`
|
|
|
|
}{
|
|
|
|
structInt64Ptr: structInt64Ptr{A: nil},
|
|
|
|
B: int64ptr(2),
|
|
|
|
},
|
|
|
|
},
|
2021-01-18 16:35:10 +03:00
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "AnonymousHeadInt64PtrNilOmitEmpty",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
structInt64PtrOmitEmpty
|
|
|
|
B *int64 `json:"b,omitempty"`
|
|
|
|
}{
|
|
|
|
structInt64PtrOmitEmpty: structInt64PtrOmitEmpty{A: nil},
|
|
|
|
B: int64ptr(2),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "AnonymousHeadInt64PtrNilString",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
structInt64PtrString
|
|
|
|
B *int64 `json:"b,string"`
|
|
|
|
}{
|
|
|
|
structInt64PtrString: structInt64PtrString{A: nil},
|
|
|
|
B: int64ptr(2),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrAnonymousHeadInt64Ptr
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrAnonymousHeadInt64Ptr",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
*structInt64Ptr
|
|
|
|
B *int64 `json:"b"`
|
|
|
|
}{
|
2021-02-19 09:08:30 +03:00
|
|
|
structInt64Ptr: &structInt64Ptr{A: int64ptr(-1)},
|
2021-01-16 16:16:26 +03:00
|
|
|
B: int64ptr(2),
|
|
|
|
},
|
|
|
|
},
|
2021-01-18 16:35:10 +03:00
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrAnonymousHeadInt64PtrOmitEmpty",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
*structInt64PtrOmitEmpty
|
|
|
|
B *int64 `json:"b,omitempty"`
|
|
|
|
}{
|
2021-02-19 09:08:30 +03:00
|
|
|
structInt64PtrOmitEmpty: &structInt64PtrOmitEmpty{A: int64ptr(-1)},
|
2021-01-18 16:35:10 +03:00
|
|
|
B: int64ptr(2),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrAnonymousHeadInt64PtrString",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
*structInt64PtrString
|
|
|
|
B *int64 `json:"b,string"`
|
|
|
|
}{
|
2021-02-19 09:08:30 +03:00
|
|
|
structInt64PtrString: &structInt64PtrString{A: int64ptr(-1)},
|
2021-01-18 16:35:10 +03:00
|
|
|
B: int64ptr(2),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// NilPtrAnonymousHeadInt64Ptr
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "NilPtrAnonymousHeadInt64Ptr",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
*structInt64Ptr
|
|
|
|
B *int64 `json:"b"`
|
|
|
|
}{
|
|
|
|
structInt64Ptr: nil,
|
|
|
|
B: int64ptr(2),
|
|
|
|
},
|
|
|
|
},
|
2021-01-18 16:35:10 +03:00
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "NilPtrAnonymousHeadInt64PtrOmitEmpty",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
*structInt64PtrOmitEmpty
|
|
|
|
B *int64 `json:"b,omitempty"`
|
|
|
|
}{
|
|
|
|
structInt64PtrOmitEmpty: nil,
|
|
|
|
B: int64ptr(2),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "NilPtrAnonymousHeadInt64PtrString",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
*structInt64PtrString
|
|
|
|
B *int64 `json:"b,string"`
|
|
|
|
}{
|
|
|
|
structInt64PtrString: nil,
|
|
|
|
B: int64ptr(2),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// AnonymousHeadInt64Only
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "AnonymousHeadInt64Only",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
structInt64
|
|
|
|
}{
|
2021-02-19 09:08:30 +03:00
|
|
|
structInt64: structInt64{A: -1},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
},
|
2021-01-18 16:35:10 +03:00
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "AnonymousHeadInt64OnlyOmitEmpty",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
structInt64OmitEmpty
|
|
|
|
}{
|
2021-02-19 09:08:30 +03:00
|
|
|
structInt64OmitEmpty: structInt64OmitEmpty{A: -1},
|
2021-01-18 16:35:10 +03:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "AnonymousHeadInt64OnlyString",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
structInt64String
|
|
|
|
}{
|
2021-02-19 09:08:30 +03:00
|
|
|
structInt64String: structInt64String{A: -1},
|
2021-01-18 16:35:10 +03:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrAnonymousHeadInt64Only
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrAnonymousHeadInt64Only",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
*structInt64
|
|
|
|
}{
|
2021-02-19 09:08:30 +03:00
|
|
|
structInt64: &structInt64{A: -1},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
},
|
2021-01-18 16:35:10 +03:00
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrAnonymousHeadInt64OnlyOmitEmpty",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
*structInt64OmitEmpty
|
|
|
|
}{
|
2021-02-19 09:08:30 +03:00
|
|
|
structInt64OmitEmpty: &structInt64OmitEmpty{A: -1},
|
2021-01-18 16:35:10 +03:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrAnonymousHeadInt64OnlyString",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
*structInt64String
|
|
|
|
}{
|
2021-02-19 09:08:30 +03:00
|
|
|
structInt64String: &structInt64String{A: -1},
|
2021-01-18 16:35:10 +03:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// NilPtrAnonymousHeadInt64Only
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "NilPtrAnonymousHeadInt64Only",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
*structInt64
|
|
|
|
}{
|
|
|
|
structInt64: nil,
|
|
|
|
},
|
|
|
|
},
|
2021-01-18 16:35:10 +03:00
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "NilPtrAnonymousHeadInt64OnlyOmitEmpty",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
*structInt64OmitEmpty
|
|
|
|
}{
|
|
|
|
structInt64OmitEmpty: nil,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "NilPtrAnonymousHeadInt64OnlyString",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
*structInt64String
|
|
|
|
}{
|
|
|
|
structInt64String: nil,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// AnonymousHeadInt64PtrOnly
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "AnonymousHeadInt64PtrOnly",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
structInt64Ptr
|
|
|
|
}{
|
2021-02-19 09:08:30 +03:00
|
|
|
structInt64Ptr: structInt64Ptr{A: int64ptr(-1)},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
},
|
2021-01-18 16:35:10 +03:00
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "AnonymousHeadInt64PtrOnlyOmitEmpty",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
structInt64PtrOmitEmpty
|
|
|
|
}{
|
2021-02-19 09:08:30 +03:00
|
|
|
structInt64PtrOmitEmpty: structInt64PtrOmitEmpty{A: int64ptr(-1)},
|
2021-01-18 16:35:10 +03:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "AnonymousHeadInt64PtrOnlyString",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
structInt64PtrString
|
|
|
|
}{
|
2021-02-19 09:08:30 +03:00
|
|
|
structInt64PtrString: structInt64PtrString{A: int64ptr(-1)},
|
2021-01-18 16:35:10 +03:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// AnonymousHeadInt64PtrNilOnly
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "AnonymousHeadInt64PtrNilOnly",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
structInt64Ptr
|
|
|
|
}{
|
|
|
|
structInt64Ptr: structInt64Ptr{A: nil},
|
|
|
|
},
|
|
|
|
},
|
2021-01-18 16:35:10 +03:00
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "AnonymousHeadInt64PtrNilOnlyOmitEmpty",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
structInt64PtrOmitEmpty
|
|
|
|
}{
|
|
|
|
structInt64PtrOmitEmpty: structInt64PtrOmitEmpty{A: nil},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "AnonymousHeadInt64PtrNilOnlyString",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
structInt64PtrString
|
|
|
|
}{
|
|
|
|
structInt64PtrString: structInt64PtrString{A: nil},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrAnonymousHeadInt64PtrOnly
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrAnonymousHeadInt64PtrOnly",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
*structInt64Ptr
|
|
|
|
}{
|
2021-02-19 09:08:30 +03:00
|
|
|
structInt64Ptr: &structInt64Ptr{A: int64ptr(-1)},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
},
|
2021-01-18 16:35:10 +03:00
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrAnonymousHeadInt64PtrOnlyOmitEmpty",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
*structInt64PtrOmitEmpty
|
|
|
|
}{
|
2021-02-19 09:08:30 +03:00
|
|
|
structInt64PtrOmitEmpty: &structInt64PtrOmitEmpty{A: int64ptr(-1)},
|
2021-01-18 16:35:10 +03:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "PtrAnonymousHeadInt64PtrOnlyString",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
*structInt64PtrString
|
|
|
|
}{
|
2021-02-19 09:08:30 +03:00
|
|
|
structInt64PtrString: &structInt64PtrString{A: int64ptr(-1)},
|
2021-01-18 16:35:10 +03:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// NilPtrAnonymousHeadInt64PtrOnly
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "NilPtrAnonymousHeadInt64PtrOnly",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
*structInt64Ptr
|
|
|
|
}{
|
|
|
|
structInt64Ptr: nil,
|
|
|
|
},
|
|
|
|
},
|
2021-01-18 16:35:10 +03:00
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "NilPtrAnonymousHeadInt64PtrOnlyOmitEmpty",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
*structInt64PtrOmitEmpty
|
|
|
|
}{
|
|
|
|
structInt64PtrOmitEmpty: nil,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:20:23 +03:00
|
|
|
name: "NilPtrAnonymousHeadInt64PtrOnlyString",
|
2021-01-18 16:35:10 +03:00
|
|
|
data: struct {
|
|
|
|
*structInt64PtrString
|
|
|
|
}{
|
|
|
|
structInt64PtrString: 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-15 05:20:23 +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
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|