2021-01-16 16:16:26 +03:00
|
|
|
package json_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"bytes"
|
2021-11-25 14:22:04 +03:00
|
|
|
"fmt"
|
2021-01-16 16:16:26 +03:00
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/goccy/go-json"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestCoverUint8(t *testing.T) {
|
|
|
|
type structUint8 struct {
|
|
|
|
A uint8 `json:"a"`
|
|
|
|
}
|
2021-01-19 08:54:27 +03:00
|
|
|
type structUint8OmitEmpty struct {
|
|
|
|
A uint8 `json:"a,omitempty"`
|
|
|
|
}
|
|
|
|
type structUint8String struct {
|
|
|
|
A uint8 `json:"a,string"`
|
|
|
|
}
|
|
|
|
|
2021-01-16 16:16:26 +03:00
|
|
|
type structUint8Ptr struct {
|
|
|
|
A *uint8 `json:"a"`
|
|
|
|
}
|
2021-01-19 08:54:27 +03:00
|
|
|
type structUint8PtrOmitEmpty struct {
|
|
|
|
A *uint8 `json:"a,omitempty"`
|
|
|
|
}
|
|
|
|
type structUint8PtrString struct {
|
|
|
|
A *uint8 `json:"a,string"`
|
|
|
|
}
|
2021-01-16 16:16:26 +03:00
|
|
|
|
|
|
|
tests := []struct {
|
2021-02-15 05:27:37 +03:00
|
|
|
name string
|
|
|
|
data interface{}
|
2021-01-16 16:16:26 +03:00
|
|
|
}{
|
2021-03-19 17:31:29 +03:00
|
|
|
{
|
|
|
|
name: "Uint8",
|
|
|
|
data: uint8(10),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "Uint8Ptr",
|
|
|
|
data: uint8ptr(10),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "Uint8Ptr3",
|
|
|
|
data: uint8ptr3(10),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "Uint8PtrNil",
|
|
|
|
data: (*uint8)(nil),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "Uint8Ptr3Nil",
|
|
|
|
data: (***uint8)(nil),
|
|
|
|
},
|
|
|
|
|
2021-01-19 08:54:27 +03:00
|
|
|
// HeadUint8Zero
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "HeadUint8Zero",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
A uint8 `json:"a"`
|
|
|
|
}{},
|
|
|
|
},
|
2021-01-19 08:54:27 +03:00
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "HeadUint8ZeroOmitEmpty",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
A uint8 `json:"a,omitempty"`
|
|
|
|
}{},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "HeadUint8ZeroString",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
A uint8 `json:"a,string"`
|
|
|
|
}{},
|
|
|
|
},
|
|
|
|
|
|
|
|
// HeadUint8
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "HeadUint8",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
A uint8 `json:"a"`
|
|
|
|
}{A: 1},
|
|
|
|
},
|
2021-01-19 08:54:27 +03:00
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "HeadUint8OmitEmpty",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
A uint8 `json:"a,omitempty"`
|
|
|
|
}{A: 1},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "HeadUint8String",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
A uint8 `json:"a,string"`
|
|
|
|
}{A: 1},
|
|
|
|
},
|
|
|
|
|
|
|
|
// HeadUint8Ptr
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "HeadUint8Ptr",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
A *uint8 `json:"a"`
|
|
|
|
}{A: uint8ptr(1)},
|
|
|
|
},
|
2021-01-19 08:54:27 +03:00
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "HeadUint8PtrOmitEmpty",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
A *uint8 `json:"a,omitempty"`
|
|
|
|
}{A: uint8ptr(1)},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "HeadUint8PtrString",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
A *uint8 `json:"a,string"`
|
|
|
|
}{A: uint8ptr(1)},
|
|
|
|
},
|
|
|
|
|
|
|
|
// HeadUint8PtrNil
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "HeadUint8PtrNil",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
A *uint8 `json:"a"`
|
|
|
|
}{A: nil},
|
|
|
|
},
|
2021-01-19 08:54:27 +03:00
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "HeadUint8PtrNilOmitEmpty",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
A *uint8 `json:"a,omitempty"`
|
|
|
|
}{A: nil},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "HeadUint8PtrNilString",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
A *uint8 `json:"a,string"`
|
|
|
|
}{A: nil},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadUint8Zero
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8Zero",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: &struct {
|
|
|
|
A uint8 `json:"a"`
|
|
|
|
}{},
|
|
|
|
},
|
2021-01-19 08:54:27 +03:00
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8ZeroOmitEmpty",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: &struct {
|
|
|
|
A uint8 `json:"a,omitempty"`
|
|
|
|
}{},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8ZeroString",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: &struct {
|
|
|
|
A uint8 `json:"a,string"`
|
|
|
|
}{},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadUint8
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: &struct {
|
|
|
|
A uint8 `json:"a"`
|
|
|
|
}{A: 1},
|
|
|
|
},
|
2021-01-19 08:54:27 +03:00
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8OmitEmpty",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: &struct {
|
|
|
|
A uint8 `json:"a,omitempty"`
|
|
|
|
}{A: 1},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8String",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: &struct {
|
|
|
|
A uint8 `json:"a,string"`
|
|
|
|
}{A: 1},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadUint8Ptr
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8Ptr",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: &struct {
|
|
|
|
A *uint8 `json:"a"`
|
|
|
|
}{A: uint8ptr(1)},
|
|
|
|
},
|
2021-01-19 08:54:27 +03:00
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8PtrOmitEmpty",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: &struct {
|
|
|
|
A *uint8 `json:"a,omitempty"`
|
|
|
|
}{A: uint8ptr(1)},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8PtrString",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: &struct {
|
|
|
|
A *uint8 `json:"a,string"`
|
|
|
|
}{A: uint8ptr(1)},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadUint8PtrNil
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8PtrNil",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: &struct {
|
|
|
|
A *uint8 `json:"a"`
|
|
|
|
}{A: nil},
|
|
|
|
},
|
2021-01-19 08:54:27 +03:00
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8PtrNilOmitEmpty",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: &struct {
|
|
|
|
A *uint8 `json:"a,omitempty"`
|
|
|
|
}{A: nil},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8PtrNilString",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: &struct {
|
|
|
|
A *uint8 `json:"a,string"`
|
|
|
|
}{A: nil},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadUint8Nil
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8Nil",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: (*struct {
|
|
|
|
A *uint8 `json:"a"`
|
|
|
|
})(nil),
|
|
|
|
},
|
2021-01-19 08:54:27 +03:00
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8NilOmitEmpty",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: (*struct {
|
|
|
|
A *uint8 `json:"a,omitempty"`
|
|
|
|
})(nil),
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8NilString",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: (*struct {
|
|
|
|
A *uint8 `json:"a,string"`
|
|
|
|
})(nil),
|
|
|
|
},
|
|
|
|
|
|
|
|
// HeadUint8ZeroMultiFields
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "HeadUint8ZeroMultiFields",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
A uint8 `json:"a"`
|
|
|
|
B uint8 `json:"b"`
|
2021-02-15 05:27:37 +03:00
|
|
|
C uint8 `json:"c"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}{},
|
|
|
|
},
|
2021-01-19 08:54:27 +03:00
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "HeadUint8ZeroMultiFieldsOmitEmpty",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
A uint8 `json:"a,omitempty"`
|
|
|
|
B uint8 `json:"b,omitempty"`
|
2021-02-15 05:27:37 +03:00
|
|
|
C uint8 `json:"c,omitempty"`
|
2021-01-19 08:54:27 +03:00
|
|
|
}{},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "HeadUint8ZeroMultiFields",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
A uint8 `json:"a,string"`
|
|
|
|
B uint8 `json:"b,string"`
|
2021-02-15 05:27:37 +03:00
|
|
|
C uint8 `json:"c,string"`
|
2021-01-19 08:54:27 +03:00
|
|
|
}{},
|
|
|
|
},
|
|
|
|
|
|
|
|
// HeadUint8MultiFields
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "HeadUint8MultiFields",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
A uint8 `json:"a"`
|
|
|
|
B uint8 `json:"b"`
|
2021-02-15 05:27:37 +03:00
|
|
|
C uint8 `json:"c"`
|
|
|
|
}{A: 1, B: 2, C: 3},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "HeadUint8MultiFieldsOmitEmpty",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
2021-01-19 08:54:27 +03:00
|
|
|
A uint8 `json:"a,omitempty"`
|
|
|
|
B uint8 `json:"b,omitempty"`
|
2021-02-15 05:27:37 +03:00
|
|
|
C uint8 `json:"c,omitempty"`
|
|
|
|
}{A: 1, B: 2, C: 3},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "HeadUint8MultiFieldsString",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
2021-01-19 08:54:27 +03:00
|
|
|
A uint8 `json:"a,string"`
|
|
|
|
B uint8 `json:"b,string"`
|
2021-02-15 05:27:37 +03:00
|
|
|
C uint8 `json:"c,string"`
|
|
|
|
}{A: 1, B: 2, C: 3},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
2021-01-19 08:54:27 +03:00
|
|
|
|
|
|
|
// HeadUint8PtrMultiFields
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "HeadUint8PtrMultiFields",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
A *uint8 `json:"a"`
|
|
|
|
B *uint8 `json:"b"`
|
2021-02-15 05:27:37 +03:00
|
|
|
C *uint8 `json:"c"`
|
|
|
|
}{A: uint8ptr(1), B: uint8ptr(2), C: uint8ptr(3)},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "HeadUint8PtrMultiFieldsOmitEmpty",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
A *uint8 `json:"a,omitempty"`
|
|
|
|
B *uint8 `json:"b,omitempty"`
|
2021-02-15 05:27:37 +03:00
|
|
|
C *uint8 `json:"c,omitempty"`
|
|
|
|
}{A: uint8ptr(1), B: uint8ptr(2), C: uint8ptr(3)},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "HeadUint8PtrMultiFieldsString",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
A *uint8 `json:"a,string"`
|
|
|
|
B *uint8 `json:"b,string"`
|
2021-02-15 05:27:37 +03:00
|
|
|
C *uint8 `json:"c,string"`
|
|
|
|
}{A: uint8ptr(1), B: uint8ptr(2), C: uint8ptr(3)},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
2021-01-19 08:54:27 +03:00
|
|
|
|
|
|
|
// HeadUint8PtrNilMultiFields
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "HeadUint8PtrNilMultiFields",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
2021-01-16 16:16:26 +03:00
|
|
|
A *uint8 `json:"a"`
|
|
|
|
B *uint8 `json:"b"`
|
2021-02-15 05:27:37 +03:00
|
|
|
C *uint8 `json:"c"`
|
|
|
|
}{A: nil, B: nil, C: nil},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "HeadUint8PtrNilMultiFieldsOmitEmpty",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
A *uint8 `json:"a,omitempty"`
|
|
|
|
B *uint8 `json:"b,omitempty"`
|
2021-02-15 05:27:37 +03:00
|
|
|
C *uint8 `json:"c,omitempty"`
|
|
|
|
}{A: nil, B: nil, C: nil},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "HeadUint8PtrNilMultiFieldsString",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
A *uint8 `json:"a,string"`
|
|
|
|
B *uint8 `json:"b,string"`
|
2021-02-15 05:27:37 +03:00
|
|
|
C *uint8 `json:"c,string"`
|
|
|
|
}{A: nil, B: nil, C: nil},
|
2021-01-19 08:54:27 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadUint8ZeroMultiFields
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8ZeroMultiFields",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: &struct {
|
|
|
|
A uint8 `json:"a"`
|
|
|
|
B uint8 `json:"b"`
|
|
|
|
}{},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8ZeroMultiFieldsOmitEmpty",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: &struct {
|
|
|
|
A uint8 `json:"a,omitempty"`
|
|
|
|
B uint8 `json:"b,omitempty"`
|
|
|
|
}{},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8ZeroMultiFieldsString",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: &struct {
|
|
|
|
A uint8 `json:"a,string"`
|
|
|
|
B uint8 `json:"b,string"`
|
|
|
|
}{},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadUint8MultiFields
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8MultiFields",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: &struct {
|
|
|
|
A uint8 `json:"a"`
|
|
|
|
B uint8 `json:"b"`
|
|
|
|
}{A: 1, B: 2},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8MultiFieldsOmitEmpty",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: &struct {
|
|
|
|
A uint8 `json:"a,omitempty"`
|
|
|
|
B uint8 `json:"b,omitempty"`
|
|
|
|
}{A: 1, B: 2},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8MultiFieldsString",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: &struct {
|
|
|
|
A uint8 `json:"a,string"`
|
|
|
|
B uint8 `json:"b,string"`
|
|
|
|
}{A: 1, B: 2},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadUint8PtrMultiFields
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8PtrMultiFields",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: &struct {
|
|
|
|
A *uint8 `json:"a"`
|
|
|
|
B *uint8 `json:"b"`
|
|
|
|
}{A: uint8ptr(1), B: uint8ptr(2)},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8PtrMultiFieldsOmitEmpty",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: &struct {
|
|
|
|
A *uint8 `json:"a,omitempty"`
|
|
|
|
B *uint8 `json:"b,omitempty"`
|
|
|
|
}{A: uint8ptr(1), B: uint8ptr(2)},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8PtrMultiFieldsString",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: &struct {
|
|
|
|
A *uint8 `json:"a,string"`
|
|
|
|
B *uint8 `json:"b,string"`
|
|
|
|
}{A: uint8ptr(1), B: uint8ptr(2)},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadUint8PtrNilMultiFields
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8PtrNilMultiFields",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: &struct {
|
|
|
|
A *uint8 `json:"a"`
|
|
|
|
B *uint8 `json:"b"`
|
|
|
|
}{A: nil, B: nil},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8PtrNilMultiFieldsOmitEmpty",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: &struct {
|
|
|
|
A *uint8 `json:"a,omitempty"`
|
|
|
|
B *uint8 `json:"b,omitempty"`
|
|
|
|
}{A: nil, B: nil},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8PtrNilMultiFieldsString",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: &struct {
|
|
|
|
A *uint8 `json:"a,string"`
|
|
|
|
B *uint8 `json:"b,string"`
|
|
|
|
}{A: nil, B: nil},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadUint8NilMultiFields
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8NilMultiFields",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: (*struct {
|
|
|
|
A *uint8 `json:"a"`
|
|
|
|
B *uint8 `json:"b"`
|
|
|
|
})(nil),
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8NilMultiFieldsOmitEmpty",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: (*struct {
|
|
|
|
A *uint8 `json:"a,omitempty"`
|
|
|
|
B *uint8 `json:"b,omitempty"`
|
|
|
|
})(nil),
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8NilMultiFieldsString",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: (*struct {
|
|
|
|
A *uint8 `json:"a,string"`
|
|
|
|
B *uint8 `json:"b,string"`
|
|
|
|
})(nil),
|
|
|
|
},
|
|
|
|
|
|
|
|
// HeadUint8ZeroNotRoot
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "HeadUint8ZeroNotRoot",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A uint8 `json:"a"`
|
|
|
|
}
|
|
|
|
}{},
|
|
|
|
},
|
2021-01-19 08:54:27 +03:00
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "HeadUint8ZeroNotRootOmitEmpty",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A uint8 `json:"a,omitempty"`
|
|
|
|
}
|
|
|
|
}{},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "HeadUint8ZeroNotRootString",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A uint8 `json:"a,string"`
|
|
|
|
}
|
|
|
|
}{},
|
|
|
|
},
|
|
|
|
|
|
|
|
// HeadUint8NotRoot
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "HeadUint8NotRoot",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A uint8 `json:"a"`
|
|
|
|
}
|
|
|
|
}{A: struct {
|
|
|
|
A uint8 `json:"a"`
|
|
|
|
}{A: 1}},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "HeadUint8NotRootOmitEmpty",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
2021-01-19 08:54:27 +03:00
|
|
|
A uint8 `json:"a,omitempty"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
|
|
|
}{A: struct {
|
2021-01-19 08:54:27 +03:00
|
|
|
A uint8 `json:"a,omitempty"`
|
|
|
|
}{A: 1}},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "HeadUint8NotRootString",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
2021-01-19 08:54:27 +03:00
|
|
|
A uint8 `json:"a,string"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
2021-01-19 08:54:27 +03:00
|
|
|
}{A: struct {
|
|
|
|
A uint8 `json:"a,string"`
|
|
|
|
}{A: 1}},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
2021-01-19 08:54:27 +03:00
|
|
|
|
|
|
|
// HeadUint8PtrNotRoot
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "HeadUint8PtrNotRoot",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
2021-01-19 08:54:27 +03:00
|
|
|
A struct {
|
|
|
|
A *uint8 `json:"a"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
2021-01-19 08:54:27 +03:00
|
|
|
}{A: struct {
|
|
|
|
A *uint8 `json:"a"`
|
|
|
|
}{uint8ptr(1)}},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "HeadUint8PtrNotRootOmitEmpty",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
2021-01-19 08:54:27 +03:00
|
|
|
A struct {
|
|
|
|
A *uint8 `json:"a,omitempty"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
2021-01-19 08:54:27 +03:00
|
|
|
}{A: struct {
|
|
|
|
A *uint8 `json:"a,omitempty"`
|
|
|
|
}{uint8ptr(1)}},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "HeadUint8PtrNotRootString",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
2021-01-19 08:54:27 +03:00
|
|
|
A struct {
|
|
|
|
A *uint8 `json:"a,string"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
2021-01-19 08:54:27 +03:00
|
|
|
}{A: struct {
|
|
|
|
A *uint8 `json:"a,string"`
|
|
|
|
}{uint8ptr(1)}},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
2021-01-19 08:54:27 +03:00
|
|
|
|
|
|
|
// HeadUint8PtrNilNotRoot
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "HeadUint8PtrNilNotRoot",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A *uint8 `json:"a"`
|
|
|
|
}
|
|
|
|
}{},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "HeadUint8PtrNilNotRootOmitEmpty",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A *uint8 `json:"a,omitempty"`
|
|
|
|
}
|
|
|
|
}{},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "HeadUint8PtrNilNotRootString",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A *uint8 `json:"a,string"`
|
|
|
|
}
|
|
|
|
}{},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadUint8ZeroNotRoot
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8ZeroNotRoot",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
A *struct {
|
|
|
|
A uint8 `json:"a"`
|
|
|
|
}
|
|
|
|
}{A: new(struct {
|
|
|
|
A uint8 `json:"a"`
|
|
|
|
})},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8ZeroNotRootOmitEmpty",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
A *struct {
|
|
|
|
A uint8 `json:"a,omitempty"`
|
|
|
|
}
|
|
|
|
}{A: new(struct {
|
|
|
|
A uint8 `json:"a,omitempty"`
|
|
|
|
})},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8ZeroNotRootString",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
A *struct {
|
|
|
|
A uint8 `json:"a,string"`
|
|
|
|
}
|
|
|
|
}{A: new(struct {
|
|
|
|
A uint8 `json:"a,string"`
|
|
|
|
})},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadUint8NotRoot
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8NotRoot",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
A *struct {
|
|
|
|
A uint8 `json:"a"`
|
|
|
|
}
|
|
|
|
}{A: &(struct {
|
|
|
|
A uint8 `json:"a"`
|
|
|
|
}{A: 1})},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8NotRootOmitEmpty",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
A *struct {
|
|
|
|
A uint8 `json:"a,omitempty"`
|
|
|
|
}
|
|
|
|
}{A: &(struct {
|
|
|
|
A uint8 `json:"a,omitempty"`
|
|
|
|
}{A: 1})},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8NotRootString",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
A *struct {
|
|
|
|
A uint8 `json:"a,string"`
|
|
|
|
}
|
|
|
|
}{A: &(struct {
|
|
|
|
A uint8 `json:"a,string"`
|
|
|
|
}{A: 1})},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadUint8PtrNotRoot
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8PtrNotRoot",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
A *struct {
|
|
|
|
A *uint8 `json:"a"`
|
|
|
|
}
|
|
|
|
}{A: &(struct {
|
|
|
|
A *uint8 `json:"a"`
|
|
|
|
}{A: uint8ptr(1)})},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8PtrNotRootOmitEmpty",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
A *struct {
|
|
|
|
A *uint8 `json:"a,omitempty"`
|
|
|
|
}
|
|
|
|
}{A: &(struct {
|
|
|
|
A *uint8 `json:"a,omitempty"`
|
|
|
|
}{A: uint8ptr(1)})},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8PtrNotRootString",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
A *struct {
|
|
|
|
A *uint8 `json:"a,string"`
|
|
|
|
}
|
|
|
|
}{A: &(struct {
|
|
|
|
A *uint8 `json:"a,string"`
|
|
|
|
}{A: uint8ptr(1)})},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadUint8PtrNilNotRoot
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8PtrNilNotRoot",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
A *struct {
|
|
|
|
A *uint8 `json:"a"`
|
|
|
|
}
|
|
|
|
}{A: &(struct {
|
|
|
|
A *uint8 `json:"a"`
|
|
|
|
}{A: nil})},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8PtrNilNotRootOmitEmpty",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
A *struct {
|
|
|
|
A *uint8 `json:"a,omitempty"`
|
|
|
|
}
|
|
|
|
}{A: &(struct {
|
|
|
|
A *uint8 `json:"a,omitempty"`
|
|
|
|
}{A: nil})},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8PtrNilNotRootString",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
A *struct {
|
|
|
|
A *uint8 `json:"a,string"`
|
|
|
|
}
|
|
|
|
}{A: &(struct {
|
|
|
|
A *uint8 `json:"a,string"`
|
|
|
|
}{A: nil})},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadUint8NilNotRoot
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8NilNotRoot",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
A *struct {
|
|
|
|
A *uint8 `json:"a"`
|
|
|
|
}
|
|
|
|
}{A: nil},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8NilNotRootOmitEmpty",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
A *struct {
|
|
|
|
A *uint8 `json:"a,omitempty"`
|
|
|
|
} `json:",omitempty"`
|
|
|
|
}{A: nil},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8NilNotRootString",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
A *struct {
|
|
|
|
A *uint8 `json:"a,string"`
|
|
|
|
} `json:",string"`
|
|
|
|
}{A: nil},
|
|
|
|
},
|
|
|
|
|
|
|
|
// HeadUint8ZeroMultiFieldsNotRoot
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "HeadUint8ZeroMultiFieldsNotRoot",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A uint8 `json:"a"`
|
|
|
|
}
|
|
|
|
B struct {
|
|
|
|
B uint8 `json:"b"`
|
|
|
|
}
|
|
|
|
}{},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "HeadUint8ZeroMultiFieldsNotRootOmitEmpty",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A uint8 `json:"a,omitempty"`
|
|
|
|
}
|
|
|
|
B struct {
|
|
|
|
B uint8 `json:"b,omitempty"`
|
|
|
|
}
|
|
|
|
}{},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "HeadUint8ZeroMultiFieldsNotRootString",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A uint8 `json:"a,string"`
|
|
|
|
}
|
|
|
|
B struct {
|
|
|
|
B uint8 `json:"b,string"`
|
|
|
|
}
|
|
|
|
}{},
|
|
|
|
},
|
|
|
|
|
|
|
|
// HeadUint8MultiFieldsNotRoot
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "HeadUint8MultiFieldsNotRoot",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A uint8 `json:"a"`
|
|
|
|
}
|
|
|
|
B struct {
|
|
|
|
B uint8 `json:"b"`
|
|
|
|
}
|
|
|
|
}{A: struct {
|
|
|
|
A uint8 `json:"a"`
|
|
|
|
}{A: 1}, B: struct {
|
|
|
|
B uint8 `json:"b"`
|
|
|
|
}{B: 2}},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "HeadUint8MultiFieldsNotRootOmitEmpty",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A uint8 `json:"a,omitempty"`
|
|
|
|
}
|
|
|
|
B struct {
|
|
|
|
B uint8 `json:"b,omitempty"`
|
|
|
|
}
|
|
|
|
}{A: struct {
|
|
|
|
A uint8 `json:"a,omitempty"`
|
|
|
|
}{A: 1}, B: struct {
|
|
|
|
B uint8 `json:"b,omitempty"`
|
|
|
|
}{B: 2}},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "HeadUint8MultiFieldsNotRootString",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A uint8 `json:"a,string"`
|
|
|
|
}
|
|
|
|
B struct {
|
|
|
|
B uint8 `json:"b,string"`
|
|
|
|
}
|
|
|
|
}{A: struct {
|
|
|
|
A uint8 `json:"a,string"`
|
|
|
|
}{A: 1}, B: struct {
|
|
|
|
B uint8 `json:"b,string"`
|
|
|
|
}{B: 2}},
|
|
|
|
},
|
|
|
|
|
|
|
|
// HeadUint8PtrMultiFieldsNotRoot
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "HeadUint8PtrMultiFieldsNotRoot",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A *uint8 `json:"a"`
|
|
|
|
}
|
|
|
|
B struct {
|
|
|
|
B *uint8 `json:"b"`
|
|
|
|
}
|
|
|
|
}{A: struct {
|
|
|
|
A *uint8 `json:"a"`
|
|
|
|
}{A: uint8ptr(1)}, B: struct {
|
|
|
|
B *uint8 `json:"b"`
|
|
|
|
}{B: uint8ptr(2)}},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "HeadUint8PtrMultiFieldsNotRootOmitEmpty",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A *uint8 `json:"a,omitempty"`
|
|
|
|
}
|
|
|
|
B struct {
|
|
|
|
B *uint8 `json:"b,omitempty"`
|
|
|
|
}
|
|
|
|
}{A: struct {
|
|
|
|
A *uint8 `json:"a,omitempty"`
|
|
|
|
}{A: uint8ptr(1)}, B: struct {
|
|
|
|
B *uint8 `json:"b,omitempty"`
|
|
|
|
}{B: uint8ptr(2)}},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "HeadUint8PtrMultiFieldsNotRootString",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A *uint8 `json:"a,string"`
|
|
|
|
}
|
|
|
|
B struct {
|
|
|
|
B *uint8 `json:"b,string"`
|
|
|
|
}
|
|
|
|
}{A: struct {
|
|
|
|
A *uint8 `json:"a,string"`
|
|
|
|
}{A: uint8ptr(1)}, B: struct {
|
|
|
|
B *uint8 `json:"b,string"`
|
|
|
|
}{B: uint8ptr(2)}},
|
|
|
|
},
|
|
|
|
|
|
|
|
// HeadUint8PtrNilMultiFieldsNotRoot
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "HeadUint8PtrNilMultiFieldsNotRoot",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A *uint8 `json:"a"`
|
|
|
|
}
|
|
|
|
B struct {
|
|
|
|
B *uint8 `json:"b"`
|
|
|
|
}
|
|
|
|
}{A: struct {
|
|
|
|
A *uint8 `json:"a"`
|
|
|
|
}{A: nil}, B: struct {
|
|
|
|
B *uint8 `json:"b"`
|
|
|
|
}{B: nil}},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "HeadUint8PtrNilMultiFieldsNotRootOmitEmpty",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A *uint8 `json:"a,omitempty"`
|
|
|
|
}
|
|
|
|
B struct {
|
|
|
|
B *uint8 `json:"b,omitempty"`
|
|
|
|
}
|
|
|
|
}{A: struct {
|
|
|
|
A *uint8 `json:"a,omitempty"`
|
|
|
|
}{A: nil}, B: struct {
|
|
|
|
B *uint8 `json:"b,omitempty"`
|
|
|
|
}{B: nil}},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "HeadUint8PtrNilMultiFieldsNotRootString",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A *uint8 `json:"a,string"`
|
|
|
|
}
|
|
|
|
B struct {
|
|
|
|
B *uint8 `json:"b,string"`
|
|
|
|
}
|
|
|
|
}{A: struct {
|
|
|
|
A *uint8 `json:"a,string"`
|
|
|
|
}{A: nil}, B: struct {
|
|
|
|
B *uint8 `json:"b,string"`
|
|
|
|
}{B: nil}},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadUint8ZeroMultiFieldsNotRoot
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8ZeroMultiFieldsNotRoot",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: &struct {
|
|
|
|
A struct {
|
|
|
|
A uint8 `json:"a"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
2021-01-19 08:54:27 +03:00
|
|
|
B struct {
|
|
|
|
B uint8 `json:"b"`
|
|
|
|
}
|
|
|
|
}{},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8ZeroMultiFieldsNotRootOmitEmpty",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: &struct {
|
|
|
|
A struct {
|
|
|
|
A uint8 `json:"a,omitempty"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
2021-01-19 08:54:27 +03:00
|
|
|
B struct {
|
|
|
|
B uint8 `json:"b,omitempty"`
|
|
|
|
}
|
|
|
|
}{},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8ZeroMultiFieldsNotRootString",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: &struct {
|
2021-01-16 16:16:26 +03:00
|
|
|
A struct {
|
2021-01-19 08:54:27 +03:00
|
|
|
A uint8 `json:"a,string"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
|
|
|
B struct {
|
2021-01-19 08:54:27 +03:00
|
|
|
B uint8 `json:"b,string"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
|
|
|
}{},
|
|
|
|
},
|
2021-01-19 08:54:27 +03:00
|
|
|
|
|
|
|
// PtrHeadUint8MultiFieldsNotRoot
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8MultiFieldsNotRoot",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: &struct {
|
2021-01-16 16:16:26 +03:00
|
|
|
A struct {
|
|
|
|
A uint8 `json:"a"`
|
|
|
|
}
|
|
|
|
B struct {
|
|
|
|
B uint8 `json:"b"`
|
|
|
|
}
|
|
|
|
}{A: struct {
|
|
|
|
A uint8 `json:"a"`
|
|
|
|
}{A: 1}, B: struct {
|
|
|
|
B uint8 `json:"b"`
|
|
|
|
}{B: 2}},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8MultiFieldsNotRootOmitEmpty",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: &struct {
|
2021-01-16 16:16:26 +03:00
|
|
|
A struct {
|
2021-01-19 08:54:27 +03:00
|
|
|
A uint8 `json:"a,omitempty"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
|
|
|
B struct {
|
2021-01-19 08:54:27 +03:00
|
|
|
B uint8 `json:"b,omitempty"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
|
|
|
}{A: struct {
|
2021-01-19 08:54:27 +03:00
|
|
|
A uint8 `json:"a,omitempty"`
|
|
|
|
}{A: 1}, B: struct {
|
|
|
|
B uint8 `json:"b,omitempty"`
|
|
|
|
}{B: 2}},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8MultiFieldsNotRootString",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: &struct {
|
2021-01-16 16:16:26 +03:00
|
|
|
A struct {
|
2021-01-19 08:54:27 +03:00
|
|
|
A uint8 `json:"a,string"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
|
|
|
B struct {
|
2021-01-19 08:54:27 +03:00
|
|
|
B uint8 `json:"b,string"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
|
|
|
}{A: struct {
|
2021-01-19 08:54:27 +03:00
|
|
|
A uint8 `json:"a,string"`
|
|
|
|
}{A: 1}, B: struct {
|
|
|
|
B uint8 `json:"b,string"`
|
|
|
|
}{B: 2}},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
2021-01-19 08:54:27 +03:00
|
|
|
|
|
|
|
// PtrHeadUint8PtrMultiFieldsNotRoot
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8PtrMultiFieldsNotRoot",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: &struct {
|
2021-01-19 08:54:27 +03:00
|
|
|
A *struct {
|
|
|
|
A *uint8 `json:"a"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
2021-01-19 08:54:27 +03:00
|
|
|
B *struct {
|
|
|
|
B *uint8 `json:"b"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
2021-01-19 08:54:27 +03:00
|
|
|
}{A: &(struct {
|
|
|
|
A *uint8 `json:"a"`
|
|
|
|
}{A: uint8ptr(1)}), B: &(struct {
|
|
|
|
B *uint8 `json:"b"`
|
|
|
|
}{B: uint8ptr(2)})},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8PtrMultiFieldsNotRootOmitEmpty",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: &struct {
|
2021-01-19 08:54:27 +03:00
|
|
|
A *struct {
|
|
|
|
A *uint8 `json:"a,omitempty"`
|
|
|
|
}
|
|
|
|
B *struct {
|
|
|
|
B *uint8 `json:"b,omitempty"`
|
|
|
|
}
|
|
|
|
}{A: &(struct {
|
|
|
|
A *uint8 `json:"a,omitempty"`
|
|
|
|
}{A: uint8ptr(1)}), B: &(struct {
|
|
|
|
B *uint8 `json:"b,omitempty"`
|
|
|
|
}{B: uint8ptr(2)})},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8PtrMultiFieldsNotRootString",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: &struct {
|
|
|
|
A *struct {
|
|
|
|
A *uint8 `json:"a,string"`
|
|
|
|
}
|
|
|
|
B *struct {
|
|
|
|
B *uint8 `json:"b,string"`
|
|
|
|
}
|
|
|
|
}{A: &(struct {
|
|
|
|
A *uint8 `json:"a,string"`
|
|
|
|
}{A: uint8ptr(1)}), B: &(struct {
|
|
|
|
B *uint8 `json:"b,string"`
|
|
|
|
}{B: uint8ptr(2)})},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadUint8PtrNilMultiFieldsNotRoot
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8PtrNilMultiFieldsNotRoot",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: &struct {
|
|
|
|
A *struct {
|
|
|
|
A *uint8 `json:"a"`
|
|
|
|
}
|
|
|
|
B *struct {
|
|
|
|
B *uint8 `json:"b"`
|
|
|
|
}
|
|
|
|
}{A: nil, B: nil},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8PtrNilMultiFieldsNotRootOmitEmpty",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: &struct {
|
|
|
|
A *struct {
|
|
|
|
A *uint8 `json:"a,omitempty"`
|
|
|
|
} `json:",omitempty"`
|
|
|
|
B *struct {
|
|
|
|
B *uint8 `json:"b,omitempty"`
|
|
|
|
} `json:",omitempty"`
|
|
|
|
}{A: nil, B: nil},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8PtrNilMultiFieldsNotRootString",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: &struct {
|
|
|
|
A *struct {
|
|
|
|
A *uint8 `json:"a,string"`
|
|
|
|
} `json:",string"`
|
|
|
|
B *struct {
|
|
|
|
B *uint8 `json:"b,string"`
|
|
|
|
} `json:",string"`
|
|
|
|
}{A: nil, B: nil},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadUint8NilMultiFieldsNotRoot
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8NilMultiFieldsNotRoot",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: (*struct {
|
|
|
|
A *struct {
|
|
|
|
A *uint8 `json:"a"`
|
|
|
|
}
|
|
|
|
B *struct {
|
|
|
|
B *uint8 `json:"b"`
|
|
|
|
}
|
|
|
|
})(nil),
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8NilMultiFieldsNotRootOmitEmpty",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: (*struct {
|
|
|
|
A *struct {
|
|
|
|
A *uint8 `json:"a,omitempty"`
|
|
|
|
}
|
|
|
|
B *struct {
|
|
|
|
B *uint8 `json:"b,omitempty"`
|
|
|
|
}
|
|
|
|
})(nil),
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8NilMultiFieldsNotRootString",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: (*struct {
|
|
|
|
A *struct {
|
|
|
|
A *uint8 `json:"a,string"`
|
|
|
|
}
|
|
|
|
B *struct {
|
|
|
|
B *uint8 `json:"b,string"`
|
|
|
|
}
|
|
|
|
})(nil),
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadUint8DoubleMultiFieldsNotRoot
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8DoubleMultiFieldsNotRoot",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: &struct {
|
|
|
|
A *struct {
|
2021-01-16 16:16:26 +03:00
|
|
|
A uint8 `json:"a"`
|
2021-01-19 08:54:27 +03:00
|
|
|
B uint8 `json:"b"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
2021-01-19 08:54:27 +03:00
|
|
|
B *struct {
|
|
|
|
A uint8 `json:"a"`
|
2021-01-16 16:16:26 +03:00
|
|
|
B uint8 `json:"b"`
|
|
|
|
}
|
2021-01-19 08:54:27 +03:00
|
|
|
}{A: &(struct {
|
2021-01-16 16:16:26 +03:00
|
|
|
A uint8 `json:"a"`
|
|
|
|
B uint8 `json:"b"`
|
2021-01-19 08:54:27 +03:00
|
|
|
}{A: 1, B: 2}), B: &(struct {
|
|
|
|
A uint8 `json:"a"`
|
|
|
|
B uint8 `json:"b"`
|
|
|
|
}{A: 3, B: 4})},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8DoubleMultiFieldsNotRootOmitEmpty",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: &struct {
|
|
|
|
A *struct {
|
|
|
|
A uint8 `json:"a,omitempty"`
|
|
|
|
B uint8 `json:"b,omitempty"`
|
|
|
|
}
|
|
|
|
B *struct {
|
|
|
|
A uint8 `json:"a,omitempty"`
|
|
|
|
B uint8 `json:"b,omitempty"`
|
|
|
|
}
|
|
|
|
}{A: &(struct {
|
|
|
|
A uint8 `json:"a,omitempty"`
|
|
|
|
B uint8 `json:"b,omitempty"`
|
|
|
|
}{A: 1, B: 2}), B: &(struct {
|
|
|
|
A uint8 `json:"a,omitempty"`
|
|
|
|
B uint8 `json:"b,omitempty"`
|
|
|
|
}{A: 3, B: 4})},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8DoubleMultiFieldsNotRootString",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: &struct {
|
|
|
|
A *struct {
|
2021-01-19 08:54:27 +03:00
|
|
|
A uint8 `json:"a,string"`
|
|
|
|
B uint8 `json:"b,string"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
|
|
|
B *struct {
|
2021-01-19 08:54:27 +03:00
|
|
|
A uint8 `json:"a,string"`
|
|
|
|
B uint8 `json:"b,string"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
|
|
|
}{A: &(struct {
|
2021-01-19 08:54:27 +03:00
|
|
|
A uint8 `json:"a,string"`
|
|
|
|
B uint8 `json:"b,string"`
|
|
|
|
}{A: 1, B: 2}), B: &(struct {
|
|
|
|
A uint8 `json:"a,string"`
|
|
|
|
B uint8 `json:"b,string"`
|
|
|
|
}{A: 3, B: 4})},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
2021-01-19 08:54:27 +03:00
|
|
|
|
|
|
|
// PtrHeadUint8NilDoubleMultiFieldsNotRoot
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8NilDoubleMultiFieldsNotRoot",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: &struct {
|
|
|
|
A *struct {
|
2021-01-19 08:54:27 +03:00
|
|
|
A uint8 `json:"a"`
|
|
|
|
B uint8 `json:"b"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
|
|
|
B *struct {
|
2021-01-19 08:54:27 +03:00
|
|
|
A uint8 `json:"a"`
|
|
|
|
B uint8 `json:"b"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
|
|
|
}{A: nil, B: nil},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8NilDoubleMultiFieldsNotRootOmitEmpty",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: &struct {
|
2021-01-16 16:16:26 +03:00
|
|
|
A *struct {
|
2021-01-19 08:54:27 +03:00
|
|
|
A uint8 `json:"a,omitempty"`
|
|
|
|
B uint8 `json:"b,omitempty"`
|
|
|
|
} `json:",omitempty"`
|
2021-01-16 16:16:26 +03:00
|
|
|
B *struct {
|
2021-01-19 08:54:27 +03:00
|
|
|
A uint8 `json:"a,omitempty"`
|
|
|
|
B uint8 `json:"b,omitempty"`
|
|
|
|
} `json:",omitempty"`
|
|
|
|
}{A: nil, B: nil},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8NilDoubleMultiFieldsNotRootString",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: &struct {
|
|
|
|
A *struct {
|
2021-01-19 08:54:27 +03:00
|
|
|
A uint8 `json:"a,string"`
|
|
|
|
B uint8 `json:"b,string"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
|
|
|
B *struct {
|
2021-01-19 08:54:27 +03:00
|
|
|
A uint8 `json:"a,string"`
|
|
|
|
B uint8 `json:"b,string"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
2021-01-19 08:54:27 +03:00
|
|
|
}{A: nil, B: nil},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
2021-01-19 08:54:27 +03:00
|
|
|
|
|
|
|
// PtrHeadUint8NilDoubleMultiFieldsNotRoot
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8NilDoubleMultiFieldsNotRoot",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: (*struct {
|
2021-01-16 16:16:26 +03:00
|
|
|
A *struct {
|
|
|
|
A uint8 `json:"a"`
|
|
|
|
B uint8 `json:"b"`
|
|
|
|
}
|
|
|
|
B *struct {
|
|
|
|
A uint8 `json:"a"`
|
|
|
|
B uint8 `json:"b"`
|
|
|
|
}
|
2021-01-19 08:54:27 +03:00
|
|
|
})(nil),
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8NilDoubleMultiFieldsNotRootOmitEmpty",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: (*struct {
|
|
|
|
A *struct {
|
2021-01-19 08:54:27 +03:00
|
|
|
A uint8 `json:"a,omitempty"`
|
|
|
|
B uint8 `json:"b,omitempty"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
|
|
|
B *struct {
|
2021-01-19 08:54:27 +03:00
|
|
|
A uint8 `json:"a,omitempty"`
|
|
|
|
B uint8 `json:"b,omitempty"`
|
|
|
|
}
|
|
|
|
})(nil),
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8NilDoubleMultiFieldsNotRootString",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: (*struct {
|
|
|
|
A *struct {
|
|
|
|
A uint8 `json:"a,string"`
|
|
|
|
B uint8 `json:"b,string"`
|
|
|
|
}
|
|
|
|
B *struct {
|
|
|
|
A uint8 `json:"a,string"`
|
|
|
|
B uint8 `json:"b,string"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
|
|
|
})(nil),
|
|
|
|
},
|
2021-01-19 08:54:27 +03:00
|
|
|
|
|
|
|
// PtrHeadUint8PtrDoubleMultiFieldsNotRoot
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8PtrDoubleMultiFieldsNotRoot",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: &struct {
|
|
|
|
A *struct {
|
|
|
|
A *uint8 `json:"a"`
|
|
|
|
B *uint8 `json:"b"`
|
|
|
|
}
|
|
|
|
B *struct {
|
|
|
|
A *uint8 `json:"a"`
|
|
|
|
B *uint8 `json:"b"`
|
|
|
|
}
|
|
|
|
}{A: &(struct {
|
|
|
|
A *uint8 `json:"a"`
|
|
|
|
B *uint8 `json:"b"`
|
|
|
|
}{A: uint8ptr(1), B: uint8ptr(2)}), B: &(struct {
|
|
|
|
A *uint8 `json:"a"`
|
|
|
|
B *uint8 `json:"b"`
|
|
|
|
}{A: uint8ptr(3), B: uint8ptr(4)})},
|
|
|
|
},
|
2021-01-19 08:54:27 +03:00
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8PtrDoubleMultiFieldsNotRootOmitEmpty",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: &struct {
|
|
|
|
A *struct {
|
|
|
|
A *uint8 `json:"a,omitempty"`
|
|
|
|
B *uint8 `json:"b,omitempty"`
|
|
|
|
}
|
|
|
|
B *struct {
|
|
|
|
A *uint8 `json:"a,omitempty"`
|
|
|
|
B *uint8 `json:"b,omitempty"`
|
|
|
|
}
|
|
|
|
}{A: &(struct {
|
|
|
|
A *uint8 `json:"a,omitempty"`
|
|
|
|
B *uint8 `json:"b,omitempty"`
|
|
|
|
}{A: uint8ptr(1), B: uint8ptr(2)}), B: &(struct {
|
|
|
|
A *uint8 `json:"a,omitempty"`
|
|
|
|
B *uint8 `json:"b,omitempty"`
|
|
|
|
}{A: uint8ptr(3), B: uint8ptr(4)})},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8PtrDoubleMultiFieldsNotRootString",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: &struct {
|
|
|
|
A *struct {
|
|
|
|
A *uint8 `json:"a,string"`
|
|
|
|
B *uint8 `json:"b,string"`
|
|
|
|
}
|
|
|
|
B *struct {
|
|
|
|
A *uint8 `json:"a,string"`
|
|
|
|
B *uint8 `json:"b,string"`
|
|
|
|
}
|
|
|
|
}{A: &(struct {
|
|
|
|
A *uint8 `json:"a,string"`
|
|
|
|
B *uint8 `json:"b,string"`
|
|
|
|
}{A: uint8ptr(1), B: uint8ptr(2)}), B: &(struct {
|
|
|
|
A *uint8 `json:"a,string"`
|
|
|
|
B *uint8 `json:"b,string"`
|
|
|
|
}{A: uint8ptr(3), B: uint8ptr(4)})},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadUint8PtrNilDoubleMultiFieldsNotRoot
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8PtrNilDoubleMultiFieldsNotRoot",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: &struct {
|
|
|
|
A *struct {
|
|
|
|
A *uint8 `json:"a"`
|
|
|
|
B *uint8 `json:"b"`
|
|
|
|
}
|
|
|
|
B *struct {
|
|
|
|
A *uint8 `json:"a"`
|
|
|
|
B *uint8 `json:"b"`
|
|
|
|
}
|
|
|
|
}{A: nil, B: nil},
|
|
|
|
},
|
2021-01-19 08:54:27 +03:00
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8PtrNilDoubleMultiFieldsNotRootOmitEmpty",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: &struct {
|
|
|
|
A *struct {
|
|
|
|
A *uint8 `json:"a,omitempty"`
|
|
|
|
B *uint8 `json:"b,omitempty"`
|
|
|
|
} `json:",omitempty"`
|
|
|
|
B *struct {
|
|
|
|
A *uint8 `json:"a,omitempty"`
|
|
|
|
B *uint8 `json:"b,omitempty"`
|
|
|
|
} `json:",omitempty"`
|
|
|
|
}{A: nil, B: nil},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8PtrNilDoubleMultiFieldsNotRootString",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: &struct {
|
|
|
|
A *struct {
|
|
|
|
A *uint8 `json:"a,string"`
|
|
|
|
B *uint8 `json:"b,string"`
|
|
|
|
}
|
|
|
|
B *struct {
|
|
|
|
A *uint8 `json:"a,string"`
|
|
|
|
B *uint8 `json:"b,string"`
|
|
|
|
}
|
|
|
|
}{A: nil, B: nil},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadUint8PtrNilDoubleMultiFieldsNotRoot
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8PtrNilDoubleMultiFieldsNotRoot",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: (*struct {
|
|
|
|
A *struct {
|
|
|
|
A *uint8 `json:"a"`
|
|
|
|
B *uint8 `json:"b"`
|
|
|
|
}
|
|
|
|
B *struct {
|
|
|
|
A *uint8 `json:"a"`
|
|
|
|
B *uint8 `json:"b"`
|
|
|
|
}
|
|
|
|
})(nil),
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8PtrNilDoubleMultiFieldsNotRootOmitEmpty",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: (*struct {
|
|
|
|
A *struct {
|
|
|
|
A *uint8 `json:"a,omitempty"`
|
|
|
|
B *uint8 `json:"b,omitempty"`
|
|
|
|
}
|
|
|
|
B *struct {
|
|
|
|
A *uint8 `json:"a,omitempty"`
|
|
|
|
B *uint8 `json:"b,omitempty"`
|
|
|
|
}
|
|
|
|
})(nil),
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrHeadUint8PtrNilDoubleMultiFieldsNotRootString",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: (*struct {
|
|
|
|
A *struct {
|
|
|
|
A *uint8 `json:"a,string"`
|
|
|
|
B *uint8 `json:"b,string"`
|
|
|
|
}
|
|
|
|
B *struct {
|
|
|
|
A *uint8 `json:"a,string"`
|
|
|
|
B *uint8 `json:"b,string"`
|
|
|
|
}
|
|
|
|
})(nil),
|
|
|
|
},
|
|
|
|
|
|
|
|
// AnonymousHeadUint8
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "AnonymousHeadUint8",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
structUint8
|
|
|
|
B uint8 `json:"b"`
|
|
|
|
}{
|
|
|
|
structUint8: structUint8{A: 1},
|
|
|
|
B: 2,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "AnonymousHeadUint8OmitEmpty",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
structUint8OmitEmpty
|
|
|
|
B uint8 `json:"b,omitempty"`
|
|
|
|
}{
|
|
|
|
structUint8OmitEmpty: structUint8OmitEmpty{A: 1},
|
|
|
|
B: 2,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "AnonymousHeadUint8String",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
structUint8String
|
|
|
|
B uint8 `json:"b,string"`
|
|
|
|
}{
|
|
|
|
structUint8String: structUint8String{A: 1},
|
|
|
|
B: 2,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrAnonymousHeadUint8
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrAnonymousHeadUint8",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
*structUint8
|
|
|
|
B uint8 `json:"b"`
|
|
|
|
}{
|
|
|
|
structUint8: &structUint8{A: 1},
|
|
|
|
B: 2,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrAnonymousHeadUint8OmitEmpty",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
*structUint8OmitEmpty
|
|
|
|
B uint8 `json:"b,omitempty"`
|
|
|
|
}{
|
|
|
|
structUint8OmitEmpty: &structUint8OmitEmpty{A: 1},
|
|
|
|
B: 2,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrAnonymousHeadUint8String",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
*structUint8String
|
|
|
|
B uint8 `json:"b,string"`
|
|
|
|
}{
|
|
|
|
structUint8String: &structUint8String{A: 1},
|
|
|
|
B: 2,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// NilPtrAnonymousHeadUint8
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "NilPtrAnonymousHeadUint8",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
2021-01-19 08:54:27 +03:00
|
|
|
*structUint8
|
2021-01-16 16:16:26 +03:00
|
|
|
B uint8 `json:"b"`
|
|
|
|
}{
|
2021-01-19 08:54:27 +03:00
|
|
|
structUint8: nil,
|
2021-01-16 16:16:26 +03:00
|
|
|
B: 2,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "NilPtrAnonymousHeadUint8OmitEmpty",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
2021-01-19 08:54:27 +03:00
|
|
|
*structUint8OmitEmpty
|
|
|
|
B uint8 `json:"b,omitempty"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}{
|
2021-01-19 08:54:27 +03:00
|
|
|
structUint8OmitEmpty: nil,
|
|
|
|
B: 2,
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "NilPtrAnonymousHeadUint8String",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
2021-01-19 08:54:27 +03:00
|
|
|
*structUint8String
|
|
|
|
B uint8 `json:"b,string"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}{
|
2021-01-19 08:54:27 +03:00
|
|
|
structUint8String: nil,
|
|
|
|
B: 2,
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
},
|
2021-01-19 08:54:27 +03:00
|
|
|
|
|
|
|
// AnonymousHeadUint8Ptr
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "AnonymousHeadUint8Ptr",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
structUint8Ptr
|
|
|
|
B *uint8 `json:"b"`
|
|
|
|
}{
|
|
|
|
structUint8Ptr: structUint8Ptr{A: uint8ptr(1)},
|
|
|
|
B: uint8ptr(2),
|
|
|
|
},
|
|
|
|
},
|
2021-01-19 08:54:27 +03:00
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "AnonymousHeadUint8PtrOmitEmpty",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
structUint8PtrOmitEmpty
|
|
|
|
B *uint8 `json:"b,omitempty"`
|
|
|
|
}{
|
|
|
|
structUint8PtrOmitEmpty: structUint8PtrOmitEmpty{A: uint8ptr(1)},
|
|
|
|
B: uint8ptr(2),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "AnonymousHeadUint8PtrString",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
structUint8PtrString
|
|
|
|
B *uint8 `json:"b,string"`
|
|
|
|
}{
|
|
|
|
structUint8PtrString: structUint8PtrString{A: uint8ptr(1)},
|
|
|
|
B: uint8ptr(2),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// AnonymousHeadUint8PtrNil
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "AnonymousHeadUint8PtrNil",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
structUint8Ptr
|
|
|
|
B *uint8 `json:"b"`
|
|
|
|
}{
|
|
|
|
structUint8Ptr: structUint8Ptr{A: nil},
|
|
|
|
B: uint8ptr(2),
|
|
|
|
},
|
|
|
|
},
|
2021-01-19 08:54:27 +03:00
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "AnonymousHeadUint8PtrNilOmitEmpty",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
structUint8PtrOmitEmpty
|
|
|
|
B *uint8 `json:"b,omitempty"`
|
|
|
|
}{
|
|
|
|
structUint8PtrOmitEmpty: structUint8PtrOmitEmpty{A: nil},
|
|
|
|
B: uint8ptr(2),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "AnonymousHeadUint8PtrNilString",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
structUint8PtrString
|
|
|
|
B *uint8 `json:"b,string"`
|
|
|
|
}{
|
|
|
|
structUint8PtrString: structUint8PtrString{A: nil},
|
|
|
|
B: uint8ptr(2),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrAnonymousHeadUint8Ptr
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrAnonymousHeadUint8Ptr",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
*structUint8Ptr
|
|
|
|
B *uint8 `json:"b"`
|
|
|
|
}{
|
|
|
|
structUint8Ptr: &structUint8Ptr{A: uint8ptr(1)},
|
|
|
|
B: uint8ptr(2),
|
|
|
|
},
|
|
|
|
},
|
2021-01-19 08:54:27 +03:00
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrAnonymousHeadUint8PtrOmitEmpty",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
*structUint8PtrOmitEmpty
|
|
|
|
B *uint8 `json:"b,omitempty"`
|
|
|
|
}{
|
|
|
|
structUint8PtrOmitEmpty: &structUint8PtrOmitEmpty{A: uint8ptr(1)},
|
|
|
|
B: uint8ptr(2),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrAnonymousHeadUint8PtrString",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
*structUint8PtrString
|
|
|
|
B *uint8 `json:"b,string"`
|
|
|
|
}{
|
|
|
|
structUint8PtrString: &structUint8PtrString{A: uint8ptr(1)},
|
|
|
|
B: uint8ptr(2),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// NilPtrAnonymousHeadUint8Ptr
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "NilPtrAnonymousHeadUint8Ptr",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
*structUint8Ptr
|
|
|
|
B *uint8 `json:"b"`
|
|
|
|
}{
|
|
|
|
structUint8Ptr: nil,
|
|
|
|
B: uint8ptr(2),
|
|
|
|
},
|
|
|
|
},
|
2021-01-19 08:54:27 +03:00
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "NilPtrAnonymousHeadUint8PtrOmitEmpty",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
*structUint8PtrOmitEmpty
|
|
|
|
B *uint8 `json:"b,omitempty"`
|
|
|
|
}{
|
|
|
|
structUint8PtrOmitEmpty: nil,
|
|
|
|
B: uint8ptr(2),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "NilPtrAnonymousHeadUint8PtrString",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
*structUint8PtrString
|
|
|
|
B *uint8 `json:"b,string"`
|
|
|
|
}{
|
|
|
|
structUint8PtrString: nil,
|
|
|
|
B: uint8ptr(2),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// AnonymousHeadUint8Only
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "AnonymousHeadUint8Only",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
structUint8
|
|
|
|
}{
|
|
|
|
structUint8: structUint8{A: 1},
|
|
|
|
},
|
|
|
|
},
|
2021-01-19 08:54:27 +03:00
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "AnonymousHeadUint8OnlyOmitEmpty",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
structUint8OmitEmpty
|
|
|
|
}{
|
|
|
|
structUint8OmitEmpty: structUint8OmitEmpty{A: 1},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "AnonymousHeadUint8OnlyString",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
structUint8String
|
|
|
|
}{
|
|
|
|
structUint8String: structUint8String{A: 1},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrAnonymousHeadUint8Only
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrAnonymousHeadUint8Only",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
*structUint8
|
|
|
|
}{
|
|
|
|
structUint8: &structUint8{A: 1},
|
|
|
|
},
|
|
|
|
},
|
2021-01-19 08:54:27 +03:00
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrAnonymousHeadUint8OnlyOmitEmpty",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
*structUint8OmitEmpty
|
|
|
|
}{
|
|
|
|
structUint8OmitEmpty: &structUint8OmitEmpty{A: 1},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrAnonymousHeadUint8OnlyString",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
*structUint8String
|
|
|
|
}{
|
|
|
|
structUint8String: &structUint8String{A: 1},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// NilPtrAnonymousHeadUint8Only
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "NilPtrAnonymousHeadUint8Only",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
*structUint8
|
|
|
|
}{
|
|
|
|
structUint8: nil,
|
|
|
|
},
|
|
|
|
},
|
2021-01-19 08:54:27 +03:00
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "NilPtrAnonymousHeadUint8OnlyOmitEmpty",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
*structUint8OmitEmpty
|
|
|
|
}{
|
|
|
|
structUint8OmitEmpty: nil,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "NilPtrAnonymousHeadUint8OnlyString",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
*structUint8String
|
|
|
|
}{
|
|
|
|
structUint8String: nil,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// AnonymousHeadUint8PtrOnly
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "AnonymousHeadUint8PtrOnly",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
structUint8Ptr
|
|
|
|
}{
|
|
|
|
structUint8Ptr: structUint8Ptr{A: uint8ptr(1)},
|
|
|
|
},
|
|
|
|
},
|
2021-01-19 08:54:27 +03:00
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "AnonymousHeadUint8PtrOnlyOmitEmpty",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
structUint8PtrOmitEmpty
|
|
|
|
}{
|
|
|
|
structUint8PtrOmitEmpty: structUint8PtrOmitEmpty{A: uint8ptr(1)},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "AnonymousHeadUint8PtrOnlyString",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
structUint8PtrString
|
|
|
|
}{
|
|
|
|
structUint8PtrString: structUint8PtrString{A: uint8ptr(1)},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// AnonymousHeadUint8PtrNilOnly
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "AnonymousHeadUint8PtrNilOnly",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
structUint8Ptr
|
|
|
|
}{
|
|
|
|
structUint8Ptr: structUint8Ptr{A: nil},
|
|
|
|
},
|
|
|
|
},
|
2021-01-19 08:54:27 +03:00
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "AnonymousHeadUint8PtrNilOnlyOmitEmpty",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
structUint8PtrOmitEmpty
|
|
|
|
}{
|
|
|
|
structUint8PtrOmitEmpty: structUint8PtrOmitEmpty{A: nil},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "AnonymousHeadUint8PtrNilOnlyString",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
structUint8PtrString
|
|
|
|
}{
|
|
|
|
structUint8PtrString: structUint8PtrString{A: nil},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrAnonymousHeadUint8PtrOnly
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrAnonymousHeadUint8PtrOnly",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
*structUint8Ptr
|
|
|
|
}{
|
|
|
|
structUint8Ptr: &structUint8Ptr{A: uint8ptr(1)},
|
|
|
|
},
|
|
|
|
},
|
2021-01-19 08:54:27 +03:00
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrAnonymousHeadUint8PtrOnlyOmitEmpty",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
*structUint8PtrOmitEmpty
|
|
|
|
}{
|
|
|
|
structUint8PtrOmitEmpty: &structUint8PtrOmitEmpty{A: uint8ptr(1)},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "PtrAnonymousHeadUint8PtrOnlyString",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
*structUint8PtrString
|
|
|
|
}{
|
|
|
|
structUint8PtrString: &structUint8PtrString{A: uint8ptr(1)},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// NilPtrAnonymousHeadUint8PtrOnly
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "NilPtrAnonymousHeadUint8PtrOnly",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
*structUint8Ptr
|
|
|
|
}{
|
|
|
|
structUint8Ptr: nil,
|
|
|
|
},
|
|
|
|
},
|
2021-01-19 08:54:27 +03:00
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "NilPtrAnonymousHeadUint8PtrOnlyOmitEmpty",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
*structUint8PtrOmitEmpty
|
|
|
|
}{
|
|
|
|
structUint8PtrOmitEmpty: nil,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:27:37 +03:00
|
|
|
name: "NilPtrAnonymousHeadUint8PtrOnlyString",
|
2021-01-19 08:54:27 +03:00
|
|
|
data: struct {
|
|
|
|
*structUint8PtrString
|
|
|
|
}{
|
|
|
|
structUint8PtrString: 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} {
|
2021-11-25 14:22:04 +03:00
|
|
|
t.Run(fmt.Sprintf("%s_indent_%t_escape_%t", test.name, indent, htmlEscape), func(t *testing.T) {
|
|
|
|
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:%T): %+v: %s", test.name, htmlEscape, test.data, err)
|
|
|
|
}
|
|
|
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|