go-json/cover_int8_test.go

1787 lines
34 KiB
Go
Raw Permalink Normal View History

2021-01-16 16:16:26 +03:00
package json_test
import (
"bytes"
"testing"
"github.com/goccy/go-json"
)
func TestCoverInt8(t *testing.T) {
type structInt8 struct {
A int8 `json:"a"`
}
2021-01-16 20:53:54 +03:00
type structInt8OmitEmpty struct {
A int8 `json:"a,omitempty"`
}
type structInt8String struct {
A int8 `json:"a,string"`
}
2021-01-16 16:16:26 +03:00
type structInt8Ptr struct {
A *int8 `json:"a"`
}
2021-01-16 20:53:54 +03:00
type structInt8PtrOmitEmpty struct {
A *int8 `json:"a,omitempty"`
}
type structInt8PtrString struct {
A *int8 `json:"a,string"`
}
2021-01-16 16:16:26 +03:00
tests := []struct {
2021-02-14 20:08:22 +03:00
name string
data interface{}
2021-01-16 16:16:26 +03:00
}{
2021-01-16 20:53:54 +03:00
// HeadInt8Zero
2021-01-16 16:16:26 +03:00
{
2021-02-14 20:08:22 +03:00
name: "HeadInt8Zero",
2021-01-16 16:16:26 +03:00
data: struct {
A int8 `json:"a"`
}{},
},
2021-01-16 20:53:54 +03:00
{
2021-02-14 20:08:22 +03:00
name: "HeadInt8ZeroOmitEmpty",
2021-01-16 20:53:54 +03:00
data: struct {
A int8 `json:"a,omitempty"`
}{},
},
{
2021-02-14 20:08:22 +03:00
name: "HeadInt8ZeroString",
2021-01-16 20:53:54 +03:00
data: struct {
A int8 `json:"a,string"`
}{},
},
// HeadInt8
2021-01-16 16:16:26 +03:00
{
2021-02-14 20:08:22 +03:00
name: "HeadInt8",
2021-01-16 16:16:26 +03:00
data: struct {
A int8 `json:"a"`
}{A: 1},
},
2021-01-16 20:53:54 +03:00
{
2021-02-14 20:08:22 +03:00
name: "HeadInt8OmitEmpty",
2021-01-16 20:53:54 +03:00
data: struct {
A int8 `json:"a,omitempty"`
}{A: 1},
},
{
2021-02-14 20:08:22 +03:00
name: "HeadInt8String",
2021-01-16 20:53:54 +03:00
data: struct {
A int8 `json:"a,string"`
}{A: 1},
},
// HeadInt8Ptr
2021-01-16 16:16:26 +03:00
{
2021-02-14 20:08:22 +03:00
name: "HeadInt8Ptr",
2021-01-16 16:16:26 +03:00
data: struct {
A *int8 `json:"a"`
}{A: int8ptr(1)},
},
2021-01-16 20:53:54 +03:00
{
2021-02-14 20:08:22 +03:00
name: "HeadInt8PtrOmitEmpty",
2021-01-16 20:53:54 +03:00
data: struct {
A *int8 `json:"a,omitempty"`
}{A: int8ptr(1)},
},
{
2021-02-14 20:08:22 +03:00
name: "HeadInt8PtrString",
2021-01-16 20:53:54 +03:00
data: struct {
A *int8 `json:"a,string"`
}{A: int8ptr(1)},
},
// HeadInt8PtrNil
2021-01-16 16:16:26 +03:00
{
2021-02-14 20:08:22 +03:00
name: "HeadInt8PtrNil",
2021-01-16 16:16:26 +03:00
data: struct {
A *int8 `json:"a"`
}{A: nil},
},
2021-01-16 20:53:54 +03:00
{
2021-02-14 20:08:22 +03:00
name: "HeadInt8PtrNilOmitEmpty",
2021-01-16 20:53:54 +03:00
data: struct {
A *int8 `json:"a,omitempty"`
}{A: nil},
},
{
2021-02-14 20:08:22 +03:00
name: "HeadInt8PtrNilString",
2021-01-16 20:53:54 +03:00
data: struct {
A *int8 `json:"a,string"`
}{A: nil},
},
// PtrHeadInt8Zero
2021-01-16 16:16:26 +03:00
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8Zero",
2021-01-16 16:16:26 +03:00
data: &struct {
A int8 `json:"a"`
}{},
},
2021-01-16 20:53:54 +03:00
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8ZeroOmitEmpty",
2021-01-16 20:53:54 +03:00
data: &struct {
A int8 `json:"a,omitempty"`
}{},
},
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8ZeroString",
2021-01-16 20:53:54 +03:00
data: &struct {
A int8 `json:"a,string"`
}{},
},
// PtrHeadInt8
2021-01-16 16:16:26 +03:00
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8",
2021-01-16 16:16:26 +03:00
data: &struct {
A int8 `json:"a"`
}{A: 1},
},
2021-01-16 20:53:54 +03:00
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8OmitEmpty",
2021-01-16 20:53:54 +03:00
data: &struct {
A int8 `json:"a,omitempty"`
}{A: 1},
},
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8String",
2021-01-16 20:53:54 +03:00
data: &struct {
A int8 `json:"a,string"`
}{A: 1},
},
// PtrHeadInt8Ptr
2021-01-16 16:16:26 +03:00
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8Ptr",
2021-01-16 16:16:26 +03:00
data: &struct {
A *int8 `json:"a"`
}{A: int8ptr(1)},
},
2021-01-16 20:53:54 +03:00
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8PtrOmitEmpty",
2021-01-16 20:53:54 +03:00
data: &struct {
A *int8 `json:"a,omitempty"`
}{A: int8ptr(1)},
},
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8PtrString",
2021-01-16 20:53:54 +03:00
data: &struct {
A *int8 `json:"a,string"`
}{A: int8ptr(1)},
},
// PtrHeadInt8PtrNil
2021-01-16 16:16:26 +03:00
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8PtrNil",
2021-01-16 16:16:26 +03:00
data: &struct {
A *int8 `json:"a"`
}{A: nil},
},
2021-01-16 20:53:54 +03:00
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8PtrNilOmitEmpty",
2021-01-16 20:53:54 +03:00
data: &struct {
A *int8 `json:"a,omitempty"`
}{A: nil},
},
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8PtrNilString",
2021-01-16 20:53:54 +03:00
data: &struct {
A *int8 `json:"a,string"`
}{A: nil},
},
// PtrHeadInt8Nil
2021-01-16 16:16:26 +03:00
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8Nil",
2021-01-16 16:16:26 +03:00
data: (*struct {
A *int8 `json:"a"`
})(nil),
},
2021-01-16 20:53:54 +03:00
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8NilOmitEmpty",
2021-01-16 20:53:54 +03:00
data: (*struct {
A *int8 `json:"a,omitempty"`
})(nil),
},
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8NilString",
2021-01-16 20:53:54 +03:00
data: (*struct {
A *int8 `json:"a,string"`
})(nil),
},
// HeadInt8ZeroMultiFields
2021-01-16 16:16:26 +03:00
{
2021-02-14 20:08:22 +03:00
name: "HeadInt8ZeroMultiFields",
2021-01-16 16:16:26 +03:00
data: struct {
A int8 `json:"a"`
B int8 `json:"b"`
2021-02-14 20:08:22 +03:00
C int8 `json:"c"`
2021-01-16 16:16:26 +03:00
}{},
},
2021-01-16 20:53:54 +03:00
{
2021-02-14 20:08:22 +03:00
name: "HeadInt8ZeroMultiFieldsOmitEmpty",
2021-01-16 20:53:54 +03:00
data: struct {
A int8 `json:"a,omitempty"`
B int8 `json:"b,omitempty"`
2021-02-14 20:08:22 +03:00
C int8 `json:"c,omitempty"`
2021-01-16 20:53:54 +03:00
}{},
},
{
2021-02-14 20:08:22 +03:00
name: "HeadInt8ZeroMultiFields",
2021-01-16 20:53:54 +03:00
data: struct {
A int8 `json:"a,string"`
B int8 `json:"b,string"`
2021-02-14 20:08:22 +03:00
C int8 `json:"c,string"`
2021-01-16 20:53:54 +03:00
}{},
},
// HeadInt8MultiFields
2021-01-16 16:16:26 +03:00
{
2021-02-14 20:08:22 +03:00
name: "HeadInt8MultiFields",
2021-01-16 16:16:26 +03:00
data: struct {
A int8 `json:"a"`
B int8 `json:"b"`
2021-02-14 20:08:22 +03:00
C int8 `json:"c"`
}{A: 1, B: 2, C: 3},
2021-01-16 16:16:26 +03:00
},
{
2021-02-14 20:08:22 +03:00
name: "HeadInt8MultiFieldsOmitEmpty",
2021-01-16 16:16:26 +03:00
data: struct {
2021-01-16 20:53:54 +03:00
A int8 `json:"a,omitempty"`
B int8 `json:"b,omitempty"`
2021-02-14 20:08:22 +03:00
C int8 `json:"c,omitempty"`
}{A: 1, B: 2, C: 3},
2021-01-16 16:16:26 +03:00
},
{
2021-02-14 20:08:22 +03:00
name: "HeadInt8MultiFieldsString",
2021-01-16 16:16:26 +03:00
data: struct {
2021-01-16 20:53:54 +03:00
A int8 `json:"a,string"`
B int8 `json:"b,string"`
2021-02-14 20:08:22 +03:00
C int8 `json:"c,string"`
}{A: 1, B: 2, C: 3},
2021-01-16 16:16:26 +03:00
},
2021-01-16 20:53:54 +03:00
// HeadInt8PtrMultiFields
2021-01-16 16:16:26 +03:00
{
2021-02-14 20:08:22 +03:00
name: "HeadInt8PtrMultiFields",
2021-01-16 20:53:54 +03:00
data: struct {
A *int8 `json:"a"`
B *int8 `json:"b"`
2021-02-14 20:08:22 +03:00
C *int8 `json:"c"`
}{A: int8ptr(1), B: int8ptr(2), C: int8ptr(3)},
2021-01-16 16:16:26 +03:00
},
{
2021-02-14 20:08:22 +03:00
name: "HeadInt8PtrMultiFieldsOmitEmpty",
2021-01-16 20:53:54 +03:00
data: struct {
A *int8 `json:"a,omitempty"`
B *int8 `json:"b,omitempty"`
2021-02-14 20:08:22 +03:00
C *int8 `json:"c,omitempty"`
}{A: int8ptr(1), B: int8ptr(2), C: int8ptr(3)},
2021-01-16 16:16:26 +03:00
},
{
2021-02-14 20:08:22 +03:00
name: "HeadInt8PtrMultiFieldsString",
2021-01-16 20:53:54 +03:00
data: struct {
A *int8 `json:"a,string"`
B *int8 `json:"b,string"`
2021-02-14 20:08:22 +03:00
C *int8 `json:"c,string"`
}{A: int8ptr(1), B: int8ptr(2), C: int8ptr(3)},
2021-01-16 16:16:26 +03:00
},
2021-01-16 20:53:54 +03:00
// HeadInt8PtrNilMultiFields
2021-01-16 16:16:26 +03:00
{
2021-02-14 20:08:22 +03:00
name: "HeadInt8PtrNilMultiFields",
2021-01-16 20:53:54 +03:00
data: struct {
2021-01-16 16:16:26 +03:00
A *int8 `json:"a"`
B *int8 `json:"b"`
2021-02-14 20:08:22 +03:00
C *int8 `json:"c"`
}{A: nil, B: nil, C: nil},
2021-01-16 16:16:26 +03:00
},
{
2021-02-14 20:08:22 +03:00
name: "HeadInt8PtrNilMultiFieldsOmitEmpty",
2021-01-16 20:53:54 +03:00
data: struct {
A *int8 `json:"a,omitempty"`
B *int8 `json:"b,omitempty"`
2021-02-14 20:08:22 +03:00
C *int8 `json:"c,omitempty"`
}{A: nil, B: nil, C: nil},
2021-01-16 16:16:26 +03:00
},
{
2021-02-14 20:08:22 +03:00
name: "HeadInt8PtrNilMultiFieldsString",
2021-01-16 20:53:54 +03:00
data: struct {
A *int8 `json:"a,string"`
B *int8 `json:"b,string"`
2021-02-14 20:08:22 +03:00
C *int8 `json:"c,string"`
}{A: nil, B: nil, C: nil},
2021-01-16 20:53:54 +03:00
},
// PtrHeadInt8ZeroMultiFields
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8ZeroMultiFields",
2021-01-16 20:53:54 +03:00
data: &struct {
A int8 `json:"a"`
B int8 `json:"b"`
}{},
},
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8ZeroMultiFieldsOmitEmpty",
2021-01-16 20:53:54 +03:00
data: &struct {
A int8 `json:"a,omitempty"`
B int8 `json:"b,omitempty"`
}{},
},
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8ZeroMultiFieldsString",
2021-01-16 20:53:54 +03:00
data: &struct {
A int8 `json:"a,string"`
B int8 `json:"b,string"`
}{},
},
// PtrHeadInt8MultiFields
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8MultiFields",
2021-01-16 20:53:54 +03:00
data: &struct {
A int8 `json:"a"`
B int8 `json:"b"`
}{A: 1, B: 2},
},
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8MultiFieldsOmitEmpty",
2021-01-16 20:53:54 +03:00
data: &struct {
A int8 `json:"a,omitempty"`
B int8 `json:"b,omitempty"`
}{A: 1, B: 2},
},
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8MultiFieldsString",
2021-01-16 20:53:54 +03:00
data: &struct {
A int8 `json:"a,string"`
B int8 `json:"b,string"`
}{A: 1, B: 2},
},
// PtrHeadInt8PtrMultiFields
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8PtrMultiFields",
2021-01-16 20:53:54 +03:00
data: &struct {
A *int8 `json:"a"`
B *int8 `json:"b"`
}{A: int8ptr(1), B: int8ptr(2)},
},
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8PtrMultiFieldsOmitEmpty",
2021-01-16 20:53:54 +03:00
data: &struct {
A *int8 `json:"a,omitempty"`
B *int8 `json:"b,omitempty"`
}{A: int8ptr(1), B: int8ptr(2)},
},
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8PtrMultiFieldsString",
2021-01-16 20:53:54 +03:00
data: &struct {
A *int8 `json:"a,string"`
B *int8 `json:"b,string"`
}{A: int8ptr(1), B: int8ptr(2)},
},
// PtrHeadInt8PtrNilMultiFields
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8PtrNilMultiFields",
2021-01-16 20:53:54 +03:00
data: &struct {
A *int8 `json:"a"`
B *int8 `json:"b"`
}{A: nil, B: nil},
},
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8PtrNilMultiFieldsOmitEmpty",
2021-01-16 20:53:54 +03:00
data: &struct {
A *int8 `json:"a,omitempty"`
B *int8 `json:"b,omitempty"`
}{A: nil, B: nil},
},
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8PtrNilMultiFieldsString",
2021-01-16 20:53:54 +03:00
data: &struct {
A *int8 `json:"a,string"`
B *int8 `json:"b,string"`
}{A: nil, B: nil},
},
// PtrHeadInt8NilMultiFields
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8NilMultiFields",
2021-01-16 20:53:54 +03:00
data: (*struct {
A *int8 `json:"a"`
B *int8 `json:"b"`
})(nil),
},
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8NilMultiFieldsOmitEmpty",
2021-01-16 20:53:54 +03:00
data: (*struct {
A *int8 `json:"a,omitempty"`
B *int8 `json:"b,omitempty"`
})(nil),
},
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8NilMultiFieldsString",
2021-01-16 20:53:54 +03:00
data: (*struct {
A *int8 `json:"a,string"`
B *int8 `json:"b,string"`
})(nil),
},
// HeadInt8ZeroNotRoot
{
2021-02-14 20:08:22 +03:00
name: "HeadInt8ZeroNotRoot",
2021-01-16 16:16:26 +03:00
data: struct {
A struct {
A int8 `json:"a"`
}
}{},
},
2021-01-16 20:53:54 +03:00
{
2021-02-14 20:08:22 +03:00
name: "HeadInt8ZeroNotRootOmitEmpty",
2021-01-16 20:53:54 +03:00
data: struct {
A struct {
A int8 `json:"a,omitempty"`
}
}{},
},
{
2021-02-14 20:08:22 +03:00
name: "HeadInt8ZeroNotRootString",
2021-01-16 20:53:54 +03:00
data: struct {
A struct {
A int8 `json:"a,string"`
}
}{},
},
// HeadInt8NotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-14 20:08:22 +03:00
name: "HeadInt8NotRoot",
2021-01-16 16:16:26 +03:00
data: struct {
A struct {
A int8 `json:"a"`
}
}{A: struct {
A int8 `json:"a"`
}{A: 1}},
},
{
2021-02-14 20:08:22 +03:00
name: "HeadInt8NotRootOmitEmpty",
2021-01-16 16:16:26 +03:00
data: struct {
A struct {
2021-01-16 20:53:54 +03:00
A int8 `json:"a,omitempty"`
2021-01-16 16:16:26 +03:00
}
}{A: struct {
2021-01-16 20:53:54 +03:00
A int8 `json:"a,omitempty"`
}{A: 1}},
2021-01-16 16:16:26 +03:00
},
{
2021-02-14 20:08:22 +03:00
name: "HeadInt8NotRootString",
2021-01-16 16:16:26 +03:00
data: struct {
A struct {
2021-01-16 20:53:54 +03:00
A int8 `json:"a,string"`
2021-01-16 16:16:26 +03:00
}
2021-01-16 20:53:54 +03:00
}{A: struct {
A int8 `json:"a,string"`
}{A: 1}},
2021-01-16 16:16:26 +03:00
},
2021-01-16 20:53:54 +03:00
// HeadInt8PtrNotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-14 20:08:22 +03:00
name: "HeadInt8PtrNotRoot",
2021-01-16 16:16:26 +03:00
data: struct {
2021-01-16 20:53:54 +03:00
A struct {
A *int8 `json:"a"`
2021-01-16 16:16:26 +03:00
}
2021-01-16 20:53:54 +03:00
}{A: struct {
A *int8 `json:"a"`
}{int8ptr(1)}},
2021-01-16 16:16:26 +03:00
},
{
2021-02-14 20:08:22 +03:00
name: "HeadInt8PtrNotRootOmitEmpty",
2021-01-16 16:16:26 +03:00
data: struct {
2021-01-16 20:53:54 +03:00
A struct {
A *int8 `json:"a,omitempty"`
2021-01-16 16:16:26 +03:00
}
2021-01-16 20:53:54 +03:00
}{A: struct {
A *int8 `json:"a,omitempty"`
}{int8ptr(1)}},
2021-01-16 16:16:26 +03:00
},
{
2021-02-14 20:08:22 +03:00
name: "HeadInt8PtrNotRootString",
2021-01-16 16:16:26 +03:00
data: struct {
2021-01-16 20:53:54 +03:00
A struct {
A *int8 `json:"a,string"`
2021-01-16 16:16:26 +03:00
}
2021-01-16 20:53:54 +03:00
}{A: struct {
A *int8 `json:"a,string"`
}{int8ptr(1)}},
2021-01-16 16:16:26 +03:00
},
2021-01-16 20:53:54 +03:00
// HeadInt8PtrNilNotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-14 20:08:22 +03:00
name: "HeadInt8PtrNilNotRoot",
2021-01-16 20:53:54 +03:00
data: struct {
A struct {
A *int8 `json:"a"`
}
}{},
},
{
2021-02-14 20:08:22 +03:00
name: "HeadInt8PtrNilNotRootOmitEmpty",
2021-01-16 20:53:54 +03:00
data: struct {
A struct {
A *int8 `json:"a,omitempty"`
}
}{},
},
{
2021-02-14 20:08:22 +03:00
name: "HeadInt8PtrNilNotRootString",
2021-01-16 20:53:54 +03:00
data: struct {
A struct {
A *int8 `json:"a,string"`
}
}{},
},
// PtrHeadInt8ZeroNotRoot
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8ZeroNotRoot",
2021-01-16 20:53:54 +03:00
data: struct {
A *struct {
A int8 `json:"a"`
}
}{A: new(struct {
A int8 `json:"a"`
})},
},
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8ZeroNotRootOmitEmpty",
2021-01-16 20:53:54 +03:00
data: struct {
A *struct {
A int8 `json:"a,omitempty"`
}
}{A: new(struct {
A int8 `json:"a,omitempty"`
})},
},
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8ZeroNotRootString",
2021-01-16 20:53:54 +03:00
data: struct {
A *struct {
A int8 `json:"a,string"`
}
}{A: new(struct {
A int8 `json:"a,string"`
})},
},
// PtrHeadInt8NotRoot
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8NotRoot",
2021-01-16 20:53:54 +03:00
data: struct {
A *struct {
A int8 `json:"a"`
}
}{A: &(struct {
A int8 `json:"a"`
}{A: 1})},
},
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8NotRootOmitEmpty",
2021-01-16 20:53:54 +03:00
data: struct {
A *struct {
A int8 `json:"a,omitempty"`
}
}{A: &(struct {
A int8 `json:"a,omitempty"`
}{A: 1})},
},
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8NotRootString",
2021-01-16 20:53:54 +03:00
data: struct {
A *struct {
A int8 `json:"a,string"`
}
}{A: &(struct {
A int8 `json:"a,string"`
}{A: 1})},
},
// PtrHeadInt8PtrNotRoot
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8PtrNotRoot",
2021-01-16 20:53:54 +03:00
data: struct {
A *struct {
A *int8 `json:"a"`
}
}{A: &(struct {
A *int8 `json:"a"`
}{A: int8ptr(1)})},
},
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8PtrNotRootOmitEmpty",
2021-01-16 20:53:54 +03:00
data: struct {
A *struct {
A *int8 `json:"a,omitempty"`
}
}{A: &(struct {
A *int8 `json:"a,omitempty"`
}{A: int8ptr(1)})},
},
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8PtrNotRootString",
2021-01-16 20:53:54 +03:00
data: struct {
A *struct {
A *int8 `json:"a,string"`
}
}{A: &(struct {
A *int8 `json:"a,string"`
}{A: int8ptr(1)})},
},
// PtrHeadInt8PtrNilNotRoot
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8PtrNilNotRoot",
2021-01-16 20:53:54 +03:00
data: struct {
A *struct {
A *int8 `json:"a"`
}
}{A: &(struct {
A *int8 `json:"a"`
}{A: nil})},
},
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8PtrNilNotRootOmitEmpty",
2021-01-16 20:53:54 +03:00
data: struct {
A *struct {
A *int8 `json:"a,omitempty"`
}
}{A: &(struct {
A *int8 `json:"a,omitempty"`
}{A: nil})},
},
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8PtrNilNotRootString",
2021-01-16 20:53:54 +03:00
data: struct {
A *struct {
A *int8 `json:"a,string"`
}
}{A: &(struct {
A *int8 `json:"a,string"`
}{A: nil})},
},
// PtrHeadInt8NilNotRoot
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8NilNotRoot",
2021-01-16 20:53:54 +03:00
data: struct {
A *struct {
A *int8 `json:"a"`
}
}{A: nil},
},
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8NilNotRootOmitEmpty",
2021-01-16 20:53:54 +03:00
data: struct {
A *struct {
A *int8 `json:"a,omitempty"`
} `json:",omitempty"`
}{A: nil},
},
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8NilNotRootString",
2021-01-16 20:53:54 +03:00
data: struct {
A *struct {
A *int8 `json:"a,string"`
} `json:",string"`
}{A: nil},
},
// HeadInt8ZeroMultiFieldsNotRoot
{
2021-02-14 20:08:22 +03:00
name: "HeadInt8ZeroMultiFieldsNotRoot",
2021-01-16 20:53:54 +03:00
data: struct {
A struct {
A int8 `json:"a"`
}
B struct {
B int8 `json:"b"`
}
}{},
},
{
2021-02-14 20:08:22 +03:00
name: "HeadInt8ZeroMultiFieldsNotRootOmitEmpty",
2021-01-16 20:53:54 +03:00
data: struct {
A struct {
A int8 `json:"a,omitempty"`
}
B struct {
B int8 `json:"b,omitempty"`
}
}{},
},
{
2021-02-14 20:08:22 +03:00
name: "HeadInt8ZeroMultiFieldsNotRootString",
2021-01-16 20:53:54 +03:00
data: struct {
A struct {
A int8 `json:"a,string"`
}
B struct {
B int8 `json:"b,string"`
}
}{},
},
// HeadInt8MultiFieldsNotRoot
{
2021-02-14 20:08:22 +03:00
name: "HeadInt8MultiFieldsNotRoot",
2021-01-16 20:53:54 +03:00
data: struct {
A struct {
A int8 `json:"a"`
}
B struct {
B int8 `json:"b"`
}
}{A: struct {
A int8 `json:"a"`
}{A: 1}, B: struct {
B int8 `json:"b"`
}{B: 2}},
},
{
2021-02-14 20:08:22 +03:00
name: "HeadInt8MultiFieldsNotRootOmitEmpty",
2021-01-16 20:53:54 +03:00
data: struct {
A struct {
A int8 `json:"a,omitempty"`
}
B struct {
B int8 `json:"b,omitempty"`
}
}{A: struct {
A int8 `json:"a,omitempty"`
}{A: 1}, B: struct {
B int8 `json:"b,omitempty"`
}{B: 2}},
},
{
2021-02-14 20:08:22 +03:00
name: "HeadInt8MultiFieldsNotRootString",
2021-01-16 20:53:54 +03:00
data: struct {
A struct {
A int8 `json:"a,string"`
}
B struct {
B int8 `json:"b,string"`
}
}{A: struct {
A int8 `json:"a,string"`
}{A: 1}, B: struct {
B int8 `json:"b,string"`
}{B: 2}},
},
// HeadInt8PtrMultiFieldsNotRoot
{
2021-02-14 20:08:22 +03:00
name: "HeadInt8PtrMultiFieldsNotRoot",
2021-01-16 20:53:54 +03:00
data: struct {
A struct {
A *int8 `json:"a"`
}
B struct {
B *int8 `json:"b"`
}
}{A: struct {
A *int8 `json:"a"`
}{A: int8ptr(1)}, B: struct {
B *int8 `json:"b"`
}{B: int8ptr(2)}},
},
{
2021-02-14 20:08:22 +03:00
name: "HeadInt8PtrMultiFieldsNotRootOmitEmpty",
2021-01-16 20:53:54 +03:00
data: struct {
A struct {
A *int8 `json:"a,omitempty"`
}
B struct {
B *int8 `json:"b,omitempty"`
}
}{A: struct {
A *int8 `json:"a,omitempty"`
}{A: int8ptr(1)}, B: struct {
B *int8 `json:"b,omitempty"`
}{B: int8ptr(2)}},
},
{
2021-02-14 20:08:22 +03:00
name: "HeadInt8PtrMultiFieldsNotRootString",
2021-01-16 20:53:54 +03:00
data: struct {
A struct {
A *int8 `json:"a,string"`
}
B struct {
B *int8 `json:"b,string"`
}
}{A: struct {
A *int8 `json:"a,string"`
}{A: int8ptr(1)}, B: struct {
B *int8 `json:"b,string"`
}{B: int8ptr(2)}},
},
// HeadInt8PtrNilMultiFieldsNotRoot
{
2021-02-14 20:08:22 +03:00
name: "HeadInt8PtrNilMultiFieldsNotRoot",
2021-01-16 20:53:54 +03:00
data: struct {
A struct {
A *int8 `json:"a"`
}
B struct {
B *int8 `json:"b"`
}
}{A: struct {
A *int8 `json:"a"`
}{A: nil}, B: struct {
B *int8 `json:"b"`
}{B: nil}},
},
{
2021-02-14 20:08:22 +03:00
name: "HeadInt8PtrNilMultiFieldsNotRootOmitEmpty",
2021-01-16 20:53:54 +03:00
data: struct {
A struct {
A *int8 `json:"a,omitempty"`
}
B struct {
B *int8 `json:"b,omitempty"`
}
}{A: struct {
A *int8 `json:"a,omitempty"`
}{A: nil}, B: struct {
B *int8 `json:"b,omitempty"`
}{B: nil}},
},
{
2021-02-14 20:08:22 +03:00
name: "HeadInt8PtrNilMultiFieldsNotRootString",
2021-01-16 20:53:54 +03:00
data: struct {
A struct {
A *int8 `json:"a,string"`
}
B struct {
B *int8 `json:"b,string"`
}
}{A: struct {
A *int8 `json:"a,string"`
}{A: nil}, B: struct {
B *int8 `json:"b,string"`
}{B: nil}},
},
// PtrHeadInt8ZeroMultiFieldsNotRoot
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8ZeroMultiFieldsNotRoot",
2021-01-16 20:53:54 +03:00
data: &struct {
A struct {
A int8 `json:"a"`
2021-01-16 16:16:26 +03:00
}
2021-01-16 20:53:54 +03:00
B struct {
B int8 `json:"b"`
}
}{},
2021-01-16 16:16:26 +03:00
},
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8ZeroMultiFieldsNotRootOmitEmpty",
2021-01-16 20:53:54 +03:00
data: &struct {
A struct {
A int8 `json:"a,omitempty"`
2021-01-16 16:16:26 +03:00
}
2021-01-16 20:53:54 +03:00
B struct {
B int8 `json:"b,omitempty"`
}
}{},
2021-01-16 16:16:26 +03:00
},
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8ZeroMultiFieldsNotRootString",
2021-01-16 20:53:54 +03:00
data: &struct {
2021-01-16 16:16:26 +03:00
A struct {
2021-01-16 20:53:54 +03:00
A int8 `json:"a,string"`
2021-01-16 16:16:26 +03:00
}
B struct {
2021-01-16 20:53:54 +03:00
B int8 `json:"b,string"`
2021-01-16 16:16:26 +03:00
}
}{},
},
2021-01-16 20:53:54 +03:00
// PtrHeadInt8MultiFieldsNotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8MultiFieldsNotRoot",
2021-01-16 20:53:54 +03:00
data: &struct {
2021-01-16 16:16:26 +03:00
A struct {
A int8 `json:"a"`
}
B struct {
B int8 `json:"b"`
}
}{A: struct {
A int8 `json:"a"`
}{A: 1}, B: struct {
B int8 `json:"b"`
}{B: 2}},
},
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8MultiFieldsNotRootOmitEmpty",
2021-01-16 20:53:54 +03:00
data: &struct {
2021-01-16 16:16:26 +03:00
A struct {
2021-01-16 20:53:54 +03:00
A int8 `json:"a,omitempty"`
2021-01-16 16:16:26 +03:00
}
B struct {
2021-01-16 20:53:54 +03:00
B int8 `json:"b,omitempty"`
2021-01-16 16:16:26 +03:00
}
}{A: struct {
2021-01-16 20:53:54 +03:00
A int8 `json:"a,omitempty"`
}{A: 1}, B: struct {
B int8 `json:"b,omitempty"`
}{B: 2}},
2021-01-16 16:16:26 +03:00
},
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8MultiFieldsNotRootString",
2021-01-16 20:53:54 +03:00
data: &struct {
2021-01-16 16:16:26 +03:00
A struct {
2021-01-16 20:53:54 +03:00
A int8 `json:"a,string"`
2021-01-16 16:16:26 +03:00
}
B struct {
2021-01-16 20:53:54 +03:00
B int8 `json:"b,string"`
2021-01-16 16:16:26 +03:00
}
}{A: struct {
2021-01-16 20:53:54 +03:00
A int8 `json:"a,string"`
}{A: 1}, B: struct {
B int8 `json:"b,string"`
}{B: 2}},
2021-01-16 16:16:26 +03:00
},
2021-01-16 20:53:54 +03:00
// PtrHeadInt8PtrMultiFieldsNotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8PtrMultiFieldsNotRoot",
2021-01-16 16:16:26 +03:00
data: &struct {
2021-01-16 20:53:54 +03:00
A *struct {
A *int8 `json:"a"`
2021-01-16 16:16:26 +03:00
}
2021-01-16 20:53:54 +03:00
B *struct {
B *int8 `json:"b"`
2021-01-16 16:16:26 +03:00
}
2021-01-16 20:53:54 +03:00
}{A: &(struct {
A *int8 `json:"a"`
}{A: int8ptr(1)}), B: &(struct {
B *int8 `json:"b"`
}{B: int8ptr(2)})},
2021-01-16 16:16:26 +03:00
},
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8PtrMultiFieldsNotRootOmitEmpty",
2021-01-16 16:16:26 +03:00
data: &struct {
2021-01-16 20:53:54 +03:00
A *struct {
A *int8 `json:"a,omitempty"`
}
B *struct {
B *int8 `json:"b,omitempty"`
}
}{A: &(struct {
A *int8 `json:"a,omitempty"`
}{A: int8ptr(1)}), B: &(struct {
B *int8 `json:"b,omitempty"`
}{B: int8ptr(2)})},
},
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8PtrMultiFieldsNotRootString",
2021-01-16 20:53:54 +03:00
data: &struct {
A *struct {
A *int8 `json:"a,string"`
}
B *struct {
B *int8 `json:"b,string"`
}
}{A: &(struct {
A *int8 `json:"a,string"`
}{A: int8ptr(1)}), B: &(struct {
B *int8 `json:"b,string"`
}{B: int8ptr(2)})},
},
// PtrHeadInt8PtrNilMultiFieldsNotRoot
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8PtrNilMultiFieldsNotRoot",
2021-01-16 20:53:54 +03:00
data: &struct {
A *struct {
A *int8 `json:"a"`
}
B *struct {
B *int8 `json:"b"`
}
}{A: nil, B: nil},
},
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8PtrNilMultiFieldsNotRootOmitEmpty",
2021-01-16 20:53:54 +03:00
data: &struct {
A *struct {
A *int8 `json:"a,omitempty"`
} `json:",omitempty"`
B *struct {
B *int8 `json:"b,omitempty"`
} `json:",omitempty"`
}{A: nil, B: nil},
},
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8PtrNilMultiFieldsNotRootString",
2021-01-16 20:53:54 +03:00
data: &struct {
A *struct {
A *int8 `json:"a,string"`
} `json:",string"`
B *struct {
B *int8 `json:"b,string"`
} `json:",string"`
}{A: nil, B: nil},
},
// PtrHeadInt8NilMultiFieldsNotRoot
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8NilMultiFieldsNotRoot",
2021-01-16 20:53:54 +03:00
data: (*struct {
A *struct {
A *int8 `json:"a"`
}
B *struct {
B *int8 `json:"b"`
}
})(nil),
},
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8NilMultiFieldsNotRootOmitEmpty",
2021-01-16 20:53:54 +03:00
data: (*struct {
A *struct {
A *int8 `json:"a,omitempty"`
}
B *struct {
B *int8 `json:"b,omitempty"`
}
})(nil),
},
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8NilMultiFieldsNotRootString",
2021-01-16 20:53:54 +03:00
data: (*struct {
A *struct {
A *int8 `json:"a,string"`
}
B *struct {
B *int8 `json:"b,string"`
}
})(nil),
},
// PtrHeadInt8DoubleMultiFieldsNotRoot
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8DoubleMultiFieldsNotRoot",
2021-01-16 20:53:54 +03:00
data: &struct {
A *struct {
2021-01-16 16:16:26 +03:00
A int8 `json:"a"`
2021-01-16 20:53:54 +03:00
B int8 `json:"b"`
2021-01-16 16:16:26 +03:00
}
2021-01-16 20:53:54 +03:00
B *struct {
A int8 `json:"a"`
2021-01-16 16:16:26 +03:00
B int8 `json:"b"`
}
2021-01-16 20:53:54 +03:00
}{A: &(struct {
2021-01-16 16:16:26 +03:00
A int8 `json:"a"`
B int8 `json:"b"`
2021-01-16 20:53:54 +03:00
}{A: 1, B: 2}), B: &(struct {
A int8 `json:"a"`
B int8 `json:"b"`
}{A: 3, B: 4})},
2021-01-16 16:16:26 +03:00
},
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8DoubleMultiFieldsNotRootOmitEmpty",
2021-01-16 20:53:54 +03:00
data: &struct {
A *struct {
A int8 `json:"a,omitempty"`
B int8 `json:"b,omitempty"`
}
B *struct {
A int8 `json:"a,omitempty"`
B int8 `json:"b,omitempty"`
}
}{A: &(struct {
A int8 `json:"a,omitempty"`
B int8 `json:"b,omitempty"`
}{A: 1, B: 2}), B: &(struct {
A int8 `json:"a,omitempty"`
B int8 `json:"b,omitempty"`
}{A: 3, B: 4})},
},
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8DoubleMultiFieldsNotRootString",
2021-01-16 16:16:26 +03:00
data: &struct {
A *struct {
2021-01-16 20:53:54 +03:00
A int8 `json:"a,string"`
B int8 `json:"b,string"`
2021-01-16 16:16:26 +03:00
}
B *struct {
2021-01-16 20:53:54 +03:00
A int8 `json:"a,string"`
B int8 `json:"b,string"`
2021-01-16 16:16:26 +03:00
}
}{A: &(struct {
2021-01-16 20:53:54 +03:00
A int8 `json:"a,string"`
B int8 `json:"b,string"`
}{A: 1, B: 2}), B: &(struct {
A int8 `json:"a,string"`
B int8 `json:"b,string"`
}{A: 3, B: 4})},
2021-01-16 16:16:26 +03:00
},
2021-01-16 20:53:54 +03:00
// PtrHeadInt8NilDoubleMultiFieldsNotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8NilDoubleMultiFieldsNotRoot",
2021-01-16 16:16:26 +03:00
data: &struct {
A *struct {
2021-01-16 20:53:54 +03:00
A int8 `json:"a"`
B int8 `json:"b"`
2021-01-16 16:16:26 +03:00
}
B *struct {
2021-01-16 20:53:54 +03:00
A int8 `json:"a"`
B int8 `json:"b"`
2021-01-16 16:16:26 +03:00
}
}{A: nil, B: nil},
},
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8NilDoubleMultiFieldsNotRootOmitEmpty",
2021-01-16 20:53:54 +03:00
data: &struct {
2021-01-16 16:16:26 +03:00
A *struct {
2021-01-16 20:53:54 +03:00
A int8 `json:"a,omitempty"`
B int8 `json:"b,omitempty"`
} `json:",omitempty"`
2021-01-16 16:16:26 +03:00
B *struct {
2021-01-16 20:53:54 +03:00
A int8 `json:"a,omitempty"`
B int8 `json:"b,omitempty"`
} `json:",omitempty"`
}{A: nil, B: nil},
2021-01-16 16:16:26 +03:00
},
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8NilDoubleMultiFieldsNotRootString",
2021-01-16 16:16:26 +03:00
data: &struct {
A *struct {
2021-01-16 20:53:54 +03:00
A int8 `json:"a,string"`
B int8 `json:"b,string"`
2021-01-16 16:16:26 +03:00
}
B *struct {
2021-01-16 20:53:54 +03:00
A int8 `json:"a,string"`
B int8 `json:"b,string"`
2021-01-16 16:16:26 +03:00
}
2021-01-16 20:53:54 +03:00
}{A: nil, B: nil},
2021-01-16 16:16:26 +03:00
},
2021-01-16 20:53:54 +03:00
// PtrHeadInt8NilDoubleMultiFieldsNotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8NilDoubleMultiFieldsNotRoot",
2021-01-16 20:53:54 +03:00
data: (*struct {
2021-01-16 16:16:26 +03:00
A *struct {
A int8 `json:"a"`
B int8 `json:"b"`
}
B *struct {
A int8 `json:"a"`
B int8 `json:"b"`
}
2021-01-16 20:53:54 +03:00
})(nil),
2021-01-16 16:16:26 +03:00
},
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8NilDoubleMultiFieldsNotRootOmitEmpty",
2021-01-16 16:16:26 +03:00
data: (*struct {
A *struct {
2021-01-16 20:53:54 +03:00
A int8 `json:"a,omitempty"`
B int8 `json:"b,omitempty"`
2021-01-16 16:16:26 +03:00
}
B *struct {
2021-01-16 20:53:54 +03:00
A int8 `json:"a,omitempty"`
B int8 `json:"b,omitempty"`
}
})(nil),
},
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8NilDoubleMultiFieldsNotRootString",
2021-01-16 20:53:54 +03:00
data: (*struct {
A *struct {
A int8 `json:"a,string"`
B int8 `json:"b,string"`
}
B *struct {
A int8 `json:"a,string"`
B int8 `json:"b,string"`
2021-01-16 16:16:26 +03:00
}
})(nil),
},
2021-01-16 20:53:54 +03:00
// PtrHeadInt8PtrDoubleMultiFieldsNotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8PtrDoubleMultiFieldsNotRoot",
2021-01-16 16:16:26 +03:00
data: &struct {
A *struct {
A *int8 `json:"a"`
B *int8 `json:"b"`
}
B *struct {
A *int8 `json:"a"`
B *int8 `json:"b"`
}
}{A: &(struct {
A *int8 `json:"a"`
B *int8 `json:"b"`
}{A: int8ptr(1), B: int8ptr(2)}), B: &(struct {
A *int8 `json:"a"`
B *int8 `json:"b"`
}{A: int8ptr(3), B: int8ptr(4)})},
},
2021-01-16 20:53:54 +03:00
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8PtrDoubleMultiFieldsNotRootOmitEmpty",
2021-01-16 20:53:54 +03:00
data: &struct {
A *struct {
A *int8 `json:"a,omitempty"`
B *int8 `json:"b,omitempty"`
}
B *struct {
A *int8 `json:"a,omitempty"`
B *int8 `json:"b,omitempty"`
}
}{A: &(struct {
A *int8 `json:"a,omitempty"`
B *int8 `json:"b,omitempty"`
}{A: int8ptr(1), B: int8ptr(2)}), B: &(struct {
A *int8 `json:"a,omitempty"`
B *int8 `json:"b,omitempty"`
}{A: int8ptr(3), B: int8ptr(4)})},
},
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8PtrDoubleMultiFieldsNotRootString",
2021-01-16 20:53:54 +03:00
data: &struct {
A *struct {
A *int8 `json:"a,string"`
B *int8 `json:"b,string"`
}
B *struct {
A *int8 `json:"a,string"`
B *int8 `json:"b,string"`
}
}{A: &(struct {
A *int8 `json:"a,string"`
B *int8 `json:"b,string"`
}{A: int8ptr(1), B: int8ptr(2)}), B: &(struct {
A *int8 `json:"a,string"`
B *int8 `json:"b,string"`
}{A: int8ptr(3), B: int8ptr(4)})},
},
// PtrHeadInt8PtrNilDoubleMultiFieldsNotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8PtrNilDoubleMultiFieldsNotRoot",
2021-01-16 16:16:26 +03:00
data: &struct {
A *struct {
A *int8 `json:"a"`
B *int8 `json:"b"`
}
B *struct {
A *int8 `json:"a"`
B *int8 `json:"b"`
}
}{A: nil, B: nil},
},
2021-01-16 20:53:54 +03:00
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8PtrNilDoubleMultiFieldsNotRootOmitEmpty",
2021-01-16 20:53:54 +03:00
data: &struct {
A *struct {
A *int8 `json:"a,omitempty"`
B *int8 `json:"b,omitempty"`
} `json:",omitempty"`
B *struct {
A *int8 `json:"a,omitempty"`
B *int8 `json:"b,omitempty"`
} `json:",omitempty"`
}{A: nil, B: nil},
},
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8PtrNilDoubleMultiFieldsNotRootString",
2021-01-16 20:53:54 +03:00
data: &struct {
A *struct {
A *int8 `json:"a,string"`
B *int8 `json:"b,string"`
}
B *struct {
A *int8 `json:"a,string"`
B *int8 `json:"b,string"`
}
}{A: nil, B: nil},
},
// PtrHeadInt8PtrNilDoubleMultiFieldsNotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8PtrNilDoubleMultiFieldsNotRoot",
2021-01-16 16:16:26 +03:00
data: (*struct {
A *struct {
A *int8 `json:"a"`
B *int8 `json:"b"`
}
B *struct {
A *int8 `json:"a"`
B *int8 `json:"b"`
}
})(nil),
},
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8PtrNilDoubleMultiFieldsNotRootOmitEmpty",
2021-01-16 20:53:54 +03:00
data: (*struct {
A *struct {
A *int8 `json:"a,omitempty"`
B *int8 `json:"b,omitempty"`
}
B *struct {
A *int8 `json:"a,omitempty"`
B *int8 `json:"b,omitempty"`
}
})(nil),
},
{
2021-02-14 20:08:22 +03:00
name: "PtrHeadInt8PtrNilDoubleMultiFieldsNotRootString",
2021-01-16 20:53:54 +03:00
data: (*struct {
A *struct {
A *int8 `json:"a,string"`
B *int8 `json:"b,string"`
}
B *struct {
A *int8 `json:"a,string"`
B *int8 `json:"b,string"`
}
})(nil),
},
// AnonymousHeadInt8
{
2021-02-14 20:08:22 +03:00
name: "AnonymousHeadInt8",
2021-01-16 20:53:54 +03:00
data: struct {
structInt8
B int8 `json:"b"`
}{
structInt8: structInt8{A: 1},
B: 2,
},
},
{
2021-02-14 20:08:22 +03:00
name: "AnonymousHeadInt8OmitEmpty",
2021-01-16 20:53:54 +03:00
data: struct {
structInt8OmitEmpty
B int8 `json:"b,omitempty"`
}{
structInt8OmitEmpty: structInt8OmitEmpty{A: 1},
B: 2,
},
},
{
2021-02-14 20:08:22 +03:00
name: "AnonymousHeadInt8String",
2021-01-16 20:53:54 +03:00
data: struct {
structInt8String
B int8 `json:"b,string"`
}{
structInt8String: structInt8String{A: 1},
B: 2,
},
},
// PtrAnonymousHeadInt8
{
2021-02-14 20:08:22 +03:00
name: "PtrAnonymousHeadInt8",
2021-01-16 20:53:54 +03:00
data: struct {
*structInt8
B int8 `json:"b"`
}{
structInt8: &structInt8{A: 1},
B: 2,
},
},
{
2021-02-14 20:08:22 +03:00
name: "PtrAnonymousHeadInt8OmitEmpty",
2021-01-16 20:53:54 +03:00
data: struct {
*structInt8OmitEmpty
B int8 `json:"b,omitempty"`
}{
structInt8OmitEmpty: &structInt8OmitEmpty{A: 1},
B: 2,
},
},
{
2021-02-14 20:08:22 +03:00
name: "PtrAnonymousHeadInt8String",
2021-01-16 20:53:54 +03:00
data: struct {
*structInt8String
B int8 `json:"b,string"`
}{
structInt8String: &structInt8String{A: 1},
B: 2,
},
},
// NilPtrAnonymousHeadInt8
{
2021-02-14 20:08:22 +03:00
name: "NilPtrAnonymousHeadInt8",
2021-01-16 16:16:26 +03:00
data: struct {
2021-01-16 20:53:54 +03:00
*structInt8
2021-01-16 16:16:26 +03:00
B int8 `json:"b"`
}{
2021-01-16 20:53:54 +03:00
structInt8: nil,
2021-01-16 16:16:26 +03:00
B: 2,
},
},
{
2021-02-14 20:08:22 +03:00
name: "NilPtrAnonymousHeadInt8OmitEmpty",
2021-01-16 16:16:26 +03:00
data: struct {
2021-01-16 20:53:54 +03:00
*structInt8OmitEmpty
B int8 `json:"b,omitempty"`
2021-01-16 16:16:26 +03:00
}{
2021-01-16 20:53:54 +03:00
structInt8OmitEmpty: nil,
B: 2,
2021-01-16 16:16:26 +03:00
},
},
{
2021-02-14 20:08:22 +03:00
name: "NilPtrAnonymousHeadInt8String",
2021-01-16 16:16:26 +03:00
data: struct {
2021-01-16 20:53:54 +03:00
*structInt8String
B int8 `json:"b,string"`
2021-01-16 16:16:26 +03:00
}{
2021-01-16 20:53:54 +03:00
structInt8String: nil,
B: 2,
2021-01-16 16:16:26 +03:00
},
},
2021-01-16 20:53:54 +03:00
// AnonymousHeadInt8Ptr
2021-01-16 16:16:26 +03:00
{
2021-02-14 20:08:22 +03:00
name: "AnonymousHeadInt8Ptr",
2021-01-16 16:16:26 +03:00
data: struct {
structInt8Ptr
B *int8 `json:"b"`
}{
structInt8Ptr: structInt8Ptr{A: int8ptr(1)},
B: int8ptr(2),
},
},
2021-01-16 20:53:54 +03:00
{
2021-02-14 20:08:22 +03:00
name: "AnonymousHeadInt8PtrOmitEmpty",
2021-01-16 20:53:54 +03:00
data: struct {
structInt8PtrOmitEmpty
B *int8 `json:"b,omitempty"`
}{
structInt8PtrOmitEmpty: structInt8PtrOmitEmpty{A: int8ptr(1)},
B: int8ptr(2),
},
},
{
2021-02-14 20:08:22 +03:00
name: "AnonymousHeadInt8PtrString",
2021-01-16 20:53:54 +03:00
data: struct {
structInt8PtrString
B *int8 `json:"b,string"`
}{
structInt8PtrString: structInt8PtrString{A: int8ptr(1)},
B: int8ptr(2),
},
},
// AnonymousHeadInt8PtrNil
2021-01-16 16:16:26 +03:00
{
2021-02-14 20:08:22 +03:00
name: "AnonymousHeadInt8PtrNil",
2021-01-16 16:16:26 +03:00
data: struct {
structInt8Ptr
B *int8 `json:"b"`
}{
structInt8Ptr: structInt8Ptr{A: nil},
B: int8ptr(2),
},
},
2021-01-16 20:53:54 +03:00
{
2021-02-14 20:08:22 +03:00
name: "AnonymousHeadInt8PtrNilOmitEmpty",
2021-01-16 20:53:54 +03:00
data: struct {
structInt8PtrOmitEmpty
B *int8 `json:"b,omitempty"`
}{
structInt8PtrOmitEmpty: structInt8PtrOmitEmpty{A: nil},
B: int8ptr(2),
},
},
{
2021-02-14 20:08:22 +03:00
name: "AnonymousHeadInt8PtrNilString",
2021-01-16 20:53:54 +03:00
data: struct {
structInt8PtrString
B *int8 `json:"b,string"`
}{
structInt8PtrString: structInt8PtrString{A: nil},
B: int8ptr(2),
},
},
// PtrAnonymousHeadInt8Ptr
2021-01-16 16:16:26 +03:00
{
2021-02-14 20:08:22 +03:00
name: "PtrAnonymousHeadInt8Ptr",
2021-01-16 16:16:26 +03:00
data: struct {
*structInt8Ptr
B *int8 `json:"b"`
}{
structInt8Ptr: &structInt8Ptr{A: int8ptr(1)},
B: int8ptr(2),
},
},
2021-01-16 20:53:54 +03:00
{
2021-02-14 20:08:22 +03:00
name: "PtrAnonymousHeadInt8PtrOmitEmpty",
2021-01-16 20:53:54 +03:00
data: struct {
*structInt8PtrOmitEmpty
B *int8 `json:"b,omitempty"`
}{
structInt8PtrOmitEmpty: &structInt8PtrOmitEmpty{A: int8ptr(1)},
B: int8ptr(2),
},
},
{
2021-02-14 20:08:22 +03:00
name: "PtrAnonymousHeadInt8PtrString",
2021-01-16 20:53:54 +03:00
data: struct {
*structInt8PtrString
B *int8 `json:"b,string"`
}{
structInt8PtrString: &structInt8PtrString{A: int8ptr(1)},
B: int8ptr(2),
},
},
// NilPtrAnonymousHeadInt8Ptr
2021-01-16 16:16:26 +03:00
{
2021-02-14 20:08:22 +03:00
name: "NilPtrAnonymousHeadInt8Ptr",
2021-01-16 16:16:26 +03:00
data: struct {
*structInt8Ptr
B *int8 `json:"b"`
}{
structInt8Ptr: nil,
B: int8ptr(2),
},
},
2021-01-16 20:53:54 +03:00
{
2021-02-14 20:08:22 +03:00
name: "NilPtrAnonymousHeadInt8PtrOmitEmpty",
2021-01-16 20:53:54 +03:00
data: struct {
*structInt8PtrOmitEmpty
B *int8 `json:"b,omitempty"`
}{
structInt8PtrOmitEmpty: nil,
B: int8ptr(2),
},
},
{
2021-02-14 20:08:22 +03:00
name: "NilPtrAnonymousHeadInt8PtrString",
2021-01-16 20:53:54 +03:00
data: struct {
*structInt8PtrString
B *int8 `json:"b,string"`
}{
structInt8PtrString: nil,
B: int8ptr(2),
},
},
// AnonymousHeadInt8Only
2021-01-16 16:16:26 +03:00
{
2021-02-14 20:08:22 +03:00
name: "AnonymousHeadInt8Only",
2021-01-16 16:16:26 +03:00
data: struct {
structInt8
}{
structInt8: structInt8{A: 1},
},
},
2021-01-16 20:53:54 +03:00
{
2021-02-14 20:08:22 +03:00
name: "AnonymousHeadInt8OnlyOmitEmpty",
2021-01-16 20:53:54 +03:00
data: struct {
structInt8OmitEmpty
}{
structInt8OmitEmpty: structInt8OmitEmpty{A: 1},
},
},
{
2021-02-14 20:08:22 +03:00
name: "AnonymousHeadInt8OnlyString",
2021-01-16 20:53:54 +03:00
data: struct {
structInt8String
}{
structInt8String: structInt8String{A: 1},
},
},
// PtrAnonymousHeadInt8Only
2021-01-16 16:16:26 +03:00
{
2021-02-14 20:08:22 +03:00
name: "PtrAnonymousHeadInt8Only",
2021-01-16 16:16:26 +03:00
data: struct {
*structInt8
}{
structInt8: &structInt8{A: 1},
},
},
2021-01-16 20:53:54 +03:00
{
2021-02-14 20:08:22 +03:00
name: "PtrAnonymousHeadInt8OnlyOmitEmpty",
2021-01-16 20:53:54 +03:00
data: struct {
*structInt8OmitEmpty
}{
structInt8OmitEmpty: &structInt8OmitEmpty{A: 1},
},
},
{
2021-02-14 20:08:22 +03:00
name: "PtrAnonymousHeadInt8OnlyString",
2021-01-16 20:53:54 +03:00
data: struct {
*structInt8String
}{
structInt8String: &structInt8String{A: 1},
},
},
// NilPtrAnonymousHeadInt8Only
2021-01-16 16:16:26 +03:00
{
2021-02-14 20:08:22 +03:00
name: "NilPtrAnonymousHeadInt8Only",
2021-01-16 16:16:26 +03:00
data: struct {
*structInt8
}{
structInt8: nil,
},
},
2021-01-16 20:53:54 +03:00
{
2021-02-14 20:08:22 +03:00
name: "NilPtrAnonymousHeadInt8OnlyOmitEmpty",
2021-01-16 20:53:54 +03:00
data: struct {
*structInt8OmitEmpty
}{
structInt8OmitEmpty: nil,
},
},
{
2021-02-14 20:08:22 +03:00
name: "NilPtrAnonymousHeadInt8OnlyString",
2021-01-16 20:53:54 +03:00
data: struct {
*structInt8String
}{
structInt8String: nil,
},
},
// AnonymousHeadInt8PtrOnly
2021-01-16 16:16:26 +03:00
{
2021-02-14 20:08:22 +03:00
name: "AnonymousHeadInt8PtrOnly",
2021-01-16 16:16:26 +03:00
data: struct {
structInt8Ptr
}{
structInt8Ptr: structInt8Ptr{A: int8ptr(1)},
},
},
2021-01-16 20:53:54 +03:00
{
2021-02-14 20:08:22 +03:00
name: "AnonymousHeadInt8PtrOnlyOmitEmpty",
2021-01-16 20:53:54 +03:00
data: struct {
structInt8PtrOmitEmpty
}{
structInt8PtrOmitEmpty: structInt8PtrOmitEmpty{A: int8ptr(1)},
},
},
{
2021-02-14 20:08:22 +03:00
name: "AnonymousHeadInt8PtrOnlyString",
2021-01-16 20:53:54 +03:00
data: struct {
structInt8PtrString
}{
structInt8PtrString: structInt8PtrString{A: int8ptr(1)},
},
},
// AnonymousHeadInt8PtrNilOnly
2021-01-16 16:16:26 +03:00
{
2021-02-14 20:08:22 +03:00
name: "AnonymousHeadInt8PtrNilOnly",
2021-01-16 16:16:26 +03:00
data: struct {
structInt8Ptr
}{
structInt8Ptr: structInt8Ptr{A: nil},
},
},
2021-01-16 20:53:54 +03:00
{
2021-02-14 20:08:22 +03:00
name: "AnonymousHeadInt8PtrNilOnlyOmitEmpty",
2021-01-16 20:53:54 +03:00
data: struct {
structInt8PtrOmitEmpty
}{
structInt8PtrOmitEmpty: structInt8PtrOmitEmpty{A: nil},
},
},
{
2021-02-14 20:08:22 +03:00
name: "AnonymousHeadInt8PtrNilOnlyString",
2021-01-16 20:53:54 +03:00
data: struct {
structInt8PtrString
}{
structInt8PtrString: structInt8PtrString{A: nil},
},
},
// PtrAnonymousHeadInt8PtrOnly
2021-01-16 16:16:26 +03:00
{
2021-02-14 20:08:22 +03:00
name: "PtrAnonymousHeadInt8PtrOnly",
2021-01-16 16:16:26 +03:00
data: struct {
*structInt8Ptr
}{
structInt8Ptr: &structInt8Ptr{A: int8ptr(1)},
},
},
2021-01-16 20:53:54 +03:00
{
2021-02-14 20:08:22 +03:00
name: "PtrAnonymousHeadInt8PtrOnlyOmitEmpty",
2021-01-16 20:53:54 +03:00
data: struct {
*structInt8PtrOmitEmpty
}{
structInt8PtrOmitEmpty: &structInt8PtrOmitEmpty{A: int8ptr(1)},
},
},
{
2021-02-14 20:08:22 +03:00
name: "PtrAnonymousHeadInt8PtrOnlyString",
2021-01-16 20:53:54 +03:00
data: struct {
*structInt8PtrString
}{
structInt8PtrString: &structInt8PtrString{A: int8ptr(1)},
},
},
// NilPtrAnonymousHeadInt8PtrOnly
2021-01-16 16:16:26 +03:00
{
2021-02-14 20:08:22 +03:00
name: "NilPtrAnonymousHeadInt8PtrOnly",
2021-01-16 16:16:26 +03:00
data: struct {
*structInt8Ptr
}{
structInt8Ptr: nil,
},
},
2021-01-16 20:53:54 +03:00
{
2021-02-14 20:08:22 +03:00
name: "NilPtrAnonymousHeadInt8PtrOnlyOmitEmpty",
2021-01-16 20:53:54 +03:00
data: struct {
*structInt8PtrOmitEmpty
}{
structInt8PtrOmitEmpty: nil,
},
},
{
2021-02-14 20:08:22 +03:00
name: "NilPtrAnonymousHeadInt8PtrOnlyString",
2021-01-16 20:53:54 +03:00
data: struct {
*structInt8PtrString
}{
structInt8PtrString: nil,
},
},
2021-01-16 16:16:26 +03:00
}
for _, test := range tests {
for _, indent := range []bool{true, false} {
for _, htmlEscape := range []bool{true, false} {
var buf bytes.Buffer
enc := json.NewEncoder(&buf)
enc.SetEscapeHTML(htmlEscape)
if indent {
enc.SetIndent("", " ")
}
if err := enc.Encode(test.data); err != nil {
2021-02-14 20:08:22 +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
}
}
}
}