go-json/test/cover/cover_uint32_test.go

1811 lines
36 KiB
Go
Raw Permalink Normal View History

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 TestCoverUint32(t *testing.T) {
type structUint32 struct {
A uint32 `json:"a"`
}
type structUint32OmitEmpty struct {
A uint32 `json:"a,omitempty"`
}
type structUint32String struct {
A uint32 `json:"a,string"`
}
2021-01-16 16:16:26 +03:00
type structUint32Ptr struct {
A *uint32 `json:"a"`
}
type structUint32PtrOmitEmpty struct {
A *uint32 `json:"a,omitempty"`
}
type structUint32PtrString struct {
A *uint32 `json:"a,string"`
}
2021-01-16 16:16:26 +03:00
tests := []struct {
2021-02-15 05:27:57 +03:00
name string
data interface{}
2021-01-16 16:16:26 +03:00
}{
2021-03-19 17:31:29 +03:00
{
name: "Uint32",
data: uint32(10),
},
{
name: "Uint32Ptr",
data: uint32ptr(10),
},
{
name: "Uint32Ptr3",
data: uint32ptr3(10),
},
{
name: "Uint32PtrNil",
data: (*uint32)(nil),
},
{
name: "Uint32Ptr3Nil",
data: (***uint32)(nil),
},
// HeadUint32Zero
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:27:57 +03:00
name: "HeadUint32Zero",
2021-01-16 16:16:26 +03:00
data: struct {
A uint32 `json:"a"`
}{},
},
{
2021-02-15 05:27:57 +03:00
name: "HeadUint32ZeroOmitEmpty",
data: struct {
A uint32 `json:"a,omitempty"`
}{},
},
{
2021-02-15 05:27:57 +03:00
name: "HeadUint32ZeroString",
data: struct {
A uint32 `json:"a,string"`
}{},
},
// HeadUint32
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:27:57 +03:00
name: "HeadUint32",
2021-01-16 16:16:26 +03:00
data: struct {
A uint32 `json:"a"`
}{A: 1},
},
{
2021-02-15 05:27:57 +03:00
name: "HeadUint32OmitEmpty",
data: struct {
A uint32 `json:"a,omitempty"`
}{A: 1},
},
{
2021-02-15 05:27:57 +03:00
name: "HeadUint32String",
data: struct {
A uint32 `json:"a,string"`
}{A: 1},
},
// HeadUint32Ptr
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:27:57 +03:00
name: "HeadUint32Ptr",
2021-01-16 16:16:26 +03:00
data: struct {
A *uint32 `json:"a"`
}{A: uint32ptr(1)},
},
{
2021-02-15 05:27:57 +03:00
name: "HeadUint32PtrOmitEmpty",
data: struct {
A *uint32 `json:"a,omitempty"`
}{A: uint32ptr(1)},
},
{
2021-02-15 05:27:57 +03:00
name: "HeadUint32PtrString",
data: struct {
A *uint32 `json:"a,string"`
}{A: uint32ptr(1)},
},
// HeadUint32PtrNil
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:27:57 +03:00
name: "HeadUint32PtrNil",
2021-01-16 16:16:26 +03:00
data: struct {
A *uint32 `json:"a"`
}{A: nil},
},
{
2021-02-15 05:27:57 +03:00
name: "HeadUint32PtrNilOmitEmpty",
data: struct {
A *uint32 `json:"a,omitempty"`
}{A: nil},
},
{
2021-02-15 05:27:57 +03:00
name: "HeadUint32PtrNilString",
data: struct {
A *uint32 `json:"a,string"`
}{A: nil},
},
// PtrHeadUint32Zero
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32Zero",
2021-01-16 16:16:26 +03:00
data: &struct {
A uint32 `json:"a"`
}{},
},
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32ZeroOmitEmpty",
data: &struct {
A uint32 `json:"a,omitempty"`
}{},
},
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32ZeroString",
data: &struct {
A uint32 `json:"a,string"`
}{},
},
// PtrHeadUint32
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32",
2021-01-16 16:16:26 +03:00
data: &struct {
A uint32 `json:"a"`
}{A: 1},
},
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32OmitEmpty",
data: &struct {
A uint32 `json:"a,omitempty"`
}{A: 1},
},
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32String",
data: &struct {
A uint32 `json:"a,string"`
}{A: 1},
},
// PtrHeadUint32Ptr
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32Ptr",
2021-01-16 16:16:26 +03:00
data: &struct {
A *uint32 `json:"a"`
}{A: uint32ptr(1)},
},
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32PtrOmitEmpty",
data: &struct {
A *uint32 `json:"a,omitempty"`
}{A: uint32ptr(1)},
},
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32PtrString",
data: &struct {
A *uint32 `json:"a,string"`
}{A: uint32ptr(1)},
},
// PtrHeadUint32PtrNil
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32PtrNil",
2021-01-16 16:16:26 +03:00
data: &struct {
A *uint32 `json:"a"`
}{A: nil},
},
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32PtrNilOmitEmpty",
data: &struct {
A *uint32 `json:"a,omitempty"`
}{A: nil},
},
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32PtrNilString",
data: &struct {
A *uint32 `json:"a,string"`
}{A: nil},
},
// PtrHeadUint32Nil
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32Nil",
2021-01-16 16:16:26 +03:00
data: (*struct {
A *uint32 `json:"a"`
})(nil),
},
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32NilOmitEmpty",
data: (*struct {
A *uint32 `json:"a,omitempty"`
})(nil),
},
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32NilString",
data: (*struct {
A *uint32 `json:"a,string"`
})(nil),
},
// HeadUint32ZeroMultiFields
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:27:57 +03:00
name: "HeadUint32ZeroMultiFields",
2021-01-16 16:16:26 +03:00
data: struct {
A uint32 `json:"a"`
B uint32 `json:"b"`
2021-02-15 05:27:57 +03:00
C uint32 `json:"c"`
2021-01-16 16:16:26 +03:00
}{},
},
{
2021-02-15 05:27:57 +03:00
name: "HeadUint32ZeroMultiFieldsOmitEmpty",
data: struct {
A uint32 `json:"a,omitempty"`
B uint32 `json:"b,omitempty"`
2021-02-15 05:27:57 +03:00
C uint32 `json:"c,omitempty"`
}{},
},
{
2021-02-15 05:27:57 +03:00
name: "HeadUint32ZeroMultiFields",
data: struct {
A uint32 `json:"a,string"`
B uint32 `json:"b,string"`
2021-02-15 05:27:57 +03:00
C uint32 `json:"c,string"`
}{},
},
// HeadUint32MultiFields
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:27:57 +03:00
name: "HeadUint32MultiFields",
2021-01-16 16:16:26 +03:00
data: struct {
A uint32 `json:"a"`
B uint32 `json:"b"`
2021-02-15 05:27:57 +03:00
C uint32 `json:"c"`
}{A: 1, B: 2, C: 3},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:27:57 +03:00
name: "HeadUint32MultiFieldsOmitEmpty",
2021-01-16 16:16:26 +03:00
data: struct {
A uint32 `json:"a,omitempty"`
B uint32 `json:"b,omitempty"`
2021-02-15 05:27:57 +03:00
C uint32 `json:"c,omitempty"`
}{A: 1, B: 2, C: 3},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:27:57 +03:00
name: "HeadUint32MultiFieldsString",
2021-01-16 16:16:26 +03:00
data: struct {
A uint32 `json:"a,string"`
B uint32 `json:"b,string"`
2021-02-15 05:27:57 +03:00
C uint32 `json:"c,string"`
}{A: 1, B: 2, C: 3},
2021-01-16 16:16:26 +03:00
},
// HeadUint32PtrMultiFields
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:27:57 +03:00
name: "HeadUint32PtrMultiFields",
data: struct {
A *uint32 `json:"a"`
B *uint32 `json:"b"`
2021-02-15 05:27:57 +03:00
C *uint32 `json:"c"`
}{A: uint32ptr(1), B: uint32ptr(2), C: uint32ptr(3)},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:27:57 +03:00
name: "HeadUint32PtrMultiFieldsOmitEmpty",
data: struct {
A *uint32 `json:"a,omitempty"`
B *uint32 `json:"b,omitempty"`
2021-02-15 05:27:57 +03:00
C *uint32 `json:"c,omitempty"`
}{A: uint32ptr(1), B: uint32ptr(2), C: uint32ptr(3)},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:27:57 +03:00
name: "HeadUint32PtrMultiFieldsString",
data: struct {
A *uint32 `json:"a,string"`
B *uint32 `json:"b,string"`
2021-02-15 05:27:57 +03:00
C *uint32 `json:"c,string"`
}{A: uint32ptr(1), B: uint32ptr(2), C: uint32ptr(3)},
2021-01-16 16:16:26 +03:00
},
// HeadUint32PtrNilMultiFields
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:27:57 +03:00
name: "HeadUint32PtrNilMultiFields",
data: struct {
2021-01-16 16:16:26 +03:00
A *uint32 `json:"a"`
B *uint32 `json:"b"`
2021-02-15 05:27:57 +03:00
C *uint32 `json:"c"`
}{A: nil, B: nil, C: nil},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:27:57 +03:00
name: "HeadUint32PtrNilMultiFieldsOmitEmpty",
data: struct {
A *uint32 `json:"a,omitempty"`
B *uint32 `json:"b,omitempty"`
2021-02-15 05:27:57 +03:00
C *uint32 `json:"c,omitempty"`
}{A: nil, B: nil, C: nil},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:27:57 +03:00
name: "HeadUint32PtrNilMultiFieldsString",
data: struct {
A *uint32 `json:"a,string"`
B *uint32 `json:"b,string"`
2021-02-15 05:27:57 +03:00
C *uint32 `json:"c,string"`
}{A: nil, B: nil, C: nil},
},
// PtrHeadUint32ZeroMultiFields
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32ZeroMultiFields",
data: &struct {
A uint32 `json:"a"`
B uint32 `json:"b"`
}{},
},
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32ZeroMultiFieldsOmitEmpty",
data: &struct {
A uint32 `json:"a,omitempty"`
B uint32 `json:"b,omitempty"`
}{},
},
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32ZeroMultiFieldsString",
data: &struct {
A uint32 `json:"a,string"`
B uint32 `json:"b,string"`
}{},
},
// PtrHeadUint32MultiFields
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32MultiFields",
data: &struct {
A uint32 `json:"a"`
B uint32 `json:"b"`
}{A: 1, B: 2},
},
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32MultiFieldsOmitEmpty",
data: &struct {
A uint32 `json:"a,omitempty"`
B uint32 `json:"b,omitempty"`
}{A: 1, B: 2},
},
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32MultiFieldsString",
data: &struct {
A uint32 `json:"a,string"`
B uint32 `json:"b,string"`
}{A: 1, B: 2},
},
// PtrHeadUint32PtrMultiFields
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32PtrMultiFields",
data: &struct {
A *uint32 `json:"a"`
B *uint32 `json:"b"`
}{A: uint32ptr(1), B: uint32ptr(2)},
},
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32PtrMultiFieldsOmitEmpty",
data: &struct {
A *uint32 `json:"a,omitempty"`
B *uint32 `json:"b,omitempty"`
}{A: uint32ptr(1), B: uint32ptr(2)},
},
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32PtrMultiFieldsString",
data: &struct {
A *uint32 `json:"a,string"`
B *uint32 `json:"b,string"`
}{A: uint32ptr(1), B: uint32ptr(2)},
},
// PtrHeadUint32PtrNilMultiFields
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32PtrNilMultiFields",
data: &struct {
A *uint32 `json:"a"`
B *uint32 `json:"b"`
}{A: nil, B: nil},
},
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32PtrNilMultiFieldsOmitEmpty",
data: &struct {
A *uint32 `json:"a,omitempty"`
B *uint32 `json:"b,omitempty"`
}{A: nil, B: nil},
},
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32PtrNilMultiFieldsString",
data: &struct {
A *uint32 `json:"a,string"`
B *uint32 `json:"b,string"`
}{A: nil, B: nil},
},
// PtrHeadUint32NilMultiFields
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32NilMultiFields",
data: (*struct {
A *uint32 `json:"a"`
B *uint32 `json:"b"`
})(nil),
},
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32NilMultiFieldsOmitEmpty",
data: (*struct {
A *uint32 `json:"a,omitempty"`
B *uint32 `json:"b,omitempty"`
})(nil),
},
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32NilMultiFieldsString",
data: (*struct {
A *uint32 `json:"a,string"`
B *uint32 `json:"b,string"`
})(nil),
},
// HeadUint32ZeroNotRoot
{
2021-02-15 05:27:57 +03:00
name: "HeadUint32ZeroNotRoot",
2021-01-16 16:16:26 +03:00
data: struct {
A struct {
A uint32 `json:"a"`
}
}{},
},
{
2021-02-15 05:27:57 +03:00
name: "HeadUint32ZeroNotRootOmitEmpty",
data: struct {
A struct {
A uint32 `json:"a,omitempty"`
}
}{},
},
{
2021-02-15 05:27:57 +03:00
name: "HeadUint32ZeroNotRootString",
data: struct {
A struct {
A uint32 `json:"a,string"`
}
}{},
},
// HeadUint32NotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:27:57 +03:00
name: "HeadUint32NotRoot",
2021-01-16 16:16:26 +03:00
data: struct {
A struct {
A uint32 `json:"a"`
}
}{A: struct {
A uint32 `json:"a"`
}{A: 1}},
},
{
2021-02-15 05:27:57 +03:00
name: "HeadUint32NotRootOmitEmpty",
2021-01-16 16:16:26 +03:00
data: struct {
A struct {
A uint32 `json:"a,omitempty"`
2021-01-16 16:16:26 +03:00
}
}{A: struct {
A uint32 `json:"a,omitempty"`
}{A: 1}},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:27:57 +03:00
name: "HeadUint32NotRootString",
2021-01-16 16:16:26 +03:00
data: struct {
A struct {
A uint32 `json:"a,string"`
2021-01-16 16:16:26 +03:00
}
}{A: struct {
A uint32 `json:"a,string"`
}{A: 1}},
2021-01-16 16:16:26 +03:00
},
// HeadUint32PtrNotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:27:57 +03:00
name: "HeadUint32PtrNotRoot",
2021-01-16 16:16:26 +03:00
data: struct {
A struct {
A *uint32 `json:"a"`
2021-01-16 16:16:26 +03:00
}
}{A: struct {
A *uint32 `json:"a"`
}{uint32ptr(1)}},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:27:57 +03:00
name: "HeadUint32PtrNotRootOmitEmpty",
2021-01-16 16:16:26 +03:00
data: struct {
A struct {
A *uint32 `json:"a,omitempty"`
2021-01-16 16:16:26 +03:00
}
}{A: struct {
A *uint32 `json:"a,omitempty"`
}{uint32ptr(1)}},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:27:57 +03:00
name: "HeadUint32PtrNotRootString",
2021-01-16 16:16:26 +03:00
data: struct {
A struct {
A *uint32 `json:"a,string"`
2021-01-16 16:16:26 +03:00
}
}{A: struct {
A *uint32 `json:"a,string"`
}{uint32ptr(1)}},
2021-01-16 16:16:26 +03:00
},
// HeadUint32PtrNilNotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:27:57 +03:00
name: "HeadUint32PtrNilNotRoot",
data: struct {
A struct {
A *uint32 `json:"a"`
}
}{},
},
{
2021-02-15 05:27:57 +03:00
name: "HeadUint32PtrNilNotRootOmitEmpty",
data: struct {
A struct {
A *uint32 `json:"a,omitempty"`
}
}{},
},
{
2021-02-15 05:27:57 +03:00
name: "HeadUint32PtrNilNotRootString",
data: struct {
A struct {
A *uint32 `json:"a,string"`
}
}{},
},
// PtrHeadUint32ZeroNotRoot
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32ZeroNotRoot",
data: struct {
A *struct {
A uint32 `json:"a"`
}
}{A: new(struct {
A uint32 `json:"a"`
})},
},
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32ZeroNotRootOmitEmpty",
data: struct {
A *struct {
A uint32 `json:"a,omitempty"`
}
}{A: new(struct {
A uint32 `json:"a,omitempty"`
})},
},
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32ZeroNotRootString",
data: struct {
A *struct {
A uint32 `json:"a,string"`
}
}{A: new(struct {
A uint32 `json:"a,string"`
})},
},
// PtrHeadUint32NotRoot
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32NotRoot",
data: struct {
A *struct {
A uint32 `json:"a"`
}
}{A: &(struct {
A uint32 `json:"a"`
}{A: 1})},
},
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32NotRootOmitEmpty",
data: struct {
A *struct {
A uint32 `json:"a,omitempty"`
}
}{A: &(struct {
A uint32 `json:"a,omitempty"`
}{A: 1})},
},
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32NotRootString",
data: struct {
A *struct {
A uint32 `json:"a,string"`
}
}{A: &(struct {
A uint32 `json:"a,string"`
}{A: 1})},
},
// PtrHeadUint32PtrNotRoot
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32PtrNotRoot",
data: struct {
A *struct {
A *uint32 `json:"a"`
}
}{A: &(struct {
A *uint32 `json:"a"`
}{A: uint32ptr(1)})},
},
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32PtrNotRootOmitEmpty",
data: struct {
A *struct {
A *uint32 `json:"a,omitempty"`
}
}{A: &(struct {
A *uint32 `json:"a,omitempty"`
}{A: uint32ptr(1)})},
},
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32PtrNotRootString",
data: struct {
A *struct {
A *uint32 `json:"a,string"`
}
}{A: &(struct {
A *uint32 `json:"a,string"`
}{A: uint32ptr(1)})},
},
// PtrHeadUint32PtrNilNotRoot
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32PtrNilNotRoot",
data: struct {
A *struct {
A *uint32 `json:"a"`
}
}{A: &(struct {
A *uint32 `json:"a"`
}{A: nil})},
},
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32PtrNilNotRootOmitEmpty",
data: struct {
A *struct {
A *uint32 `json:"a,omitempty"`
}
}{A: &(struct {
A *uint32 `json:"a,omitempty"`
}{A: nil})},
},
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32PtrNilNotRootString",
data: struct {
A *struct {
A *uint32 `json:"a,string"`
}
}{A: &(struct {
A *uint32 `json:"a,string"`
}{A: nil})},
},
// PtrHeadUint32NilNotRoot
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32NilNotRoot",
data: struct {
A *struct {
A *uint32 `json:"a"`
}
}{A: nil},
},
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32NilNotRootOmitEmpty",
data: struct {
A *struct {
A *uint32 `json:"a,omitempty"`
} `json:",omitempty"`
}{A: nil},
},
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32NilNotRootString",
data: struct {
A *struct {
A *uint32 `json:"a,string"`
} `json:",string"`
}{A: nil},
},
// HeadUint32ZeroMultiFieldsNotRoot
{
2021-02-15 05:27:57 +03:00
name: "HeadUint32ZeroMultiFieldsNotRoot",
data: struct {
A struct {
A uint32 `json:"a"`
}
B struct {
B uint32 `json:"b"`
}
}{},
},
{
2021-02-15 05:27:57 +03:00
name: "HeadUint32ZeroMultiFieldsNotRootOmitEmpty",
data: struct {
A struct {
A uint32 `json:"a,omitempty"`
}
B struct {
B uint32 `json:"b,omitempty"`
}
}{},
},
{
2021-02-15 05:27:57 +03:00
name: "HeadUint32ZeroMultiFieldsNotRootString",
data: struct {
A struct {
A uint32 `json:"a,string"`
}
B struct {
B uint32 `json:"b,string"`
}
}{},
},
// HeadUint32MultiFieldsNotRoot
{
2021-02-15 05:27:57 +03:00
name: "HeadUint32MultiFieldsNotRoot",
data: struct {
A struct {
A uint32 `json:"a"`
}
B struct {
B uint32 `json:"b"`
}
}{A: struct {
A uint32 `json:"a"`
}{A: 1}, B: struct {
B uint32 `json:"b"`
}{B: 2}},
},
{
2021-02-15 05:27:57 +03:00
name: "HeadUint32MultiFieldsNotRootOmitEmpty",
data: struct {
A struct {
A uint32 `json:"a,omitempty"`
}
B struct {
B uint32 `json:"b,omitempty"`
}
}{A: struct {
A uint32 `json:"a,omitempty"`
}{A: 1}, B: struct {
B uint32 `json:"b,omitempty"`
}{B: 2}},
},
{
2021-02-15 05:27:57 +03:00
name: "HeadUint32MultiFieldsNotRootString",
data: struct {
A struct {
A uint32 `json:"a,string"`
}
B struct {
B uint32 `json:"b,string"`
}
}{A: struct {
A uint32 `json:"a,string"`
}{A: 1}, B: struct {
B uint32 `json:"b,string"`
}{B: 2}},
},
// HeadUint32PtrMultiFieldsNotRoot
{
2021-02-15 05:27:57 +03:00
name: "HeadUint32PtrMultiFieldsNotRoot",
data: struct {
A struct {
A *uint32 `json:"a"`
}
B struct {
B *uint32 `json:"b"`
}
}{A: struct {
A *uint32 `json:"a"`
}{A: uint32ptr(1)}, B: struct {
B *uint32 `json:"b"`
}{B: uint32ptr(2)}},
},
{
2021-02-15 05:27:57 +03:00
name: "HeadUint32PtrMultiFieldsNotRootOmitEmpty",
data: struct {
A struct {
A *uint32 `json:"a,omitempty"`
}
B struct {
B *uint32 `json:"b,omitempty"`
}
}{A: struct {
A *uint32 `json:"a,omitempty"`
}{A: uint32ptr(1)}, B: struct {
B *uint32 `json:"b,omitempty"`
}{B: uint32ptr(2)}},
},
{
2021-02-15 05:27:57 +03:00
name: "HeadUint32PtrMultiFieldsNotRootString",
data: struct {
A struct {
A *uint32 `json:"a,string"`
}
B struct {
B *uint32 `json:"b,string"`
}
}{A: struct {
A *uint32 `json:"a,string"`
}{A: uint32ptr(1)}, B: struct {
B *uint32 `json:"b,string"`
}{B: uint32ptr(2)}},
},
// HeadUint32PtrNilMultiFieldsNotRoot
{
2021-02-15 05:27:57 +03:00
name: "HeadUint32PtrNilMultiFieldsNotRoot",
data: struct {
A struct {
A *uint32 `json:"a"`
}
B struct {
B *uint32 `json:"b"`
}
}{A: struct {
A *uint32 `json:"a"`
}{A: nil}, B: struct {
B *uint32 `json:"b"`
}{B: nil}},
},
{
2021-02-15 05:27:57 +03:00
name: "HeadUint32PtrNilMultiFieldsNotRootOmitEmpty",
data: struct {
A struct {
A *uint32 `json:"a,omitempty"`
}
B struct {
B *uint32 `json:"b,omitempty"`
}
}{A: struct {
A *uint32 `json:"a,omitempty"`
}{A: nil}, B: struct {
B *uint32 `json:"b,omitempty"`
}{B: nil}},
},
{
2021-02-15 05:27:57 +03:00
name: "HeadUint32PtrNilMultiFieldsNotRootString",
data: struct {
A struct {
A *uint32 `json:"a,string"`
}
B struct {
B *uint32 `json:"b,string"`
}
}{A: struct {
A *uint32 `json:"a,string"`
}{A: nil}, B: struct {
B *uint32 `json:"b,string"`
}{B: nil}},
},
// PtrHeadUint32ZeroMultiFieldsNotRoot
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32ZeroMultiFieldsNotRoot",
data: &struct {
A struct {
A uint32 `json:"a"`
2021-01-16 16:16:26 +03:00
}
B struct {
B uint32 `json:"b"`
}
}{},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32ZeroMultiFieldsNotRootOmitEmpty",
data: &struct {
A struct {
A uint32 `json:"a,omitempty"`
2021-01-16 16:16:26 +03:00
}
B struct {
B uint32 `json:"b,omitempty"`
}
}{},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32ZeroMultiFieldsNotRootString",
data: &struct {
2021-01-16 16:16:26 +03:00
A struct {
A uint32 `json:"a,string"`
2021-01-16 16:16:26 +03:00
}
B struct {
B uint32 `json:"b,string"`
2021-01-16 16:16:26 +03:00
}
}{},
},
// PtrHeadUint32MultiFieldsNotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32MultiFieldsNotRoot",
data: &struct {
2021-01-16 16:16:26 +03:00
A struct {
A uint32 `json:"a"`
}
B struct {
B uint32 `json:"b"`
}
}{A: struct {
A uint32 `json:"a"`
}{A: 1}, B: struct {
B uint32 `json:"b"`
}{B: 2}},
},
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32MultiFieldsNotRootOmitEmpty",
data: &struct {
2021-01-16 16:16:26 +03:00
A struct {
A uint32 `json:"a,omitempty"`
2021-01-16 16:16:26 +03:00
}
B struct {
B uint32 `json:"b,omitempty"`
2021-01-16 16:16:26 +03:00
}
}{A: struct {
A uint32 `json:"a,omitempty"`
}{A: 1}, B: struct {
B uint32 `json:"b,omitempty"`
}{B: 2}},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32MultiFieldsNotRootString",
data: &struct {
2021-01-16 16:16:26 +03:00
A struct {
A uint32 `json:"a,string"`
2021-01-16 16:16:26 +03:00
}
B struct {
B uint32 `json:"b,string"`
2021-01-16 16:16:26 +03:00
}
}{A: struct {
A uint32 `json:"a,string"`
}{A: 1}, B: struct {
B uint32 `json:"b,string"`
}{B: 2}},
2021-01-16 16:16:26 +03:00
},
// PtrHeadUint32PtrMultiFieldsNotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32PtrMultiFieldsNotRoot",
2021-01-16 16:16:26 +03:00
data: &struct {
A *struct {
A *uint32 `json:"a"`
2021-01-16 16:16:26 +03:00
}
B *struct {
B *uint32 `json:"b"`
2021-01-16 16:16:26 +03:00
}
}{A: &(struct {
A *uint32 `json:"a"`
}{A: uint32ptr(1)}), B: &(struct {
B *uint32 `json:"b"`
}{B: uint32ptr(2)})},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32PtrMultiFieldsNotRootOmitEmpty",
2021-01-16 16:16:26 +03:00
data: &struct {
A *struct {
A *uint32 `json:"a,omitempty"`
}
B *struct {
B *uint32 `json:"b,omitempty"`
}
}{A: &(struct {
A *uint32 `json:"a,omitempty"`
}{A: uint32ptr(1)}), B: &(struct {
B *uint32 `json:"b,omitempty"`
}{B: uint32ptr(2)})},
},
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32PtrMultiFieldsNotRootString",
data: &struct {
A *struct {
A *uint32 `json:"a,string"`
}
B *struct {
B *uint32 `json:"b,string"`
}
}{A: &(struct {
A *uint32 `json:"a,string"`
}{A: uint32ptr(1)}), B: &(struct {
B *uint32 `json:"b,string"`
}{B: uint32ptr(2)})},
},
// PtrHeadUint32PtrNilMultiFieldsNotRoot
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32PtrNilMultiFieldsNotRoot",
data: &struct {
A *struct {
A *uint32 `json:"a"`
}
B *struct {
B *uint32 `json:"b"`
}
}{A: nil, B: nil},
},
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32PtrNilMultiFieldsNotRootOmitEmpty",
data: &struct {
A *struct {
A *uint32 `json:"a,omitempty"`
} `json:",omitempty"`
B *struct {
B *uint32 `json:"b,omitempty"`
} `json:",omitempty"`
}{A: nil, B: nil},
},
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32PtrNilMultiFieldsNotRootString",
data: &struct {
A *struct {
A *uint32 `json:"a,string"`
} `json:",string"`
B *struct {
B *uint32 `json:"b,string"`
} `json:",string"`
}{A: nil, B: nil},
},
// PtrHeadUint32NilMultiFieldsNotRoot
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32NilMultiFieldsNotRoot",
data: (*struct {
A *struct {
A *uint32 `json:"a"`
}
B *struct {
B *uint32 `json:"b"`
}
})(nil),
},
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32NilMultiFieldsNotRootOmitEmpty",
data: (*struct {
A *struct {
A *uint32 `json:"a,omitempty"`
}
B *struct {
B *uint32 `json:"b,omitempty"`
}
})(nil),
},
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32NilMultiFieldsNotRootString",
data: (*struct {
A *struct {
A *uint32 `json:"a,string"`
}
B *struct {
B *uint32 `json:"b,string"`
}
})(nil),
},
// PtrHeadUint32DoubleMultiFieldsNotRoot
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32DoubleMultiFieldsNotRoot",
data: &struct {
A *struct {
2021-01-16 16:16:26 +03:00
A uint32 `json:"a"`
B uint32 `json:"b"`
2021-01-16 16:16:26 +03:00
}
B *struct {
A uint32 `json:"a"`
2021-01-16 16:16:26 +03:00
B uint32 `json:"b"`
}
}{A: &(struct {
2021-01-16 16:16:26 +03:00
A uint32 `json:"a"`
B uint32 `json:"b"`
}{A: 1, B: 2}), B: &(struct {
A uint32 `json:"a"`
B uint32 `json:"b"`
}{A: 3, B: 4})},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32DoubleMultiFieldsNotRootOmitEmpty",
data: &struct {
A *struct {
A uint32 `json:"a,omitempty"`
B uint32 `json:"b,omitempty"`
}
B *struct {
A uint32 `json:"a,omitempty"`
B uint32 `json:"b,omitempty"`
}
}{A: &(struct {
A uint32 `json:"a,omitempty"`
B uint32 `json:"b,omitempty"`
}{A: 1, B: 2}), B: &(struct {
A uint32 `json:"a,omitempty"`
B uint32 `json:"b,omitempty"`
}{A: 3, B: 4})},
},
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32DoubleMultiFieldsNotRootString",
2021-01-16 16:16:26 +03:00
data: &struct {
A *struct {
A uint32 `json:"a,string"`
B uint32 `json:"b,string"`
2021-01-16 16:16:26 +03:00
}
B *struct {
A uint32 `json:"a,string"`
B uint32 `json:"b,string"`
2021-01-16 16:16:26 +03:00
}
}{A: &(struct {
A uint32 `json:"a,string"`
B uint32 `json:"b,string"`
}{A: 1, B: 2}), B: &(struct {
A uint32 `json:"a,string"`
B uint32 `json:"b,string"`
}{A: 3, B: 4})},
2021-01-16 16:16:26 +03:00
},
// PtrHeadUint32NilDoubleMultiFieldsNotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32NilDoubleMultiFieldsNotRoot",
2021-01-16 16:16:26 +03:00
data: &struct {
A *struct {
A uint32 `json:"a"`
B uint32 `json:"b"`
2021-01-16 16:16:26 +03:00
}
B *struct {
A uint32 `json:"a"`
B uint32 `json:"b"`
2021-01-16 16:16:26 +03:00
}
}{A: nil, B: nil},
},
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32NilDoubleMultiFieldsNotRootOmitEmpty",
data: &struct {
2021-01-16 16:16:26 +03:00
A *struct {
A uint32 `json:"a,omitempty"`
B uint32 `json:"b,omitempty"`
} `json:",omitempty"`
2021-01-16 16:16:26 +03:00
B *struct {
A uint32 `json:"a,omitempty"`
B uint32 `json:"b,omitempty"`
} `json:",omitempty"`
}{A: nil, B: nil},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32NilDoubleMultiFieldsNotRootString",
2021-01-16 16:16:26 +03:00
data: &struct {
A *struct {
A uint32 `json:"a,string"`
B uint32 `json:"b,string"`
2021-01-16 16:16:26 +03:00
}
B *struct {
A uint32 `json:"a,string"`
B uint32 `json:"b,string"`
2021-01-16 16:16:26 +03:00
}
}{A: nil, B: nil},
2021-01-16 16:16:26 +03:00
},
// PtrHeadUint32NilDoubleMultiFieldsNotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32NilDoubleMultiFieldsNotRoot",
data: (*struct {
2021-01-16 16:16:26 +03:00
A *struct {
A uint32 `json:"a"`
B uint32 `json:"b"`
}
B *struct {
A uint32 `json:"a"`
B uint32 `json:"b"`
}
})(nil),
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32NilDoubleMultiFieldsNotRootOmitEmpty",
2021-01-16 16:16:26 +03:00
data: (*struct {
A *struct {
A uint32 `json:"a,omitempty"`
B uint32 `json:"b,omitempty"`
2021-01-16 16:16:26 +03:00
}
B *struct {
A uint32 `json:"a,omitempty"`
B uint32 `json:"b,omitempty"`
}
})(nil),
},
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32NilDoubleMultiFieldsNotRootString",
data: (*struct {
A *struct {
A uint32 `json:"a,string"`
B uint32 `json:"b,string"`
}
B *struct {
A uint32 `json:"a,string"`
B uint32 `json:"b,string"`
2021-01-16 16:16:26 +03:00
}
})(nil),
},
// PtrHeadUint32PtrDoubleMultiFieldsNotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32PtrDoubleMultiFieldsNotRoot",
2021-01-16 16:16:26 +03:00
data: &struct {
A *struct {
A *uint32 `json:"a"`
B *uint32 `json:"b"`
}
B *struct {
A *uint32 `json:"a"`
B *uint32 `json:"b"`
}
}{A: &(struct {
A *uint32 `json:"a"`
B *uint32 `json:"b"`
}{A: uint32ptr(1), B: uint32ptr(2)}), B: &(struct {
A *uint32 `json:"a"`
B *uint32 `json:"b"`
}{A: uint32ptr(3), B: uint32ptr(4)})},
},
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32PtrDoubleMultiFieldsNotRootOmitEmpty",
data: &struct {
A *struct {
A *uint32 `json:"a,omitempty"`
B *uint32 `json:"b,omitempty"`
}
B *struct {
A *uint32 `json:"a,omitempty"`
B *uint32 `json:"b,omitempty"`
}
}{A: &(struct {
A *uint32 `json:"a,omitempty"`
B *uint32 `json:"b,omitempty"`
}{A: uint32ptr(1), B: uint32ptr(2)}), B: &(struct {
A *uint32 `json:"a,omitempty"`
B *uint32 `json:"b,omitempty"`
}{A: uint32ptr(3), B: uint32ptr(4)})},
},
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32PtrDoubleMultiFieldsNotRootString",
data: &struct {
A *struct {
A *uint32 `json:"a,string"`
B *uint32 `json:"b,string"`
}
B *struct {
A *uint32 `json:"a,string"`
B *uint32 `json:"b,string"`
}
}{A: &(struct {
A *uint32 `json:"a,string"`
B *uint32 `json:"b,string"`
}{A: uint32ptr(1), B: uint32ptr(2)}), B: &(struct {
A *uint32 `json:"a,string"`
B *uint32 `json:"b,string"`
}{A: uint32ptr(3), B: uint32ptr(4)})},
},
// PtrHeadUint32PtrNilDoubleMultiFieldsNotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32PtrNilDoubleMultiFieldsNotRoot",
2021-01-16 16:16:26 +03:00
data: &struct {
A *struct {
A *uint32 `json:"a"`
B *uint32 `json:"b"`
}
B *struct {
A *uint32 `json:"a"`
B *uint32 `json:"b"`
}
}{A: nil, B: nil},
},
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32PtrNilDoubleMultiFieldsNotRootOmitEmpty",
data: &struct {
A *struct {
A *uint32 `json:"a,omitempty"`
B *uint32 `json:"b,omitempty"`
} `json:",omitempty"`
B *struct {
A *uint32 `json:"a,omitempty"`
B *uint32 `json:"b,omitempty"`
} `json:",omitempty"`
}{A: nil, B: nil},
},
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32PtrNilDoubleMultiFieldsNotRootString",
data: &struct {
A *struct {
A *uint32 `json:"a,string"`
B *uint32 `json:"b,string"`
}
B *struct {
A *uint32 `json:"a,string"`
B *uint32 `json:"b,string"`
}
}{A: nil, B: nil},
},
// PtrHeadUint32PtrNilDoubleMultiFieldsNotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32PtrNilDoubleMultiFieldsNotRoot",
2021-01-16 16:16:26 +03:00
data: (*struct {
A *struct {
A *uint32 `json:"a"`
B *uint32 `json:"b"`
}
B *struct {
A *uint32 `json:"a"`
B *uint32 `json:"b"`
}
})(nil),
},
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32PtrNilDoubleMultiFieldsNotRootOmitEmpty",
data: (*struct {
A *struct {
A *uint32 `json:"a,omitempty"`
B *uint32 `json:"b,omitempty"`
}
B *struct {
A *uint32 `json:"a,omitempty"`
B *uint32 `json:"b,omitempty"`
}
})(nil),
},
{
2021-02-15 05:27:57 +03:00
name: "PtrHeadUint32PtrNilDoubleMultiFieldsNotRootString",
data: (*struct {
A *struct {
A *uint32 `json:"a,string"`
B *uint32 `json:"b,string"`
}
B *struct {
A *uint32 `json:"a,string"`
B *uint32 `json:"b,string"`
}
})(nil),
},
// AnonymousHeadUint32
{
2021-02-15 05:27:57 +03:00
name: "AnonymousHeadUint32",
data: struct {
structUint32
B uint32 `json:"b"`
}{
structUint32: structUint32{A: 1},
B: 2,
},
},
{
2021-02-15 05:27:57 +03:00
name: "AnonymousHeadUint32OmitEmpty",
data: struct {
structUint32OmitEmpty
B uint32 `json:"b,omitempty"`
}{
structUint32OmitEmpty: structUint32OmitEmpty{A: 1},
B: 2,
},
},
{
2021-02-15 05:27:57 +03:00
name: "AnonymousHeadUint32String",
data: struct {
structUint32String
B uint32 `json:"b,string"`
}{
structUint32String: structUint32String{A: 1},
B: 2,
},
},
// PtrAnonymousHeadUint32
{
2021-02-15 05:27:57 +03:00
name: "PtrAnonymousHeadUint32",
data: struct {
*structUint32
B uint32 `json:"b"`
}{
structUint32: &structUint32{A: 1},
B: 2,
},
},
{
2021-02-15 05:27:57 +03:00
name: "PtrAnonymousHeadUint32OmitEmpty",
data: struct {
*structUint32OmitEmpty
B uint32 `json:"b,omitempty"`
}{
structUint32OmitEmpty: &structUint32OmitEmpty{A: 1},
B: 2,
},
},
{
2021-02-15 05:27:57 +03:00
name: "PtrAnonymousHeadUint32String",
data: struct {
*structUint32String
B uint32 `json:"b,string"`
}{
structUint32String: &structUint32String{A: 1},
B: 2,
},
},
// NilPtrAnonymousHeadUint32
{
2021-02-15 05:27:57 +03:00
name: "NilPtrAnonymousHeadUint32",
2021-01-16 16:16:26 +03:00
data: struct {
*structUint32
2021-01-16 16:16:26 +03:00
B uint32 `json:"b"`
}{
structUint32: nil,
2021-01-16 16:16:26 +03:00
B: 2,
},
},
{
2021-02-15 05:27:57 +03:00
name: "NilPtrAnonymousHeadUint32OmitEmpty",
2021-01-16 16:16:26 +03:00
data: struct {
*structUint32OmitEmpty
B uint32 `json:"b,omitempty"`
2021-01-16 16:16:26 +03:00
}{
structUint32OmitEmpty: nil,
B: 2,
2021-01-16 16:16:26 +03:00
},
},
{
2021-02-15 05:27:57 +03:00
name: "NilPtrAnonymousHeadUint32String",
2021-01-16 16:16:26 +03:00
data: struct {
*structUint32String
B uint32 `json:"b,string"`
2021-01-16 16:16:26 +03:00
}{
structUint32String: nil,
B: 2,
2021-01-16 16:16:26 +03:00
},
},
// AnonymousHeadUint32Ptr
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:27:57 +03:00
name: "AnonymousHeadUint32Ptr",
2021-01-16 16:16:26 +03:00
data: struct {
structUint32Ptr
B *uint32 `json:"b"`
}{
structUint32Ptr: structUint32Ptr{A: uint32ptr(1)},
B: uint32ptr(2),
},
},
{
2021-02-15 05:27:57 +03:00
name: "AnonymousHeadUint32PtrOmitEmpty",
data: struct {
structUint32PtrOmitEmpty
B *uint32 `json:"b,omitempty"`
}{
structUint32PtrOmitEmpty: structUint32PtrOmitEmpty{A: uint32ptr(1)},
B: uint32ptr(2),
},
},
{
2021-02-15 05:27:57 +03:00
name: "AnonymousHeadUint32PtrString",
data: struct {
structUint32PtrString
B *uint32 `json:"b,string"`
}{
structUint32PtrString: structUint32PtrString{A: uint32ptr(1)},
B: uint32ptr(2),
},
},
// AnonymousHeadUint32PtrNil
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:27:57 +03:00
name: "AnonymousHeadUint32PtrNil",
2021-01-16 16:16:26 +03:00
data: struct {
structUint32Ptr
B *uint32 `json:"b"`
}{
structUint32Ptr: structUint32Ptr{A: nil},
B: uint32ptr(2),
},
},
{
2021-02-15 05:27:57 +03:00
name: "AnonymousHeadUint32PtrNilOmitEmpty",
data: struct {
structUint32PtrOmitEmpty
B *uint32 `json:"b,omitempty"`
}{
structUint32PtrOmitEmpty: structUint32PtrOmitEmpty{A: nil},
B: uint32ptr(2),
},
},
{
2021-02-15 05:27:57 +03:00
name: "AnonymousHeadUint32PtrNilString",
data: struct {
structUint32PtrString
B *uint32 `json:"b,string"`
}{
structUint32PtrString: structUint32PtrString{A: nil},
B: uint32ptr(2),
},
},
// PtrAnonymousHeadUint32Ptr
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:27:57 +03:00
name: "PtrAnonymousHeadUint32Ptr",
2021-01-16 16:16:26 +03:00
data: struct {
*structUint32Ptr
B *uint32 `json:"b"`
}{
structUint32Ptr: &structUint32Ptr{A: uint32ptr(1)},
B: uint32ptr(2),
},
},
{
2021-02-15 05:27:57 +03:00
name: "PtrAnonymousHeadUint32PtrOmitEmpty",
data: struct {
*structUint32PtrOmitEmpty
B *uint32 `json:"b,omitempty"`
}{
structUint32PtrOmitEmpty: &structUint32PtrOmitEmpty{A: uint32ptr(1)},
B: uint32ptr(2),
},
},
{
2021-02-15 05:27:57 +03:00
name: "PtrAnonymousHeadUint32PtrString",
data: struct {
*structUint32PtrString
B *uint32 `json:"b,string"`
}{
structUint32PtrString: &structUint32PtrString{A: uint32ptr(1)},
B: uint32ptr(2),
},
},
// NilPtrAnonymousHeadUint32Ptr
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:27:57 +03:00
name: "NilPtrAnonymousHeadUint32Ptr",
2021-01-16 16:16:26 +03:00
data: struct {
*structUint32Ptr
B *uint32 `json:"b"`
}{
structUint32Ptr: nil,
B: uint32ptr(2),
},
},
{
2021-02-15 05:27:57 +03:00
name: "NilPtrAnonymousHeadUint32PtrOmitEmpty",
data: struct {
*structUint32PtrOmitEmpty
B *uint32 `json:"b,omitempty"`
}{
structUint32PtrOmitEmpty: nil,
B: uint32ptr(2),
},
},
{
2021-02-15 05:27:57 +03:00
name: "NilPtrAnonymousHeadUint32PtrString",
data: struct {
*structUint32PtrString
B *uint32 `json:"b,string"`
}{
structUint32PtrString: nil,
B: uint32ptr(2),
},
},
// AnonymousHeadUint32Only
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:27:57 +03:00
name: "AnonymousHeadUint32Only",
2021-01-16 16:16:26 +03:00
data: struct {
structUint32
}{
structUint32: structUint32{A: 1},
},
},
{
2021-02-15 05:27:57 +03:00
name: "AnonymousHeadUint32OnlyOmitEmpty",
data: struct {
structUint32OmitEmpty
}{
structUint32OmitEmpty: structUint32OmitEmpty{A: 1},
},
},
{
2021-02-15 05:27:57 +03:00
name: "AnonymousHeadUint32OnlyString",
data: struct {
structUint32String
}{
structUint32String: structUint32String{A: 1},
},
},
// PtrAnonymousHeadUint32Only
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:27:57 +03:00
name: "PtrAnonymousHeadUint32Only",
2021-01-16 16:16:26 +03:00
data: struct {
*structUint32
}{
structUint32: &structUint32{A: 1},
},
},
{
2021-02-15 05:27:57 +03:00
name: "PtrAnonymousHeadUint32OnlyOmitEmpty",
data: struct {
*structUint32OmitEmpty
}{
structUint32OmitEmpty: &structUint32OmitEmpty{A: 1},
},
},
{
2021-02-15 05:27:57 +03:00
name: "PtrAnonymousHeadUint32OnlyString",
data: struct {
*structUint32String
}{
structUint32String: &structUint32String{A: 1},
},
},
// NilPtrAnonymousHeadUint32Only
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:27:57 +03:00
name: "NilPtrAnonymousHeadUint32Only",
2021-01-16 16:16:26 +03:00
data: struct {
*structUint32
}{
structUint32: nil,
},
},
{
2021-02-15 05:27:57 +03:00
name: "NilPtrAnonymousHeadUint32OnlyOmitEmpty",
data: struct {
*structUint32OmitEmpty
}{
structUint32OmitEmpty: nil,
},
},
{
2021-02-15 05:27:57 +03:00
name: "NilPtrAnonymousHeadUint32OnlyString",
data: struct {
*structUint32String
}{
structUint32String: nil,
},
},
// AnonymousHeadUint32PtrOnly
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:27:57 +03:00
name: "AnonymousHeadUint32PtrOnly",
2021-01-16 16:16:26 +03:00
data: struct {
structUint32Ptr
}{
structUint32Ptr: structUint32Ptr{A: uint32ptr(1)},
},
},
{
2021-02-15 05:27:57 +03:00
name: "AnonymousHeadUint32PtrOnlyOmitEmpty",
data: struct {
structUint32PtrOmitEmpty
}{
structUint32PtrOmitEmpty: structUint32PtrOmitEmpty{A: uint32ptr(1)},
},
},
{
2021-02-15 05:27:57 +03:00
name: "AnonymousHeadUint32PtrOnlyString",
data: struct {
structUint32PtrString
}{
structUint32PtrString: structUint32PtrString{A: uint32ptr(1)},
},
},
// AnonymousHeadUint32PtrNilOnly
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:27:57 +03:00
name: "AnonymousHeadUint32PtrNilOnly",
2021-01-16 16:16:26 +03:00
data: struct {
structUint32Ptr
}{
structUint32Ptr: structUint32Ptr{A: nil},
},
},
{
2021-02-15 05:27:57 +03:00
name: "AnonymousHeadUint32PtrNilOnlyOmitEmpty",
data: struct {
structUint32PtrOmitEmpty
}{
structUint32PtrOmitEmpty: structUint32PtrOmitEmpty{A: nil},
},
},
{
2021-02-15 05:27:57 +03:00
name: "AnonymousHeadUint32PtrNilOnlyString",
data: struct {
structUint32PtrString
}{
structUint32PtrString: structUint32PtrString{A: nil},
},
},
// PtrAnonymousHeadUint32PtrOnly
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:27:57 +03:00
name: "PtrAnonymousHeadUint32PtrOnly",
2021-01-16 16:16:26 +03:00
data: struct {
*structUint32Ptr
}{
structUint32Ptr: &structUint32Ptr{A: uint32ptr(1)},
},
},
{
2021-02-15 05:27:57 +03:00
name: "PtrAnonymousHeadUint32PtrOnlyOmitEmpty",
data: struct {
*structUint32PtrOmitEmpty
}{
structUint32PtrOmitEmpty: &structUint32PtrOmitEmpty{A: uint32ptr(1)},
},
},
{
2021-02-15 05:27:57 +03:00
name: "PtrAnonymousHeadUint32PtrOnlyString",
data: struct {
*structUint32PtrString
}{
structUint32PtrString: &structUint32PtrString{A: uint32ptr(1)},
},
},
// NilPtrAnonymousHeadUint32PtrOnly
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:27:57 +03:00
name: "NilPtrAnonymousHeadUint32PtrOnly",
2021-01-16 16:16:26 +03:00
data: struct {
*structUint32Ptr
}{
structUint32Ptr: nil,
},
},
{
2021-02-15 05:27:57 +03:00
name: "NilPtrAnonymousHeadUint32PtrOnlyOmitEmpty",
data: struct {
*structUint32PtrOmitEmpty
}{
structUint32PtrOmitEmpty: nil,
},
},
{
2021-02-15 05:27:57 +03:00
name: "NilPtrAnonymousHeadUint32PtrOnlyString",
data: struct {
*structUint32PtrString
}{
structUint32PtrString: 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
}
}
}
}