go-json/test/cover/cover_int_test.go

2430 lines
48 KiB
Go
Raw Normal View History

2021-01-16 16:16:26 +03:00
package json_test
import (
"bytes"
"testing"
"github.com/goccy/go-json"
)
func TestCoverInt(t *testing.T) {
type structInt struct {
A int `json:"a"`
}
type structIntOmitEmpty struct {
A int `json:"a,omitempty"`
}
type structIntString struct {
A int `json:"a,string"`
}
2021-05-06 18:55:15 +03:00
type structIntStringOmitEmpty struct {
A int `json:"a,omitempty,string"`
}
2021-01-16 16:16:26 +03:00
type structIntPtr struct {
A *int `json:"a"`
}
type structIntPtrOmitEmpty struct {
A *int `json:"a,omitempty"`
}
type structIntPtrString struct {
A *int `json:"a,string"`
}
2021-05-06 18:55:15 +03:00
type structIntPtrStringOmitEmpty struct {
A *int `json:"a,omitempty,string"`
}
2021-01-16 16:16:26 +03:00
tests := []struct {
2021-02-14 20:08:05 +03:00
name string
data interface{}
2021-01-16 16:16:26 +03:00
}{
2021-03-19 17:31:29 +03:00
{
name: "Int",
data: 10,
},
{
name: "IntPtr",
data: intptr(10),
},
{
name: "IntPtr3",
data: intptr3(10),
},
{
name: "IntPtrNil",
data: (*int)(nil),
},
{
name: "IntPtr3Nil",
data: (***int)(nil),
},
2021-01-16 16:16:26 +03:00
// HeadIntZero
{
2021-02-14 20:08:05 +03:00
name: "HeadIntZero",
2021-01-16 16:16:26 +03:00
data: struct {
A int `json:"a"`
}{},
},
{
2021-02-14 20:08:05 +03:00
name: "HeadIntZeroOmitEmpty",
2021-01-16 16:16:26 +03:00
data: struct {
A int `json:"a,omitempty"`
}{},
},
{
2021-02-14 20:08:05 +03:00
name: "HeadIntZeroString",
2021-01-16 16:16:26 +03:00
data: struct {
A int `json:"a,string"`
}{},
},
// HeadInt
{
2021-02-14 20:08:05 +03:00
name: "HeadInt",
2021-01-16 16:16:26 +03:00
data: struct {
A int `json:"a"`
2021-02-19 09:13:33 +03:00
}{A: -1},
2021-01-16 16:16:26 +03:00
},
{
2021-02-14 20:08:05 +03:00
name: "HeadIntOmitEmpty",
2021-01-16 16:16:26 +03:00
data: struct {
A int `json:"a,omitempty"`
2021-02-19 09:13:33 +03:00
}{A: -1},
2021-01-16 16:16:26 +03:00
},
{
2021-02-14 20:08:05 +03:00
name: "HeadIntString",
2021-01-16 16:16:26 +03:00
data: struct {
A int `json:"a,string"`
2021-02-19 09:13:33 +03:00
}{A: -1},
2021-01-16 16:16:26 +03:00
},
// HeadIntPtr
{
2021-02-14 20:08:05 +03:00
name: "HeadIntPtr",
2021-01-16 16:16:26 +03:00
data: struct {
A *int `json:"a"`
2021-02-19 09:13:33 +03:00
}{A: intptr(-1)},
2021-01-16 16:16:26 +03:00
},
{
2021-02-14 20:08:05 +03:00
name: "HeadIntPtrOmitEmpty",
2021-01-16 16:16:26 +03:00
data: struct {
A *int `json:"a,omitempty"`
2021-02-19 09:13:33 +03:00
}{A: intptr(-1)},
2021-01-16 16:16:26 +03:00
},
{
2021-02-14 20:08:05 +03:00
name: "HeadIntPtrString",
2021-01-16 16:16:26 +03:00
data: struct {
A *int `json:"a,string"`
2021-02-19 09:13:33 +03:00
}{A: intptr(-1)},
2021-01-16 16:16:26 +03:00
},
// HeadIntPtrNil
{
2021-02-14 20:08:05 +03:00
name: "HeadIntPtrNil",
2021-01-16 16:16:26 +03:00
data: struct {
A *int `json:"a"`
}{A: nil},
},
{
2021-02-14 20:08:05 +03:00
name: "HeadIntPtrNilOmitEmpty",
2021-01-16 16:16:26 +03:00
data: struct {
A *int `json:"a,omitempty"`
}{A: nil},
},
{
2021-02-14 20:08:05 +03:00
name: "HeadIntPtrNilString",
2021-01-16 16:16:26 +03:00
data: struct {
A *int `json:"a,string"`
}{A: nil},
},
// PtrHeadIntZero
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntZero",
2021-01-16 16:16:26 +03:00
data: &struct {
A int `json:"a"`
}{},
},
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntZeroOmitEmpty",
2021-01-16 16:16:26 +03:00
data: &struct {
A int `json:"a,omitempty"`
}{},
},
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntZeroString",
2021-01-16 16:16:26 +03:00
data: &struct {
A int `json:"a,string"`
}{},
},
2021-05-06 18:55:15 +03:00
{
name: "PtrHeadIntZeroStringOmitEmpty",
data: &struct {
A int `json:"a,string,omitempty"`
}{},
},
2021-01-16 16:16:26 +03:00
// PtrHeadInt
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadInt",
2021-01-16 16:16:26 +03:00
data: &struct {
A int `json:"a"`
2021-02-19 09:13:33 +03:00
}{A: -1},
2021-01-16 16:16:26 +03:00
},
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntOmitEmpty",
2021-01-16 16:16:26 +03:00
data: &struct {
A int `json:"a,omitempty"`
2021-02-19 09:13:33 +03:00
}{A: -1},
2021-01-16 16:16:26 +03:00
},
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntString",
2021-01-16 16:16:26 +03:00
data: &struct {
A int `json:"a,string"`
2021-02-19 09:13:33 +03:00
}{A: -1},
2021-01-16 16:16:26 +03:00
},
2021-05-06 19:39:58 +03:00
{
name: "PtrHeadIntStringOmitEmpty",
data: &struct {
A int `json:"a,string,omitempty"`
}{A: -1},
},
2021-01-16 16:16:26 +03:00
// PtrHeadIntPtr
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntPtr",
2021-01-16 16:16:26 +03:00
data: &struct {
A *int `json:"a"`
2021-02-19 09:13:33 +03:00
}{A: intptr(-1)},
2021-01-16 16:16:26 +03:00
},
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntPtrOmitEmpty",
2021-01-16 16:16:26 +03:00
data: &struct {
A *int `json:"a,omitempty"`
2021-02-19 09:13:33 +03:00
}{A: intptr(-1)},
2021-01-16 16:16:26 +03:00
},
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntPtrString",
2021-01-16 16:16:26 +03:00
data: &struct {
A *int `json:"a,string"`
2021-02-19 09:13:33 +03:00
}{A: intptr(-1)},
2021-01-16 16:16:26 +03:00
},
2021-05-06 19:39:58 +03:00
{
name: "PtrHeadIntPtrStringOmitEmpty",
data: &struct {
A *int `json:"a,string,omitempty"`
}{A: intptr(-1)},
},
2021-01-16 16:16:26 +03:00
// PtrHeadIntPtrNil
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntPtrNil",
2021-01-16 16:16:26 +03:00
data: &struct {
A *int `json:"a"`
}{A: nil},
},
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntPtrNilOmitEmpty",
2021-01-16 16:16:26 +03:00
data: &struct {
A *int `json:"a,omitempty"`
}{A: nil},
},
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntPtrNilString",
2021-01-16 16:16:26 +03:00
data: &struct {
A *int `json:"a,string"`
}{A: nil},
},
2021-05-06 19:39:58 +03:00
{
name: "PtrHeadIntPtrNilStringOmitEmpty",
data: &struct {
A *int `json:"a,string,omitempty"`
}{A: nil},
},
2021-01-16 16:16:26 +03:00
// PtrHeadIntNil
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntNil",
2021-01-16 16:16:26 +03:00
data: (*struct {
A *int `json:"a"`
})(nil),
},
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntNilOmitEmpty",
2021-01-16 16:16:26 +03:00
data: (*struct {
A *int `json:"a,omitempty"`
})(nil),
},
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntNilString",
2021-01-16 16:16:26 +03:00
data: (*struct {
A *int `json:"a,string"`
})(nil),
},
2021-05-06 19:39:58 +03:00
{
name: "PtrHeadIntNilStringOmitEmpty",
data: (*struct {
A *int `json:"a,string,omitempty"`
})(nil),
},
2021-01-16 16:16:26 +03:00
// HeadIntZeroMultiFields
{
2021-02-14 20:08:05 +03:00
name: "HeadIntZeroMultiFields",
2021-01-16 16:16:26 +03:00
data: struct {
A int `json:"a"`
B int `json:"b"`
2021-02-14 20:08:05 +03:00
C int `json:"c"`
2021-01-16 16:16:26 +03:00
}{},
},
{
2021-02-14 20:08:05 +03:00
name: "HeadIntZeroMultiFieldsOmitEmpty",
2021-01-16 16:16:26 +03:00
data: struct {
A int `json:"a,omitempty"`
B int `json:"b,omitempty"`
2021-02-14 20:08:05 +03:00
C int `json:"c,omitempty"`
2021-01-16 16:16:26 +03:00
}{},
},
{
2021-05-06 19:39:58 +03:00
name: "HeadIntZeroMultiFieldsString",
2021-01-16 16:16:26 +03:00
data: struct {
A int `json:"a,string"`
B int `json:"b,string"`
2021-02-14 20:08:05 +03:00
C int `json:"c,string"`
2021-01-16 16:16:26 +03:00
}{},
},
2021-05-06 19:39:58 +03:00
{
name: "HeadIntZeroMultiFieldsStringOmitEmpty",
data: struct {
A int `json:"a,string,omitempty"`
B int `json:"b,string,omitempty"`
C int `json:"c,string,omitempty"`
}{},
},
2021-01-16 16:16:26 +03:00
// HeadIntMultiFields
{
2021-02-14 20:08:05 +03:00
name: "HeadIntMultiFields",
2021-01-16 16:16:26 +03:00
data: struct {
A int `json:"a"`
B int `json:"b"`
2021-02-14 20:08:05 +03:00
C int `json:"c"`
2021-02-19 09:13:33 +03:00
}{A: -1, B: 2, C: 3},
2021-01-16 16:16:26 +03:00
},
{
2021-02-14 20:08:05 +03:00
name: "HeadIntMultiFieldsOmitEmpty",
2021-01-16 16:16:26 +03:00
data: struct {
A int `json:"a,omitempty"`
B int `json:"b,omitempty"`
2021-02-14 20:08:05 +03:00
C int `json:"c,omitempty"`
2021-02-19 09:13:33 +03:00
}{A: -1, B: 2, C: 3},
2021-01-16 16:16:26 +03:00
},
{
2021-02-14 20:08:05 +03:00
name: "HeadIntMultiFieldsString",
2021-01-16 16:16:26 +03:00
data: struct {
A int `json:"a,string"`
B int `json:"b,string"`
2021-02-14 20:08:05 +03:00
C int `json:"c,string"`
2021-02-19 09:13:33 +03:00
}{A: -1, B: 2, C: 3},
2021-01-16 16:16:26 +03:00
},
2021-05-06 19:39:58 +03:00
{
name: "HeadIntMultiFieldsStringOmitEmpty",
data: struct {
A int `json:"a,string,omitempty"`
B int `json:"b,string,omitempty"`
C int `json:"c,string,omitempty"`
}{A: -1, B: 2, C: 3},
},
2021-01-16 16:16:26 +03:00
// HeadIntPtrMultiFields
{
2021-02-14 20:08:05 +03:00
name: "HeadIntPtrMultiFields",
2021-01-16 16:16:26 +03:00
data: struct {
A *int `json:"a"`
B *int `json:"b"`
2021-02-14 20:08:05 +03:00
C *int `json:"c"`
2021-02-19 09:13:33 +03:00
}{A: intptr(-1), B: intptr(2), C: intptr(3)},
2021-01-16 16:16:26 +03:00
},
{
2021-02-14 20:08:05 +03:00
name: "HeadIntPtrMultiFieldsOmitEmpty",
2021-01-16 16:16:26 +03:00
data: struct {
A *int `json:"a,omitempty"`
B *int `json:"b,omitempty"`
2021-02-14 20:08:05 +03:00
C *int `json:"c,omitempty"`
2021-02-19 09:13:33 +03:00
}{A: intptr(-1), B: intptr(2), C: intptr(3)},
2021-01-16 16:16:26 +03:00
},
{
2021-02-14 20:08:05 +03:00
name: "HeadIntPtrMultiFieldsString",
2021-01-16 16:16:26 +03:00
data: struct {
A *int `json:"a,string"`
B *int `json:"b,string"`
2021-02-14 20:08:05 +03:00
C *int `json:"c,string"`
2021-02-19 09:13:33 +03:00
}{A: intptr(-1), B: intptr(2), C: intptr(3)},
2021-01-16 16:16:26 +03:00
},
2021-05-06 19:39:58 +03:00
{
name: "HeadIntPtrMultiFieldsStringOmitEmpty",
data: struct {
A *int `json:"a,string,omitempty"`
B *int `json:"b,string,omitempty"`
C *int `json:"c,string,omitempty"`
}{A: intptr(-1), B: intptr(2), C: intptr(3)},
},
2021-01-16 16:16:26 +03:00
// HeadIntPtrNilMultiFields
{
2021-02-14 20:08:05 +03:00
name: "HeadIntPtrNilMultiFields",
2021-01-16 16:16:26 +03:00
data: struct {
A *int `json:"a"`
B *int `json:"b"`
2021-02-14 20:08:05 +03:00
C *int `json:"c"`
}{A: nil, B: nil, C: nil},
2021-01-16 16:16:26 +03:00
},
{
2021-02-14 20:08:05 +03:00
name: "HeadIntPtrNilMultiFieldsOmitEmpty",
2021-01-16 16:16:26 +03:00
data: struct {
A *int `json:"a,omitempty"`
B *int `json:"b,omitempty"`
2021-02-14 20:08:05 +03:00
C *int `json:"c,omitempty"`
}{A: nil, B: nil, C: nil},
2021-01-16 16:16:26 +03:00
},
{
2021-02-14 20:08:05 +03:00
name: "HeadIntPtrNilMultiFieldsString",
2021-01-16 16:16:26 +03:00
data: struct {
A *int `json:"a,string"`
B *int `json:"b,string"`
2021-02-14 20:08:05 +03:00
C *int `json:"c,string"`
}{A: nil, B: nil, C: nil},
2021-01-16 16:16:26 +03:00
},
2021-05-06 19:39:58 +03:00
{
name: "HeadIntPtrNilMultiFieldsStringOmitEmpty",
data: struct {
A *int `json:"a,string,omitempty"`
B *int `json:"b,string,omitempty"`
C *int `json:"c,string,omitempty"`
}{A: nil, B: nil, C: nil},
},
2021-01-16 16:16:26 +03:00
// PtrHeadIntZeroMultiFields
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntZeroMultiFields",
2021-01-16 16:16:26 +03:00
data: &struct {
A int `json:"a"`
B int `json:"b"`
}{},
},
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntZeroMultiFieldsOmitEmpty",
2021-01-16 16:16:26 +03:00
data: &struct {
A int `json:"a,omitempty"`
B int `json:"b,omitempty"`
}{},
},
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntZeroMultiFieldsString",
2021-01-16 16:16:26 +03:00
data: &struct {
A int `json:"a,string"`
B int `json:"b,string"`
}{},
},
2021-05-06 19:39:58 +03:00
{
name: "PtrHeadIntZeroMultiFieldsStringOmitEmpty",
data: &struct {
A int `json:"a,string,omitempty"`
B int `json:"b,string,omitempty"`
}{},
},
2021-01-16 16:16:26 +03:00
// PtrHeadIntMultiFields
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntMultiFields",
2021-01-16 16:16:26 +03:00
data: &struct {
A int `json:"a"`
B int `json:"b"`
2021-02-19 09:13:33 +03:00
}{A: -1, B: 2},
2021-01-16 16:16:26 +03:00
},
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntMultiFieldsOmitEmpty",
2021-01-16 16:16:26 +03:00
data: &struct {
A int `json:"a,omitempty"`
B int `json:"b,omitempty"`
2021-02-19 09:13:33 +03:00
}{A: -1, B: 2},
2021-01-16 16:16:26 +03:00
},
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntMultiFieldsString",
2021-01-16 16:16:26 +03:00
data: &struct {
A int `json:"a,string"`
B int `json:"b,string"`
2021-02-19 09:13:33 +03:00
}{A: -1, B: 2},
2021-01-16 16:16:26 +03:00
},
2021-05-06 19:39:58 +03:00
{
name: "PtrHeadIntMultiFieldsStringOmitEmpty",
data: &struct {
A int `json:"a,string,omitempty"`
B int `json:"b,string,omitempty"`
}{A: -1, B: 2},
},
2021-01-16 16:16:26 +03:00
// PtrHeadIntPtrMultiFields
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntPtrMultiFields",
2021-01-16 16:16:26 +03:00
data: &struct {
A *int `json:"a"`
B *int `json:"b"`
2021-02-19 09:13:33 +03:00
}{A: intptr(-1), B: intptr(2)},
2021-01-16 16:16:26 +03:00
},
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntPtrMultiFieldsOmitEmpty",
2021-01-16 16:16:26 +03:00
data: &struct {
A *int `json:"a,omitempty"`
B *int `json:"b,omitempty"`
2021-02-19 09:13:33 +03:00
}{A: intptr(-1), B: intptr(2)},
2021-01-16 16:16:26 +03:00
},
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntPtrMultiFieldsString",
2021-01-16 16:16:26 +03:00
data: &struct {
A *int `json:"a,string"`
B *int `json:"b,string"`
2021-02-19 09:13:33 +03:00
}{A: intptr(-1), B: intptr(2)},
2021-01-16 16:16:26 +03:00
},
2021-05-06 19:39:58 +03:00
{
name: "PtrHeadIntPtrMultiFieldsStringOmitEmpty",
data: &struct {
A *int `json:"a,string,omitempty"`
B *int `json:"b,string,omitempty"`
}{A: intptr(-1), B: intptr(2)},
},
2021-01-16 16:16:26 +03:00
// PtrHeadIntPtrNilMultiFields
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntPtrNilMultiFields",
2021-01-16 16:16:26 +03:00
data: &struct {
A *int `json:"a"`
B *int `json:"b"`
}{A: nil, B: nil},
},
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntPtrNilMultiFieldsOmitEmpty",
2021-01-16 16:16:26 +03:00
data: &struct {
A *int `json:"a,omitempty"`
B *int `json:"b,omitempty"`
}{A: nil, B: nil},
},
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntPtrNilMultiFieldsString",
2021-01-16 16:16:26 +03:00
data: &struct {
A *int `json:"a,string"`
B *int `json:"b,string"`
}{A: nil, B: nil},
},
2021-05-06 19:39:58 +03:00
{
name: "PtrHeadIntPtrNilMultiFieldsStringOmitEmpty",
data: &struct {
A *int `json:"a,string,omitempty"`
B *int `json:"b,string,omitempty"`
}{A: nil, B: nil},
},
2021-01-16 16:16:26 +03:00
// PtrHeadIntNilMultiFields
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntNilMultiFields",
2021-01-16 16:16:26 +03:00
data: (*struct {
A *int `json:"a"`
B *int `json:"b"`
})(nil),
},
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntNilMultiFieldsOmitEmpty",
2021-01-16 16:16:26 +03:00
data: (*struct {
A *int `json:"a,omitempty"`
B *int `json:"b,omitempty"`
})(nil),
},
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntNilMultiFieldsString",
2021-01-16 16:16:26 +03:00
data: (*struct {
A *int `json:"a,string"`
B *int `json:"b,string"`
})(nil),
},
2021-05-06 19:39:58 +03:00
{
name: "PtrHeadIntNilMultiFieldsStringOmitEmpty",
data: (*struct {
A *int `json:"a,string,omitempty"`
B *int `json:"b,string,omitempty"`
})(nil),
},
2021-01-16 16:16:26 +03:00
// HeadIntZeroNotRoot
{
2021-02-14 20:08:05 +03:00
name: "HeadIntZeroNotRoot",
2021-01-16 16:16:26 +03:00
data: struct {
A struct {
A int `json:"a"`
}
}{},
},
{
2021-02-14 20:08:05 +03:00
name: "HeadIntZeroNotRootOmitEmpty",
2021-01-16 16:16:26 +03:00
data: struct {
A struct {
A int `json:"a,omitempty"`
}
}{},
},
{
2021-02-14 20:08:05 +03:00
name: "HeadIntZeroNotRootString",
2021-01-16 16:16:26 +03:00
data: struct {
A struct {
A int `json:"a,string"`
}
}{},
},
2021-05-06 19:39:58 +03:00
{
name: "HeadIntZeroNotRootStringOmitEmpty",
data: struct {
A struct {
A int `json:"a,string,omitempty"`
}
}{},
},
2021-01-16 16:16:26 +03:00
// HeadIntNotRoot
{
2021-02-14 20:08:05 +03:00
name: "HeadIntNotRoot",
2021-01-16 16:16:26 +03:00
data: struct {
A struct {
A int `json:"a"`
}
}{A: struct {
A int `json:"a"`
2021-02-19 09:13:33 +03:00
}{A: -1}},
2021-01-16 16:16:26 +03:00
},
{
2021-02-14 20:08:05 +03:00
name: "HeadIntNotRootOmitEmpty",
2021-01-16 16:16:26 +03:00
data: struct {
A struct {
A int `json:"a,omitempty"`
}
}{A: struct {
A int `json:"a,omitempty"`
2021-02-19 09:13:33 +03:00
}{A: -1}},
2021-01-16 16:16:26 +03:00
},
{
2021-02-14 20:08:05 +03:00
name: "HeadIntNotRootString",
2021-01-16 16:16:26 +03:00
data: struct {
A struct {
A int `json:"a,string"`
}
}{A: struct {
A int `json:"a,string"`
2021-02-19 09:13:33 +03:00
}{A: -1}},
2021-01-16 16:16:26 +03:00
},
2021-05-06 19:39:58 +03:00
{
name: "HeadIntNotRootStringOmitEmpty",
data: struct {
A struct {
A int `json:"a,string,omitempty"`
}
}{A: struct {
A int `json:"a,string,omitempty"`
}{A: -1}},
},
2021-01-16 16:16:26 +03:00
2021-07-05 14:30:35 +03:00
// HeadIntNotRootMultiFields
{
name: "HeadIntNotRootMultiFields",
data: struct {
A struct {
A int `json:"a"`
B int `json:"b"`
}
}{A: struct {
A int `json:"a"`
B int `json:"b"`
}{A: -1, B: 1}},
},
{
name: "HeadIntNotRootOmitEmptyMultiFields",
data: struct {
A struct {
A int `json:"a,omitempty"`
B int `json:"b,omitempty"`
}
}{A: struct {
A int `json:"a,omitempty"`
B int `json:"b,omitempty"`
}{A: -1, B: 1}},
},
{
name: "HeadIntNotRootStringMultiFields",
data: struct {
A struct {
A int `json:"a,string"`
B int `json:"b,string"`
}
}{A: struct {
A int `json:"a,string"`
B int `json:"b,string"`
}{A: -1, B: 1}},
},
{
name: "HeadIntNotRootStringOmitEmptyMultiFields",
data: struct {
A struct {
A int `json:"a,string,omitempty"`
B int `json:"b,string,omitempty"`
}
}{A: struct {
A int `json:"a,string,omitempty"`
B int `json:"b,string,omitempty"`
}{A: -1, B: 1}},
},
2021-01-16 16:16:26 +03:00
// HeadIntPtrNotRoot
{
2021-02-14 20:08:05 +03:00
name: "HeadIntPtrNotRoot",
2021-01-16 16:16:26 +03:00
data: struct {
A struct {
A *int `json:"a"`
}
}{A: struct {
A *int `json:"a"`
2021-02-19 09:13:33 +03:00
}{intptr(-1)}},
2021-01-16 16:16:26 +03:00
},
{
2021-02-14 20:08:05 +03:00
name: "HeadIntPtrNotRootOmitEmpty",
2021-01-16 16:16:26 +03:00
data: struct {
A struct {
A *int `json:"a,omitempty"`
}
}{A: struct {
A *int `json:"a,omitempty"`
2021-02-19 09:13:33 +03:00
}{intptr(-1)}},
2021-01-16 16:16:26 +03:00
},
{
2021-02-14 20:08:05 +03:00
name: "HeadIntPtrNotRootString",
2021-01-16 16:16:26 +03:00
data: struct {
A struct {
A *int `json:"a,string"`
}
}{A: struct {
A *int `json:"a,string"`
2021-02-19 09:13:33 +03:00
}{intptr(-1)}},
2021-01-16 16:16:26 +03:00
},
2021-05-06 19:39:58 +03:00
{
name: "HeadIntPtrNotRootStringOmitEmpty",
data: struct {
A struct {
A *int `json:"a,string,omitempty"`
}
}{A: struct {
A *int `json:"a,string,omitempty"`
}{intptr(-1)}},
},
2021-01-16 16:16:26 +03:00
// HeadIntPtrNilNotRoot
{
2021-02-14 20:08:05 +03:00
name: "HeadIntPtrNilNotRoot",
2021-01-16 16:16:26 +03:00
data: struct {
A struct {
A *int `json:"a"`
}
}{},
},
{
2021-02-14 20:08:05 +03:00
name: "HeadIntPtrNilNotRootOmitEmpty",
2021-01-16 16:16:26 +03:00
data: struct {
A struct {
A *int `json:"a,omitempty"`
}
}{},
},
{
2021-02-14 20:08:05 +03:00
name: "HeadIntPtrNilNotRootString",
2021-01-16 16:16:26 +03:00
data: struct {
A struct {
A *int `json:"a,string"`
}
}{},
},
2021-05-06 19:39:58 +03:00
{
name: "HeadIntPtrNilNotRootStringOmitEmpty",
data: struct {
A struct {
A *int `json:"a,string,omitempty"`
}
}{},
},
2021-01-16 16:16:26 +03:00
// PtrHeadIntZeroNotRoot
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntZeroNotRoot",
2021-01-16 16:16:26 +03:00
data: struct {
A *struct {
A int `json:"a"`
}
}{A: new(struct {
A int `json:"a"`
})},
},
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntZeroNotRootOmitEmpty",
2021-01-16 16:16:26 +03:00
data: struct {
A *struct {
A int `json:"a,omitempty"`
}
}{A: new(struct {
A int `json:"a,omitempty"`
})},
},
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntZeroNotRootString",
2021-01-16 16:16:26 +03:00
data: struct {
A *struct {
A int `json:"a,string"`
}
}{A: new(struct {
A int `json:"a,string"`
})},
},
2021-05-06 19:39:58 +03:00
{
name: "PtrHeadIntZeroNotRootStringOmitEmpty",
data: struct {
A *struct {
A int `json:"a,string,omitempty"`
}
}{A: new(struct {
A int `json:"a,string,omitempty"`
})},
},
2021-01-16 16:16:26 +03:00
// PtrHeadIntNotRoot
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntNotRoot",
2021-01-16 16:16:26 +03:00
data: struct {
A *struct {
A int `json:"a"`
}
}{A: &(struct {
A int `json:"a"`
2021-02-19 09:13:33 +03:00
}{A: -1})},
2021-01-16 16:16:26 +03:00
},
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntNotRootOmitEmpty",
2021-01-16 16:16:26 +03:00
data: struct {
A *struct {
A int `json:"a,omitempty"`
}
}{A: &(struct {
A int `json:"a,omitempty"`
2021-02-19 09:13:33 +03:00
}{A: -1})},
2021-01-16 16:16:26 +03:00
},
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntNotRootString",
2021-01-16 16:16:26 +03:00
data: struct {
A *struct {
A int `json:"a,string"`
}
}{A: &(struct {
A int `json:"a,string"`
2021-02-19 09:13:33 +03:00
}{A: -1})},
2021-01-16 16:16:26 +03:00
},
2021-05-06 19:39:58 +03:00
{
name: "PtrHeadIntNotRootStringOmitEmpty",
data: struct {
A *struct {
A int `json:"a,string,omitempty"`
}
}{A: &(struct {
A int `json:"a,string,omitempty"`
}{A: -1})},
},
2021-01-16 16:16:26 +03:00
2021-07-05 14:30:35 +03:00
// PtrHeadIntNotRootMultiFields
{
name: "PtrHeadIntNotRootMultiFields",
data: struct {
A *struct {
A int `json:"a"`
B int `json:"b"`
}
}{A: &(struct {
A int `json:"a"`
B int `json:"b"`
}{A: -1, B: 1})},
},
{
name: "PtrHeadIntNotRootOmitEmptyMultiFields",
data: struct {
A *struct {
A int `json:"a,omitempty"`
B int `json:"b,omitempty"`
}
}{A: &(struct {
A int `json:"a,omitempty"`
B int `json:"b,omitempty"`
}{A: -1, B: 1})},
},
{
name: "PtrHeadIntNotRootStringMultiFields",
data: struct {
A *struct {
A int `json:"a,string"`
B int `json:"b,string"`
}
}{A: &(struct {
A int `json:"a,string"`
B int `json:"b,string"`
}{A: -1, B: 1})},
},
{
name: "PtrHeadIntNotRootStringOmitEmptyMultiFields",
data: struct {
A *struct {
A int `json:"a,string,omitempty"`
B int `json:"b,string,omitempty"`
}
}{A: &(struct {
A int `json:"a,string,omitempty"`
B int `json:"b,string,omitempty"`
}{A: -1, B: 1})},
},
2021-01-16 16:16:26 +03:00
// PtrHeadIntPtrNotRoot
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntPtrNotRoot",
2021-01-16 16:16:26 +03:00
data: struct {
A *struct {
A *int `json:"a"`
}
}{A: &(struct {
A *int `json:"a"`
2021-02-19 09:13:33 +03:00
}{A: intptr(-1)})},
2021-01-16 16:16:26 +03:00
},
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntPtrNotRootOmitEmpty",
2021-01-16 16:16:26 +03:00
data: struct {
A *struct {
A *int `json:"a,omitempty"`
}
}{A: &(struct {
A *int `json:"a,omitempty"`
2021-02-19 09:13:33 +03:00
}{A: intptr(-1)})},
2021-01-16 16:16:26 +03:00
},
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntPtrNotRootString",
2021-01-16 16:16:26 +03:00
data: struct {
A *struct {
A *int `json:"a,string"`
}
}{A: &(struct {
A *int `json:"a,string"`
2021-02-19 09:13:33 +03:00
}{A: intptr(-1)})},
2021-01-16 16:16:26 +03:00
},
2021-05-06 19:39:58 +03:00
{
name: "PtrHeadIntPtrNotRootStringOmitEmpty",
data: struct {
A *struct {
A *int `json:"a,string,omitempty"`
}
}{A: &(struct {
A *int `json:"a,string,omitempty"`
}{A: intptr(-1)})},
},
2021-01-16 16:16:26 +03:00
// PtrHeadIntPtrNilNotRoot
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntPtrNilNotRoot",
2021-01-16 16:16:26 +03:00
data: struct {
A *struct {
A *int `json:"a"`
}
}{A: &(struct {
A *int `json:"a"`
}{A: nil})},
},
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntPtrNilNotRootOmitEmpty",
2021-01-16 16:16:26 +03:00
data: struct {
A *struct {
A *int `json:"a,omitempty"`
}
}{A: &(struct {
A *int `json:"a,omitempty"`
}{A: nil})},
},
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntPtrNilNotRootString",
2021-01-16 16:16:26 +03:00
data: struct {
A *struct {
A *int `json:"a,string"`
}
}{A: &(struct {
A *int `json:"a,string"`
}{A: nil})},
},
2021-05-06 19:39:58 +03:00
{
name: "PtrHeadIntPtrNilNotRootStringOmitEmpty",
data: struct {
A *struct {
A *int `json:"a,string,omitempty"`
}
}{A: &(struct {
A *int `json:"a,string,omitempty"`
}{A: nil})},
},
2021-01-16 16:16:26 +03:00
// PtrHeadIntNilNotRoot
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntNilNotRoot",
2021-01-16 16:16:26 +03:00
data: struct {
A *struct {
A *int `json:"a"`
}
}{A: nil},
},
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntNilNotRootOmitEmpty",
2021-01-16 16:16:26 +03:00
data: struct {
A *struct {
A *int `json:"a,omitempty"`
} `json:",omitempty"`
}{A: nil},
},
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntNilNotRootString",
2021-01-16 16:16:26 +03:00
data: struct {
A *struct {
A *int `json:"a,string"`
} `json:",string"`
}{A: nil},
},
2021-05-06 19:39:58 +03:00
{
name: "PtrHeadIntNilNotRootStringOmitEmpty",
data: struct {
A *struct {
A *int `json:"a,string,omitempty"`
} `json:",string,omitempty"`
}{A: nil},
},
2021-01-16 16:16:26 +03:00
// HeadIntZeroMultiFieldsNotRoot
{
2021-02-14 20:08:05 +03:00
name: "HeadIntZeroMultiFieldsNotRoot",
2021-01-16 16:16:26 +03:00
data: struct {
A struct {
A int `json:"a"`
}
B struct {
B int `json:"b"`
}
}{},
},
{
2021-02-14 20:08:05 +03:00
name: "HeadIntZeroMultiFieldsNotRootOmitEmpty",
2021-01-16 16:16:26 +03:00
data: struct {
A struct {
A int `json:"a,omitempty"`
}
B struct {
B int `json:"b,omitempty"`
}
}{},
},
{
2021-02-14 20:08:05 +03:00
name: "HeadIntZeroMultiFieldsNotRootString",
2021-01-16 16:16:26 +03:00
data: struct {
A struct {
A int `json:"a,string"`
}
B struct {
B int `json:"b,string"`
}
}{},
},
2021-05-06 19:39:58 +03:00
{
name: "HeadIntZeroMultiFieldsNotRootStringOmitEmpty",
data: struct {
A struct {
A int `json:"a,string,omitempty"`
}
B struct {
B int `json:"b,string,omitempty"`
}
}{},
},
2021-01-16 16:16:26 +03:00
// HeadIntMultiFieldsNotRoot
{
2021-02-14 20:08:05 +03:00
name: "HeadIntMultiFieldsNotRoot",
2021-01-16 16:16:26 +03:00
data: struct {
A struct {
A int `json:"a"`
}
B struct {
B int `json:"b"`
}
}{A: struct {
A int `json:"a"`
2021-02-19 09:13:33 +03:00
}{A: -1}, B: struct {
2021-01-16 16:16:26 +03:00
B int `json:"b"`
}{B: 2}},
},
{
2021-02-14 20:08:05 +03:00
name: "HeadIntMultiFieldsNotRootOmitEmpty",
2021-01-16 16:16:26 +03:00
data: struct {
A struct {
A int `json:"a,omitempty"`
}
B struct {
B int `json:"b,omitempty"`
}
}{A: struct {
A int `json:"a,omitempty"`
2021-02-19 09:13:33 +03:00
}{A: -1}, B: struct {
2021-01-16 16:16:26 +03:00
B int `json:"b,omitempty"`
}{B: 2}},
},
{
2021-02-14 20:08:05 +03:00
name: "HeadIntMultiFieldsNotRootString",
2021-01-16 16:16:26 +03:00
data: struct {
A struct {
A int `json:"a,string"`
}
B struct {
B int `json:"b,string"`
}
}{A: struct {
A int `json:"a,string"`
2021-02-19 09:13:33 +03:00
}{A: -1}, B: struct {
2021-01-16 16:16:26 +03:00
B int `json:"b,string"`
}{B: 2}},
},
2021-05-06 19:39:58 +03:00
{
name: "HeadIntMultiFieldsNotRootStringOmitEmpty",
data: struct {
A struct {
A int `json:"a,string,omitempty"`
}
B struct {
B int `json:"b,string,omitempty"`
}
}{A: struct {
A int `json:"a,string,omitempty"`
}{A: -1}, B: struct {
B int `json:"b,string,omitempty"`
}{B: 2}},
},
2021-01-16 16:16:26 +03:00
// HeadIntPtrMultiFieldsNotRoot
{
2021-02-14 20:08:05 +03:00
name: "HeadIntPtrMultiFieldsNotRoot",
2021-01-16 16:16:26 +03:00
data: struct {
A struct {
A *int `json:"a"`
}
B struct {
B *int `json:"b"`
}
}{A: struct {
A *int `json:"a"`
2021-02-19 09:13:33 +03:00
}{A: intptr(-1)}, B: struct {
2021-01-16 16:16:26 +03:00
B *int `json:"b"`
}{B: intptr(2)}},
},
{
2021-02-14 20:08:05 +03:00
name: "HeadIntPtrMultiFieldsNotRootOmitEmpty",
2021-01-16 16:16:26 +03:00
data: struct {
A struct {
A *int `json:"a,omitempty"`
}
B struct {
B *int `json:"b,omitempty"`
}
}{A: struct {
A *int `json:"a,omitempty"`
2021-02-19 09:13:33 +03:00
}{A: intptr(-1)}, B: struct {
2021-01-16 16:16:26 +03:00
B *int `json:"b,omitempty"`
}{B: intptr(2)}},
},
{
2021-02-14 20:08:05 +03:00
name: "HeadIntPtrMultiFieldsNotRootString",
2021-01-16 16:16:26 +03:00
data: struct {
A struct {
A *int `json:"a,string"`
}
B struct {
B *int `json:"b,string"`
}
}{A: struct {
A *int `json:"a,string"`
2021-02-19 09:13:33 +03:00
}{A: intptr(-1)}, B: struct {
2021-01-16 16:16:26 +03:00
B *int `json:"b,string"`
}{B: intptr(2)}},
},
2021-05-06 19:39:58 +03:00
{
name: "HeadIntPtrMultiFieldsNotRootStringOmitEmpty",
data: struct {
A struct {
A *int `json:"a,string,omitempty"`
}
B struct {
B *int `json:"b,string,omitempty"`
}
}{A: struct {
A *int `json:"a,string,omitempty"`
}{A: intptr(-1)}, B: struct {
B *int `json:"b,string,omitempty"`
}{B: intptr(2)}},
},
2021-01-16 16:16:26 +03:00
// HeadIntPtrNilMultiFieldsNotRoot
{
2021-02-14 20:08:05 +03:00
name: "HeadIntPtrNilMultiFieldsNotRoot",
2021-01-16 16:16:26 +03:00
data: struct {
A struct {
A *int `json:"a"`
}
B struct {
B *int `json:"b"`
}
}{A: struct {
A *int `json:"a"`
}{A: nil}, B: struct {
B *int `json:"b"`
}{B: nil}},
},
{
2021-02-14 20:08:05 +03:00
name: "HeadIntPtrNilMultiFieldsNotRootOmitEmpty",
2021-01-16 16:16:26 +03:00
data: struct {
A struct {
A *int `json:"a,omitempty"`
}
B struct {
B *int `json:"b,omitempty"`
}
}{A: struct {
A *int `json:"a,omitempty"`
}{A: nil}, B: struct {
B *int `json:"b,omitempty"`
}{B: nil}},
},
{
2021-02-14 20:08:05 +03:00
name: "HeadIntPtrNilMultiFieldsNotRootString",
2021-01-16 16:16:26 +03:00
data: struct {
A struct {
A *int `json:"a,string"`
}
B struct {
B *int `json:"b,string"`
}
}{A: struct {
A *int `json:"a,string"`
}{A: nil}, B: struct {
B *int `json:"b,string"`
}{B: nil}},
},
2021-05-06 19:39:58 +03:00
{
name: "HeadIntPtrNilMultiFieldsNotRootStringOmitEmpty",
data: struct {
A struct {
A *int `json:"a,string,omitempty"`
}
B struct {
B *int `json:"b,string,omitempty"`
}
}{A: struct {
A *int `json:"a,string,omitempty"`
}{A: nil}, B: struct {
B *int `json:"b,string,omitempty"`
}{B: nil}},
},
2021-01-16 16:16:26 +03:00
// PtrHeadIntZeroMultiFieldsNotRoot
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntZeroMultiFieldsNotRoot",
2021-01-16 16:16:26 +03:00
data: &struct {
A struct {
A int `json:"a"`
}
B struct {
B int `json:"b"`
}
}{},
},
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntZeroMultiFieldsNotRootOmitEmpty",
2021-01-16 16:16:26 +03:00
data: &struct {
A struct {
A int `json:"a,omitempty"`
}
B struct {
B int `json:"b,omitempty"`
}
}{},
},
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntZeroMultiFieldsNotRootString",
2021-01-16 16:16:26 +03:00
data: &struct {
A struct {
A int `json:"a,string"`
}
B struct {
B int `json:"b,string"`
}
}{},
},
2021-05-06 19:39:58 +03:00
{
name: "PtrHeadIntZeroMultiFieldsNotRootStringOmitEmpty",
data: &struct {
A struct {
A int `json:"a,string,omitempty"`
}
B struct {
B int `json:"b,string,omitempty"`
}
}{},
},
2021-01-16 16:16:26 +03:00
// PtrHeadIntMultiFieldsNotRoot
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntMultiFieldsNotRoot",
2021-01-16 16:16:26 +03:00
data: &struct {
A struct {
A int `json:"a"`
}
B struct {
B int `json:"b"`
}
}{A: struct {
A int `json:"a"`
2021-02-19 09:13:33 +03:00
}{A: -1}, B: struct {
2021-01-16 16:16:26 +03:00
B int `json:"b"`
}{B: 2}},
},
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntMultiFieldsNotRootOmitEmpty",
2021-01-16 16:16:26 +03:00
data: &struct {
A struct {
A int `json:"a,omitempty"`
}
B struct {
B int `json:"b,omitempty"`
}
}{A: struct {
A int `json:"a,omitempty"`
2021-02-19 09:13:33 +03:00
}{A: -1}, B: struct {
2021-01-16 16:16:26 +03:00
B int `json:"b,omitempty"`
}{B: 2}},
},
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntMultiFieldsNotRootString",
2021-01-16 16:16:26 +03:00
data: &struct {
A struct {
A int `json:"a,string"`
}
B struct {
B int `json:"b,string"`
}
}{A: struct {
A int `json:"a,string"`
2021-02-19 09:13:33 +03:00
}{A: -1}, B: struct {
2021-01-16 16:16:26 +03:00
B int `json:"b,string"`
}{B: 2}},
},
2021-05-06 19:39:58 +03:00
{
name: "PtrHeadIntMultiFieldsNotRootStringOmitEmpty",
data: &struct {
A struct {
A int `json:"a,string,omitempty"`
}
B struct {
B int `json:"b,string,omitempty"`
}
}{A: struct {
A int `json:"a,string,omitempty"`
}{A: -1}, B: struct {
B int `json:"b,string,omitempty"`
}{B: 2}},
},
2021-01-16 16:16:26 +03:00
// PtrHeadIntPtrMultiFieldsNotRoot
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntPtrMultiFieldsNotRoot",
2021-01-16 16:16:26 +03:00
data: &struct {
A *struct {
A *int `json:"a"`
}
B *struct {
B *int `json:"b"`
}
}{A: &(struct {
A *int `json:"a"`
2021-02-19 09:13:33 +03:00
}{A: intptr(-1)}), B: &(struct {
2021-01-16 16:16:26 +03:00
B *int `json:"b"`
}{B: intptr(2)})},
},
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntPtrMultiFieldsNotRootOmitEmpty",
2021-01-16 16:16:26 +03:00
data: &struct {
A *struct {
A *int `json:"a,omitempty"`
}
B *struct {
B *int `json:"b,omitempty"`
}
}{A: &(struct {
A *int `json:"a,omitempty"`
2021-02-19 09:13:33 +03:00
}{A: intptr(-1)}), B: &(struct {
2021-01-16 16:16:26 +03:00
B *int `json:"b,omitempty"`
}{B: intptr(2)})},
},
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntPtrMultiFieldsNotRootString",
2021-01-16 16:16:26 +03:00
data: &struct {
A *struct {
A *int `json:"a,string"`
}
B *struct {
B *int `json:"b,string"`
}
}{A: &(struct {
A *int `json:"a,string"`
2021-02-19 09:13:33 +03:00
}{A: intptr(-1)}), B: &(struct {
2021-01-16 16:16:26 +03:00
B *int `json:"b,string"`
}{B: intptr(2)})},
},
2021-05-06 19:39:58 +03:00
{
name: "PtrHeadIntPtrMultiFieldsNotRootStringOmitEmpty",
data: &struct {
A *struct {
A *int `json:"a,string,omitempty"`
}
B *struct {
B *int `json:"b,string,omitempty"`
}
}{A: &(struct {
A *int `json:"a,string,omitempty"`
}{A: intptr(-1)}), B: &(struct {
B *int `json:"b,string,omitempty"`
}{B: intptr(2)})},
},
2021-01-16 16:16:26 +03:00
// PtrHeadIntPtrNilMultiFieldsNotRoot
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntPtrNilMultiFieldsNotRoot",
2021-01-16 16:16:26 +03:00
data: &struct {
A *struct {
A *int `json:"a"`
}
B *struct {
B *int `json:"b"`
}
}{A: nil, B: nil},
},
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntPtrNilMultiFieldsNotRootOmitEmpty",
2021-01-16 16:16:26 +03:00
data: &struct {
A *struct {
A *int `json:"a,omitempty"`
} `json:",omitempty"`
B *struct {
B *int `json:"b,omitempty"`
} `json:",omitempty"`
}{A: nil, B: nil},
},
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntPtrNilMultiFieldsNotRootString",
2021-01-16 16:16:26 +03:00
data: &struct {
A *struct {
A *int `json:"a,string"`
} `json:",string"`
B *struct {
B *int `json:"b,string"`
} `json:",string"`
}{A: nil, B: nil},
},
2021-05-06 19:39:58 +03:00
{
name: "PtrHeadIntPtrNilMultiFieldsNotRootStringOmitEmpty",
data: &struct {
A *struct {
A *int `json:"a,string,omitempty"`
} `json:",string,omitempty"`
B *struct {
B *int `json:"b,string,omitempty"`
} `json:",string,omitempty"`
}{A: nil, B: nil},
},
2021-01-16 16:16:26 +03:00
// PtrHeadIntNilMultiFieldsNotRoot
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntNilMultiFieldsNotRoot",
2021-01-16 16:16:26 +03:00
data: (*struct {
A *struct {
A *int `json:"a"`
}
B *struct {
B *int `json:"b"`
}
})(nil),
},
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntNilMultiFieldsNotRootOmitEmpty",
2021-01-16 16:16:26 +03:00
data: (*struct {
A *struct {
A *int `json:"a,omitempty"`
}
B *struct {
B *int `json:"b,omitempty"`
}
})(nil),
},
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntNilMultiFieldsNotRootString",
2021-01-16 16:16:26 +03:00
data: (*struct {
A *struct {
A *int `json:"a,string"`
}
B *struct {
B *int `json:"b,string"`
}
})(nil),
},
2021-05-06 19:39:58 +03:00
{
name: "PtrHeadIntNilMultiFieldsNotRootStringOmitEmpty",
data: (*struct {
A *struct {
A *int `json:"a,string,omitempty"`
}
B *struct {
B *int `json:"b,string,omitempty"`
}
})(nil),
},
2021-01-16 16:16:26 +03:00
// PtrHeadIntDoubleMultiFieldsNotRoot
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntDoubleMultiFieldsNotRoot",
2021-01-16 16:16:26 +03:00
data: &struct {
A *struct {
A int `json:"a"`
B int `json:"b"`
}
B *struct {
A int `json:"a"`
B int `json:"b"`
}
}{A: &(struct {
A int `json:"a"`
B int `json:"b"`
2021-02-19 09:13:33 +03:00
}{A: -1, B: 2}), B: &(struct {
2021-01-16 16:16:26 +03:00
A int `json:"a"`
B int `json:"b"`
}{A: 3, B: 4})},
},
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntDoubleMultiFieldsNotRootOmitEmpty",
2021-01-16 16:16:26 +03:00
data: &struct {
A *struct {
A int `json:"a,omitempty"`
B int `json:"b,omitempty"`
}
B *struct {
A int `json:"a,omitempty"`
B int `json:"b,omitempty"`
}
}{A: &(struct {
A int `json:"a,omitempty"`
B int `json:"b,omitempty"`
2021-02-19 09:13:33 +03:00
}{A: -1, B: 2}), B: &(struct {
2021-01-16 16:16:26 +03:00
A int `json:"a,omitempty"`
B int `json:"b,omitempty"`
}{A: 3, B: 4})},
},
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntDoubleMultiFieldsNotRootString",
2021-01-16 16:16:26 +03:00
data: &struct {
A *struct {
A int `json:"a,string"`
B int `json:"b,string"`
}
B *struct {
A int `json:"a,string"`
B int `json:"b,string"`
}
}{A: &(struct {
A int `json:"a,string"`
B int `json:"b,string"`
2021-02-19 09:13:33 +03:00
}{A: -1, B: 2}), B: &(struct {
2021-01-16 16:16:26 +03:00
A int `json:"a,string"`
B int `json:"b,string"`
}{A: 3, B: 4})},
},
2021-05-06 19:39:58 +03:00
{
name: "PtrHeadIntDoubleMultiFieldsNotRootStringOmitEmpty",
data: &struct {
A *struct {
A int `json:"a,string,omitempty"`
B int `json:"b,string,omitempty"`
}
B *struct {
A int `json:"a,string,omitempty"`
B int `json:"b,string,omitempty"`
}
}{A: &(struct {
A int `json:"a,string,omitempty"`
B int `json:"b,string,omitempty"`
}{A: -1, B: 2}), B: &(struct {
A int `json:"a,string,omitempty"`
B int `json:"b,string,omitempty"`
}{A: 3, B: 4})},
},
2021-01-16 16:16:26 +03:00
// PtrHeadIntNilDoubleMultiFieldsNotRoot
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntNilDoubleMultiFieldsNotRoot",
2021-01-16 16:16:26 +03:00
data: &struct {
A *struct {
A int `json:"a"`
B int `json:"b"`
}
B *struct {
A int `json:"a"`
B int `json:"b"`
}
}{A: nil, B: nil},
},
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntNilDoubleMultiFieldsNotRootOmitEmpty",
2021-01-16 16:16:26 +03:00
data: &struct {
A *struct {
A int `json:"a,omitempty"`
B int `json:"b,omitempty"`
} `json:",omitempty"`
B *struct {
A int `json:"a,omitempty"`
B int `json:"b,omitempty"`
} `json:",omitempty"`
}{A: nil, B: nil},
},
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntNilDoubleMultiFieldsNotRootString",
2021-01-16 16:16:26 +03:00
data: &struct {
A *struct {
A int `json:"a,string"`
B int `json:"b,string"`
}
B *struct {
A int `json:"a,string"`
B int `json:"b,string"`
}
}{A: nil, B: nil},
},
2021-05-06 19:39:58 +03:00
{
name: "PtrHeadIntNilDoubleMultiFieldsNotRootStringOmitEmpty",
data: &struct {
A *struct {
A int `json:"a,string,omitempty"`
B int `json:"b,string,omitempty"`
}
B *struct {
A int `json:"a,string,omitempty"`
B int `json:"b,string,omitempty"`
}
}{A: nil, B: nil},
},
2021-01-16 16:16:26 +03:00
// PtrHeadIntNilDoubleMultiFieldsNotRoot
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntNilDoubleMultiFieldsNotRoot",
2021-01-16 16:16:26 +03:00
data: (*struct {
A *struct {
A int `json:"a"`
B int `json:"b"`
}
B *struct {
A int `json:"a"`
B int `json:"b"`
}
})(nil),
},
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntNilDoubleMultiFieldsNotRootOmitEmpty",
2021-01-16 16:16:26 +03:00
data: (*struct {
A *struct {
A int `json:"a,omitempty"`
B int `json:"b,omitempty"`
}
B *struct {
A int `json:"a,omitempty"`
B int `json:"b,omitempty"`
}
})(nil),
},
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntNilDoubleMultiFieldsNotRootString",
2021-01-16 16:16:26 +03:00
data: (*struct {
A *struct {
A int `json:"a,string"`
B int `json:"b,string"`
}
B *struct {
A int `json:"a,string"`
B int `json:"b,string"`
}
})(nil),
},
2021-05-06 19:39:58 +03:00
{
name: "PtrHeadIntNilDoubleMultiFieldsNotRootStringOmitEmpty",
data: (*struct {
A *struct {
A int `json:"a,string,omitempty"`
B int `json:"b,string,omitempty"`
}
B *struct {
A int `json:"a,string,omitempty"`
B int `json:"b,string,omitempty"`
}
})(nil),
},
2021-01-16 16:16:26 +03:00
// PtrHeadIntPtrDoubleMultiFieldsNotRoot
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntPtrDoubleMultiFieldsNotRoot",
2021-01-16 16:16:26 +03:00
data: &struct {
A *struct {
A *int `json:"a"`
B *int `json:"b"`
}
B *struct {
A *int `json:"a"`
B *int `json:"b"`
}
}{A: &(struct {
A *int `json:"a"`
B *int `json:"b"`
2021-02-19 09:13:33 +03:00
}{A: intptr(-1), B: intptr(2)}), B: &(struct {
2021-01-16 16:16:26 +03:00
A *int `json:"a"`
B *int `json:"b"`
}{A: intptr(3), B: intptr(4)})},
},
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntPtrDoubleMultiFieldsNotRootOmitEmpty",
2021-01-16 16:16:26 +03:00
data: &struct {
A *struct {
A *int `json:"a,omitempty"`
B *int `json:"b,omitempty"`
}
B *struct {
A *int `json:"a,omitempty"`
B *int `json:"b,omitempty"`
}
}{A: &(struct {
A *int `json:"a,omitempty"`
B *int `json:"b,omitempty"`
2021-02-19 09:13:33 +03:00
}{A: intptr(-1), B: intptr(2)}), B: &(struct {
2021-01-16 16:16:26 +03:00
A *int `json:"a,omitempty"`
B *int `json:"b,omitempty"`
}{A: intptr(3), B: intptr(4)})},
},
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntPtrDoubleMultiFieldsNotRootString",
2021-01-16 16:16:26 +03:00
data: &struct {
A *struct {
A *int `json:"a,string"`
B *int `json:"b,string"`
}
B *struct {
A *int `json:"a,string"`
B *int `json:"b,string"`
}
}{A: &(struct {
A *int `json:"a,string"`
B *int `json:"b,string"`
2021-02-19 09:13:33 +03:00
}{A: intptr(-1), B: intptr(2)}), B: &(struct {
2021-01-16 16:16:26 +03:00
A *int `json:"a,string"`
B *int `json:"b,string"`
}{A: intptr(3), B: intptr(4)})},
},
2021-05-06 19:39:58 +03:00
{
name: "PtrHeadIntPtrDoubleMultiFieldsNotRootStringOmitEmpty",
data: &struct {
A *struct {
A *int `json:"a,string,omitempty"`
B *int `json:"b,string,omitempty"`
}
B *struct {
A *int `json:"a,string,omitempty"`
B *int `json:"b,string,omitempty"`
}
}{A: &(struct {
A *int `json:"a,string,omitempty"`
B *int `json:"b,string,omitempty"`
}{A: intptr(-1), B: intptr(2)}), B: &(struct {
A *int `json:"a,string,omitempty"`
B *int `json:"b,string,omitempty"`
}{A: intptr(3), B: intptr(4)})},
},
2021-01-16 16:16:26 +03:00
// PtrHeadIntPtrNilDoubleMultiFieldsNotRoot
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntPtrNilDoubleMultiFieldsNotRoot",
2021-01-16 16:16:26 +03:00
data: &struct {
A *struct {
A *int `json:"a"`
B *int `json:"b"`
}
B *struct {
A *int `json:"a"`
B *int `json:"b"`
}
}{A: nil, B: nil},
},
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntPtrNilDoubleMultiFieldsNotRootOmitEmpty",
2021-01-16 16:16:26 +03:00
data: &struct {
A *struct {
A *int `json:"a,omitempty"`
B *int `json:"b,omitempty"`
} `json:",omitempty"`
B *struct {
A *int `json:"a,omitempty"`
B *int `json:"b,omitempty"`
} `json:",omitempty"`
}{A: nil, B: nil},
},
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntPtrNilDoubleMultiFieldsNotRootString",
2021-01-16 16:16:26 +03:00
data: &struct {
A *struct {
A *int `json:"a,string"`
B *int `json:"b,string"`
}
B *struct {
A *int `json:"a,string"`
B *int `json:"b,string"`
}
}{A: nil, B: nil},
},
2021-05-06 19:39:58 +03:00
{
name: "PtrHeadIntPtrNilDoubleMultiFieldsNotRootStringOmitEmpty",
data: &struct {
A *struct {
A *int `json:"a,string,omitempty"`
B *int `json:"b,string,omitempty"`
}
B *struct {
A *int `json:"a,string,omitempty"`
B *int `json:"b,string,omitempty"`
}
}{A: nil, B: nil},
},
2021-01-16 16:16:26 +03:00
// PtrHeadIntPtrNilDoubleMultiFieldsNotRoot
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntPtrNilDoubleMultiFieldsNotRoot",
2021-01-16 16:16:26 +03:00
data: (*struct {
A *struct {
A *int `json:"a"`
B *int `json:"b"`
}
B *struct {
A *int `json:"a"`
B *int `json:"b"`
}
})(nil),
},
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntPtrNilDoubleMultiFieldsNotRootOmitEmpty",
2021-01-16 16:16:26 +03:00
data: (*struct {
A *struct {
A *int `json:"a,omitempty"`
B *int `json:"b,omitempty"`
}
B *struct {
A *int `json:"a,omitempty"`
B *int `json:"b,omitempty"`
}
})(nil),
},
{
2021-02-14 20:08:05 +03:00
name: "PtrHeadIntPtrNilDoubleMultiFieldsNotRootString",
2021-01-16 16:16:26 +03:00
data: (*struct {
A *struct {
A *int `json:"a,string"`
B *int `json:"b,string"`
}
B *struct {
A *int `json:"a,string"`
B *int `json:"b,string"`
}
})(nil),
},
2021-05-06 19:39:58 +03:00
{
name: "PtrHeadIntPtrNilDoubleMultiFieldsNotRootStringOmitEmpty",
data: (*struct {
A *struct {
A *int `json:"a,string,omitempty"`
B *int `json:"b,string,omitempty"`
}
B *struct {
A *int `json:"a,string,omitempty"`
B *int `json:"b,string,omitempty"`
}
})(nil),
},
2021-01-16 16:16:26 +03:00
// AnonymousHeadInt
{
2021-02-14 20:08:05 +03:00
name: "AnonymousHeadInt",
2021-01-16 16:16:26 +03:00
data: struct {
structInt
B int `json:"b"`
}{
2021-02-19 09:13:33 +03:00
structInt: structInt{A: -1},
2021-01-16 16:16:26 +03:00
B: 2,
},
},
{
2021-02-14 20:08:05 +03:00
name: "AnonymousHeadIntOmitEmpty",
2021-01-16 16:16:26 +03:00
data: struct {
structIntOmitEmpty
B int `json:"b,omitempty"`
}{
2021-02-19 09:13:33 +03:00
structIntOmitEmpty: structIntOmitEmpty{A: -1},
2021-01-16 16:16:26 +03:00
B: 2,
},
},
{
2021-02-14 20:08:05 +03:00
name: "AnonymousHeadIntString",
2021-01-16 16:16:26 +03:00
data: struct {
structIntString
B int `json:"b,string"`
}{
2021-02-19 09:13:33 +03:00
structIntString: structIntString{A: -1},
2021-01-16 16:16:26 +03:00
B: 2,
},
},
2021-05-06 19:39:58 +03:00
{
name: "AnonymousHeadIntStringOmitEmpty",
data: struct {
structIntStringOmitEmpty
B int `json:"b,string,omitempty"`
}{
structIntStringOmitEmpty: structIntStringOmitEmpty{A: -1},
B: 2,
},
},
2021-01-16 16:16:26 +03:00
// PtrAnonymousHeadInt
{
2021-02-14 20:08:05 +03:00
name: "PtrAnonymousHeadInt",
2021-01-16 16:16:26 +03:00
data: struct {
*structInt
B int `json:"b"`
}{
2021-02-19 09:13:33 +03:00
structInt: &structInt{A: -1},
2021-01-16 16:16:26 +03:00
B: 2,
},
},
{
2021-02-14 20:08:05 +03:00
name: "PtrAnonymousHeadIntOmitEmpty",
2021-01-16 16:16:26 +03:00
data: struct {
*structIntOmitEmpty
B int `json:"b,omitempty"`
}{
2021-02-19 09:13:33 +03:00
structIntOmitEmpty: &structIntOmitEmpty{A: -1},
2021-01-16 16:16:26 +03:00
B: 2,
},
},
{
2021-02-14 20:08:05 +03:00
name: "PtrAnonymousHeadIntString",
2021-01-16 16:16:26 +03:00
data: struct {
*structIntString
B int `json:"b,string"`
}{
2021-02-19 09:13:33 +03:00
structIntString: &structIntString{A: -1},
2021-01-16 16:16:26 +03:00
B: 2,
},
},
2021-05-06 19:39:58 +03:00
{
name: "PtrAnonymousHeadIntStringOmitEmpty",
data: struct {
*structIntStringOmitEmpty
B int `json:"b,string,omitempty"`
}{
structIntStringOmitEmpty: &structIntStringOmitEmpty{A: -1},
B: 2,
},
},
2021-01-16 16:16:26 +03:00
// NilPtrAnonymousHeadInt
{
2021-02-14 20:08:05 +03:00
name: "NilPtrAnonymousHeadInt",
2021-01-16 16:16:26 +03:00
data: struct {
*structInt
B int `json:"b"`
}{
structInt: nil,
B: 2,
},
},
{
2021-02-14 20:08:05 +03:00
name: "NilPtrAnonymousHeadIntOmitEmpty",
2021-01-16 16:16:26 +03:00
data: struct {
*structIntOmitEmpty
B int `json:"b,omitempty"`
}{
structIntOmitEmpty: nil,
B: 2,
},
},
{
2021-02-14 20:08:05 +03:00
name: "NilPtrAnonymousHeadIntString",
2021-01-16 16:16:26 +03:00
data: struct {
*structIntString
B int `json:"b,string"`
}{
structIntString: nil,
B: 2,
},
},
2021-05-06 19:39:58 +03:00
{
name: "NilPtrAnonymousHeadIntStringOmitEmpty",
data: struct {
*structIntStringOmitEmpty
B int `json:"b,string,omitempty"`
}{
structIntStringOmitEmpty: nil,
B: 2,
},
},
2021-01-16 16:16:26 +03:00
// AnonymousHeadIntPtr
{
2021-02-14 20:08:05 +03:00
name: "AnonymousHeadIntPtr",
2021-01-16 16:16:26 +03:00
data: struct {
structIntPtr
B *int `json:"b"`
}{
2021-02-19 09:13:33 +03:00
structIntPtr: structIntPtr{A: intptr(-1)},
2021-01-16 16:16:26 +03:00
B: intptr(2),
},
},
{
2021-02-14 20:08:05 +03:00
name: "AnonymousHeadIntPtrOmitEmpty",
2021-01-16 16:16:26 +03:00
data: struct {
structIntPtrOmitEmpty
B *int `json:"b,omitempty"`
}{
2021-02-19 09:13:33 +03:00
structIntPtrOmitEmpty: structIntPtrOmitEmpty{A: intptr(-1)},
2021-01-16 16:16:26 +03:00
B: intptr(2),
},
},
{
2021-02-14 20:08:05 +03:00
name: "AnonymousHeadIntPtrString",
2021-01-16 16:16:26 +03:00
data: struct {
structIntPtrString
B *int `json:"b,string"`
}{
2021-02-19 09:13:33 +03:00
structIntPtrString: structIntPtrString{A: intptr(-1)},
2021-01-16 16:16:26 +03:00
B: intptr(2),
},
},
2021-05-06 19:39:58 +03:00
{
name: "AnonymousHeadIntPtrStringOmitEmpty",
data: struct {
structIntPtrStringOmitEmpty
B *int `json:"b,string,omitempty"`
}{
structIntPtrStringOmitEmpty: structIntPtrStringOmitEmpty{A: intptr(-1)},
B: intptr(2),
},
},
2021-01-16 16:16:26 +03:00
// AnonymousHeadIntPtrNil
{
2021-02-14 20:08:05 +03:00
name: "AnonymousHeadIntPtrNil",
2021-01-16 16:16:26 +03:00
data: struct {
structIntPtr
B *int `json:"b"`
}{
structIntPtr: structIntPtr{A: nil},
B: intptr(2),
},
},
{
2021-02-14 20:08:05 +03:00
name: "AnonymousHeadIntPtrNilOmitEmpty",
2021-01-16 16:16:26 +03:00
data: struct {
structIntPtrOmitEmpty
B *int `json:"b,omitempty"`
}{
structIntPtrOmitEmpty: structIntPtrOmitEmpty{A: nil},
B: intptr(2),
},
},
{
2021-02-14 20:08:05 +03:00
name: "AnonymousHeadIntPtrNilString",
2021-01-16 16:16:26 +03:00
data: struct {
structIntPtrString
B *int `json:"b,string"`
}{
structIntPtrString: structIntPtrString{A: nil},
B: intptr(2),
},
},
2021-05-06 19:39:58 +03:00
{
name: "AnonymousHeadIntPtrNilStringOmitEmpty",
data: struct {
structIntPtrStringOmitEmpty
B *int `json:"b,string,omitempty"`
}{
structIntPtrStringOmitEmpty: structIntPtrStringOmitEmpty{A: nil},
B: intptr(2),
},
},
2021-01-16 16:16:26 +03:00
// PtrAnonymousHeadIntPtr
{
2021-02-14 20:08:05 +03:00
name: "PtrAnonymousHeadIntPtr",
2021-01-16 16:16:26 +03:00
data: struct {
*structIntPtr
B *int `json:"b"`
}{
2021-02-19 09:13:33 +03:00
structIntPtr: &structIntPtr{A: intptr(-1)},
2021-01-16 16:16:26 +03:00
B: intptr(2),
},
},
{
2021-02-14 20:08:05 +03:00
name: "PtrAnonymousHeadIntPtrOmitEmpty",
2021-01-16 16:16:26 +03:00
data: struct {
*structIntPtrOmitEmpty
B *int `json:"b,omitempty"`
}{
2021-02-19 09:13:33 +03:00
structIntPtrOmitEmpty: &structIntPtrOmitEmpty{A: intptr(-1)},
2021-01-16 16:16:26 +03:00
B: intptr(2),
},
},
{
2021-02-14 20:08:05 +03:00
name: "PtrAnonymousHeadIntPtrString",
2021-01-16 16:16:26 +03:00
data: struct {
*structIntPtrString
B *int `json:"b,string"`
}{
2021-02-19 09:13:33 +03:00
structIntPtrString: &structIntPtrString{A: intptr(-1)},
2021-01-16 16:16:26 +03:00
B: intptr(2),
},
},
2021-05-06 19:39:58 +03:00
{
name: "PtrAnonymousHeadIntPtrStringOmitEmpty",
data: struct {
*structIntPtrStringOmitEmpty
B *int `json:"b,string,omitempty"`
}{
structIntPtrStringOmitEmpty: &structIntPtrStringOmitEmpty{A: intptr(-1)},
B: intptr(2),
},
},
2021-01-16 16:16:26 +03:00
// NilPtrAnonymousHeadIntPtr
{
2021-02-14 20:08:05 +03:00
name: "NilPtrAnonymousHeadIntPtr",
2021-01-16 16:16:26 +03:00
data: struct {
*structIntPtr
B *int `json:"b"`
}{
structIntPtr: nil,
B: intptr(2),
},
},
{
2021-02-14 20:08:05 +03:00
name: "NilPtrAnonymousHeadIntPtrOmitEmpty",
2021-01-16 16:16:26 +03:00
data: struct {
*structIntPtrOmitEmpty
B *int `json:"b,omitempty"`
}{
structIntPtrOmitEmpty: nil,
B: intptr(2),
},
},
{
2021-02-14 20:08:05 +03:00
name: "NilPtrAnonymousHeadIntPtrString",
2021-01-16 16:16:26 +03:00
data: struct {
*structIntPtrString
B *int `json:"b,string"`
}{
structIntPtrString: nil,
B: intptr(2),
},
},
2021-05-06 19:39:58 +03:00
{
name: "NilPtrAnonymousHeadIntPtrStringOmitEmpty",
data: struct {
*structIntPtrStringOmitEmpty
B *int `json:"b,string,omitempty"`
}{
structIntPtrStringOmitEmpty: nil,
B: intptr(2),
},
},
2021-01-16 16:16:26 +03:00
// AnonymousHeadIntOnly
{
2021-02-14 20:08:05 +03:00
name: "AnonymousHeadIntOnly",
2021-01-16 16:16:26 +03:00
data: struct {
structInt
}{
2021-02-19 09:13:33 +03:00
structInt: structInt{A: -1},
2021-01-16 16:16:26 +03:00
},
},
{
2021-02-14 20:08:05 +03:00
name: "AnonymousHeadIntOnlyOmitEmpty",
2021-01-16 16:16:26 +03:00
data: struct {
structIntOmitEmpty
}{
2021-02-19 09:13:33 +03:00
structIntOmitEmpty: structIntOmitEmpty{A: -1},
2021-01-16 16:16:26 +03:00
},
},
{
2021-02-14 20:08:05 +03:00
name: "AnonymousHeadIntOnlyString",
2021-01-16 16:16:26 +03:00
data: struct {
structIntString
}{
2021-02-19 09:13:33 +03:00
structIntString: structIntString{A: -1},
2021-01-16 16:16:26 +03:00
},
},
2021-05-06 19:39:58 +03:00
{
name: "AnonymousHeadIntOnlyStringOmitEmpty",
data: struct {
structIntStringOmitEmpty
}{
structIntStringOmitEmpty: structIntStringOmitEmpty{A: -1},
},
},
2021-01-16 16:16:26 +03:00
// PtrAnonymousHeadIntOnly
{
2021-02-14 20:08:05 +03:00
name: "PtrAnonymousHeadIntOnly",
2021-01-16 16:16:26 +03:00
data: struct {
*structInt
}{
2021-02-19 09:13:33 +03:00
structInt: &structInt{A: -1},
2021-01-16 16:16:26 +03:00
},
},
{
2021-02-14 20:08:05 +03:00
name: "PtrAnonymousHeadIntOnlyOmitEmpty",
2021-01-16 16:16:26 +03:00
data: struct {
*structIntOmitEmpty
}{
2021-02-19 09:13:33 +03:00
structIntOmitEmpty: &structIntOmitEmpty{A: -1},
2021-01-16 16:16:26 +03:00
},
},
{
2021-02-14 20:08:05 +03:00
name: "PtrAnonymousHeadIntOnlyString",
2021-01-16 16:16:26 +03:00
data: struct {
*structIntString
}{
2021-02-19 09:13:33 +03:00
structIntString: &structIntString{A: -1},
2021-01-16 16:16:26 +03:00
},
},
2021-05-06 19:39:58 +03:00
{
name: "PtrAnonymousHeadIntOnlyStringOmitEmpty",
data: struct {
*structIntStringOmitEmpty
}{
structIntStringOmitEmpty: &structIntStringOmitEmpty{A: -1},
},
},
2021-01-16 16:16:26 +03:00
// NilPtrAnonymousHeadIntOnly
{
2021-02-14 20:08:05 +03:00
name: "NilPtrAnonymousHeadIntOnly",
2021-01-16 16:16:26 +03:00
data: struct {
*structInt
}{
structInt: nil,
},
},
{
2021-02-14 20:08:05 +03:00
name: "NilPtrAnonymousHeadIntOnlyOmitEmpty",
2021-01-16 16:16:26 +03:00
data: struct {
*structIntOmitEmpty
}{
structIntOmitEmpty: nil,
},
},
{
2021-02-14 20:08:05 +03:00
name: "NilPtrAnonymousHeadIntOnlyString",
2021-01-16 16:16:26 +03:00
data: struct {
*structIntString
}{
structIntString: nil,
},
},
2021-05-06 19:39:58 +03:00
{
name: "NilPtrAnonymousHeadIntOnlyStringOmitEmpty",
data: struct {
*structIntStringOmitEmpty
}{
structIntStringOmitEmpty: nil,
},
},
2021-01-16 16:16:26 +03:00
// AnonymousHeadIntPtrOnly
{
2021-02-14 20:08:05 +03:00
name: "AnonymousHeadIntPtrOnly",
2021-01-16 16:16:26 +03:00
data: struct {
structIntPtr
}{
2021-02-19 09:13:33 +03:00
structIntPtr: structIntPtr{A: intptr(-1)},
2021-01-16 16:16:26 +03:00
},
},
{
2021-02-14 20:08:05 +03:00
name: "AnonymousHeadIntPtrOnlyOmitEmpty",
2021-01-16 16:16:26 +03:00
data: struct {
structIntPtrOmitEmpty
}{
2021-02-19 09:13:33 +03:00
structIntPtrOmitEmpty: structIntPtrOmitEmpty{A: intptr(-1)},
2021-01-16 16:16:26 +03:00
},
},
{
2021-02-14 20:08:05 +03:00
name: "AnonymousHeadIntPtrOnlyString",
2021-01-16 16:16:26 +03:00
data: struct {
structIntPtrString
}{
2021-02-19 09:13:33 +03:00
structIntPtrString: structIntPtrString{A: intptr(-1)},
2021-01-16 16:16:26 +03:00
},
},
2021-05-06 19:39:58 +03:00
{
name: "AnonymousHeadIntPtrOnlyStringOmitEmpty",
data: struct {
structIntPtrStringOmitEmpty
}{
structIntPtrStringOmitEmpty: structIntPtrStringOmitEmpty{A: intptr(-1)},
},
},
2021-01-16 16:16:26 +03:00
// AnonymousHeadIntPtrNilOnly
{
2021-02-14 20:08:05 +03:00
name: "AnonymousHeadIntPtrNilOnly",
2021-01-16 16:16:26 +03:00
data: struct {
structIntPtr
}{
structIntPtr: structIntPtr{A: nil},
},
},
{
2021-02-14 20:08:05 +03:00
name: "AnonymousHeadIntPtrNilOnlyOmitEmpty",
2021-01-16 16:16:26 +03:00
data: struct {
structIntPtrOmitEmpty
}{
structIntPtrOmitEmpty: structIntPtrOmitEmpty{A: nil},
},
},
{
2021-02-14 20:08:05 +03:00
name: "AnonymousHeadIntPtrNilOnlyString",
2021-01-16 16:16:26 +03:00
data: struct {
structIntPtrString
}{
structIntPtrString: structIntPtrString{A: nil},
},
},
2021-05-06 19:39:58 +03:00
{
name: "AnonymousHeadIntPtrNilOnlyStringOmitEmpty",
data: struct {
structIntPtrStringOmitEmpty
}{
structIntPtrStringOmitEmpty: structIntPtrStringOmitEmpty{A: nil},
},
},
2021-01-16 16:16:26 +03:00
// PtrAnonymousHeadIntPtrOnly
{
2021-02-14 20:08:05 +03:00
name: "PtrAnonymousHeadIntPtrOnly",
2021-01-16 16:16:26 +03:00
data: struct {
*structIntPtr
}{
2021-02-19 09:13:33 +03:00
structIntPtr: &structIntPtr{A: intptr(-1)},
2021-01-16 16:16:26 +03:00
},
},
{
2021-02-14 20:08:05 +03:00
name: "PtrAnonymousHeadIntPtrOnlyOmitEmpty",
2021-01-16 16:16:26 +03:00
data: struct {
*structIntPtrOmitEmpty
}{
2021-02-19 09:13:33 +03:00
structIntPtrOmitEmpty: &structIntPtrOmitEmpty{A: intptr(-1)},
2021-01-16 16:16:26 +03:00
},
},
{
2021-02-14 20:08:05 +03:00
name: "PtrAnonymousHeadIntPtrOnlyString",
2021-01-16 16:16:26 +03:00
data: struct {
*structIntPtrString
}{
2021-02-19 09:13:33 +03:00
structIntPtrString: &structIntPtrString{A: intptr(-1)},
2021-01-16 16:16:26 +03:00
},
},
2021-05-06 19:39:58 +03:00
{
name: "PtrAnonymousHeadIntPtrOnlyStringOmitEmpty",
data: struct {
*structIntPtrStringOmitEmpty
}{
structIntPtrStringOmitEmpty: &structIntPtrStringOmitEmpty{A: intptr(-1)},
},
},
2021-01-16 16:16:26 +03:00
// NilPtrAnonymousHeadIntPtrOnly
{
2021-02-14 20:08:05 +03:00
name: "NilPtrAnonymousHeadIntPtrOnly",
2021-01-16 16:16:26 +03:00
data: struct {
*structIntPtr
}{
structIntPtr: nil,
},
},
{
2021-02-14 20:08:05 +03:00
name: "NilPtrAnonymousHeadIntPtrOnlyOmitEmpty",
2021-01-16 16:16:26 +03:00
data: struct {
*structIntPtrOmitEmpty
}{
structIntPtrOmitEmpty: nil,
},
},
{
2021-02-14 20:08:05 +03:00
name: "NilPtrAnonymousHeadIntPtrOnlyString",
2021-01-16 16:16:26 +03:00
data: struct {
*structIntPtrString
}{
structIntPtrString: nil,
},
},
2021-05-06 19:39:58 +03:00
{
name: "NilPtrAnonymousHeadIntPtrOnlyStringOmitEmpty",
data: struct {
*structIntPtrStringOmitEmpty
}{
structIntPtrStringOmitEmpty: 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 {
t.Fatalf("%s(htmlEscape:%v,indent:%v): %+v: %s", test.name, htmlEscape, indent, 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:%v,indent:%v): doesn't compatible with encoding/json. expected %q but got %q", test.name, htmlEscape, indent, stdresult, buf.String())
2021-01-19 08:01:43 +03:00
}
2021-01-16 16:16:26 +03:00
}
}
}
}