go-json/test/cover/cover_int16_test.go

1834 lines
36 KiB
Go
Raw Normal View History

2021-01-16 16:16:26 +03:00
package json_test
import (
"bytes"
"fmt"
2021-01-16 16:16:26 +03:00
"testing"
"github.com/goccy/go-json"
)
func TestCoverInt16(t *testing.T) {
type structInt16 struct {
A int16 `json:"a"`
}
2021-01-17 16:06:16 +03:00
type structInt16OmitEmpty struct {
A int16 `json:"a,omitempty"`
}
type structInt16String struct {
A int16 `json:"a,string"`
}
2021-01-16 16:16:26 +03:00
type structInt16Ptr struct {
A *int16 `json:"a"`
}
2021-01-17 16:06:16 +03:00
type structInt16PtrOmitEmpty struct {
A *int16 `json:"a,omitempty"`
}
type structInt16PtrString struct {
A *int16 `json:"a,string"`
}
2021-01-16 16:16:26 +03:00
tests := []struct {
2021-02-14 20:21:08 +03:00
name string
data interface{}
2021-01-16 16:16:26 +03:00
}{
2021-03-19 17:31:29 +03:00
{
name: "Int16",
data: int16(10),
},
{
name: "Int16Ptr",
data: int16ptr(10),
},
{
name: "Int16Ptr3",
data: int16ptr3(10),
},
{
name: "Int16PtrNil",
data: (*int16)(nil),
},
{
name: "Int16Ptr3Nil",
data: (***int16)(nil),
},
2021-01-17 16:06:16 +03:00
// HeadInt16Zero
2021-01-16 16:16:26 +03:00
{
2021-02-14 20:21:08 +03:00
name: "HeadInt16Zero",
2021-01-16 16:16:26 +03:00
data: struct {
A int16 `json:"a"`
}{},
},
2021-01-17 16:06:16 +03:00
{
2021-02-14 20:21:08 +03:00
name: "HeadInt16ZeroOmitEmpty",
2021-01-17 16:06:16 +03:00
data: struct {
A int16 `json:"a,omitempty"`
}{},
},
{
2021-02-14 20:21:08 +03:00
name: "HeadInt16ZeroString",
2021-01-17 16:06:16 +03:00
data: struct {
A int16 `json:"a,string"`
}{},
},
// HeadInt16
2021-01-16 16:16:26 +03:00
{
2021-02-14 20:21:08 +03:00
name: "HeadInt16",
2021-01-16 16:16:26 +03:00
data: struct {
A int16 `json:"a"`
}{A: 1},
},
2021-01-17 16:06:16 +03:00
{
2021-02-14 20:21:08 +03:00
name: "HeadInt16OmitEmpty",
2021-01-17 16:06:16 +03:00
data: struct {
A int16 `json:"a,omitempty"`
}{A: 1},
},
{
2021-02-14 20:21:08 +03:00
name: "HeadInt16String",
2021-01-17 16:06:16 +03:00
data: struct {
A int16 `json:"a,string"`
}{A: 1},
},
// HeadInt16Ptr
2021-01-16 16:16:26 +03:00
{
2021-02-14 20:21:08 +03:00
name: "HeadInt16Ptr",
2021-01-16 16:16:26 +03:00
data: struct {
A *int16 `json:"a"`
}{A: int16ptr(1)},
},
2021-01-17 16:06:16 +03:00
{
2021-02-14 20:21:08 +03:00
name: "HeadInt16PtrOmitEmpty",
2021-01-17 16:06:16 +03:00
data: struct {
A *int16 `json:"a,omitempty"`
}{A: int16ptr(1)},
},
{
2021-02-14 20:21:08 +03:00
name: "HeadInt16PtrString",
2021-01-17 16:06:16 +03:00
data: struct {
A *int16 `json:"a,string"`
}{A: int16ptr(1)},
},
// HeadInt16PtrNil
2021-01-16 16:16:26 +03:00
{
2021-02-14 20:21:08 +03:00
name: "HeadInt16PtrNil",
2021-01-16 16:16:26 +03:00
data: struct {
A *int16 `json:"a"`
}{A: nil},
},
2021-01-17 16:06:16 +03:00
{
2021-02-14 20:21:08 +03:00
name: "HeadInt16PtrNilOmitEmpty",
2021-01-17 16:06:16 +03:00
data: struct {
A *int16 `json:"a,omitempty"`
}{A: nil},
},
{
2021-02-14 20:21:08 +03:00
name: "HeadInt16PtrNilString",
2021-01-17 16:06:16 +03:00
data: struct {
A *int16 `json:"a,string"`
}{A: nil},
},
// PtrHeadInt16Zero
2021-01-16 16:16:26 +03:00
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16Zero",
2021-01-16 16:16:26 +03:00
data: &struct {
A int16 `json:"a"`
}{},
},
2021-01-17 16:06:16 +03:00
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16ZeroOmitEmpty",
2021-01-17 16:06:16 +03:00
data: &struct {
A int16 `json:"a,omitempty"`
}{},
},
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16ZeroString",
2021-01-17 16:06:16 +03:00
data: &struct {
A int16 `json:"a,string"`
}{},
},
// PtrHeadInt16
2021-01-16 16:16:26 +03:00
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16",
2021-01-16 16:16:26 +03:00
data: &struct {
A int16 `json:"a"`
}{A: 1},
},
2021-01-17 16:06:16 +03:00
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16OmitEmpty",
2021-01-17 16:06:16 +03:00
data: &struct {
A int16 `json:"a,omitempty"`
}{A: 1},
},
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16String",
2021-01-17 16:06:16 +03:00
data: &struct {
A int16 `json:"a,string"`
}{A: 1},
},
// PtrHeadInt16Ptr
2021-01-16 16:16:26 +03:00
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16Ptr",
2021-01-16 16:16:26 +03:00
data: &struct {
A *int16 `json:"a"`
}{A: int16ptr(1)},
},
2021-01-17 16:06:16 +03:00
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16PtrOmitEmpty",
2021-01-17 16:06:16 +03:00
data: &struct {
A *int16 `json:"a,omitempty"`
}{A: int16ptr(1)},
},
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16PtrString",
2021-01-17 16:06:16 +03:00
data: &struct {
A *int16 `json:"a,string"`
}{A: int16ptr(1)},
},
// PtrHeadInt16PtrNil
2021-01-16 16:16:26 +03:00
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16PtrNil",
2021-01-16 16:16:26 +03:00
data: &struct {
A *int16 `json:"a"`
}{A: nil},
},
2021-01-17 16:06:16 +03:00
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16PtrNilOmitEmpty",
2021-01-17 16:06:16 +03:00
data: &struct {
A *int16 `json:"a,omitempty"`
}{A: nil},
},
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16PtrNilString",
2021-01-17 16:06:16 +03:00
data: &struct {
A *int16 `json:"a,string"`
}{A: nil},
},
// PtrHeadInt16Nil
2021-01-16 16:16:26 +03:00
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16Nil",
2021-01-16 16:16:26 +03:00
data: (*struct {
A *int16 `json:"a"`
})(nil),
},
2021-01-17 16:06:16 +03:00
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16NilOmitEmpty",
2021-01-17 16:06:16 +03:00
data: (*struct {
A *int16 `json:"a,omitempty"`
})(nil),
},
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16NilString",
2021-01-17 16:06:16 +03:00
data: (*struct {
A *int16 `json:"a,string"`
})(nil),
},
// HeadInt16ZeroMultiFields
2021-01-16 16:16:26 +03:00
{
2021-02-14 20:21:08 +03:00
name: "HeadInt16ZeroMultiFields",
2021-01-16 16:16:26 +03:00
data: struct {
A int16 `json:"a"`
B int16 `json:"b"`
2021-02-14 20:21:08 +03:00
C int16 `json:"c"`
2021-01-16 16:16:26 +03:00
}{},
},
2021-01-17 16:06:16 +03:00
{
2021-02-14 20:21:08 +03:00
name: "HeadInt16ZeroMultiFieldsOmitEmpty",
2021-01-17 16:06:16 +03:00
data: struct {
A int16 `json:"a,omitempty"`
B int16 `json:"b,omitempty"`
2021-02-14 20:21:08 +03:00
C int16 `json:"c,omitempty"`
2021-01-17 16:06:16 +03:00
}{},
},
{
2021-02-14 20:21:08 +03:00
name: "HeadInt16ZeroMultiFields",
2021-01-17 16:06:16 +03:00
data: struct {
A int16 `json:"a,string"`
B int16 `json:"b,string"`
2021-02-14 20:21:08 +03:00
C int16 `json:"c,string"`
2021-01-17 16:06:16 +03:00
}{},
},
// HeadInt16MultiFields
2021-01-16 16:16:26 +03:00
{
2021-02-14 20:21:08 +03:00
name: "HeadInt16MultiFields",
2021-01-16 16:16:26 +03:00
data: struct {
A int16 `json:"a"`
B int16 `json:"b"`
2021-02-14 20:21:08 +03:00
C int16 `json:"c"`
2021-02-19 09:13:33 +03:00
}{A: 1, B: -2, C: 3},
2021-01-16 16:16:26 +03:00
},
{
2021-02-14 20:21:08 +03:00
name: "HeadInt16MultiFieldsOmitEmpty",
2021-01-16 16:16:26 +03:00
data: struct {
2021-01-17 16:06:16 +03:00
A int16 `json:"a,omitempty"`
B int16 `json:"b,omitempty"`
2021-02-14 20:21:08 +03:00
C int16 `json:"c,omitempty"`
2021-02-19 09:13:33 +03:00
}{A: 1, B: -2, C: 3},
2021-01-16 16:16:26 +03:00
},
{
2021-02-14 20:21:08 +03:00
name: "HeadInt16MultiFieldsString",
2021-01-16 16:16:26 +03:00
data: struct {
2021-01-17 16:06:16 +03:00
A int16 `json:"a,string"`
B int16 `json:"b,string"`
2021-02-14 20:21:08 +03:00
C int16 `json:"c,string"`
2021-02-19 09:13:33 +03:00
}{A: 1, B: -2, C: 3},
2021-01-16 16:16:26 +03:00
},
2021-01-17 16:06:16 +03:00
// HeadInt16PtrMultiFields
2021-01-16 16:16:26 +03:00
{
2021-02-14 20:21:08 +03:00
name: "HeadInt16PtrMultiFields",
2021-01-17 16:06:16 +03:00
data: struct {
A *int16 `json:"a"`
B *int16 `json:"b"`
2021-02-14 20:21:08 +03:00
C *int16 `json:"c"`
2021-02-19 09:13:33 +03:00
}{A: int16ptr(1), B: int16ptr(-2), C: int16ptr(3)},
2021-01-16 16:16:26 +03:00
},
{
2021-02-14 20:21:08 +03:00
name: "HeadInt16PtrMultiFieldsOmitEmpty",
2021-01-17 16:06:16 +03:00
data: struct {
A *int16 `json:"a,omitempty"`
B *int16 `json:"b,omitempty"`
2021-02-14 20:21:08 +03:00
C *int16 `json:"c,omitempty"`
2021-02-19 09:13:33 +03:00
}{A: int16ptr(1), B: int16ptr(-2), C: int16ptr(3)},
2021-01-16 16:16:26 +03:00
},
{
2021-02-14 20:21:08 +03:00
name: "HeadInt16PtrMultiFieldsString",
2021-01-17 16:06:16 +03:00
data: struct {
A *int16 `json:"a,string"`
B *int16 `json:"b,string"`
2021-02-14 20:21:08 +03:00
C *int16 `json:"c,string"`
2021-02-19 09:13:33 +03:00
}{A: int16ptr(1), B: int16ptr(-2), C: int16ptr(3)},
2021-01-16 16:16:26 +03:00
},
2021-01-17 16:06:16 +03:00
// HeadInt16PtrNilMultiFields
2021-01-16 16:16:26 +03:00
{
2021-02-14 20:21:08 +03:00
name: "HeadInt16PtrNilMultiFields",
2021-01-17 16:06:16 +03:00
data: struct {
2021-01-16 16:16:26 +03:00
A *int16 `json:"a"`
B *int16 `json:"b"`
2021-02-14 20:21:08 +03:00
C *int16 `json:"c"`
}{A: nil, B: nil, C: nil},
2021-01-16 16:16:26 +03:00
},
{
2021-02-14 20:21:08 +03:00
name: "HeadInt16PtrNilMultiFieldsOmitEmpty",
2021-01-17 16:06:16 +03:00
data: struct {
A *int16 `json:"a,omitempty"`
B *int16 `json:"b,omitempty"`
2021-02-14 20:21:08 +03:00
C *int16 `json:"c,omitempty"`
}{A: nil, B: nil, C: nil},
2021-01-16 16:16:26 +03:00
},
{
2021-02-14 20:21:08 +03:00
name: "HeadInt16PtrNilMultiFieldsString",
2021-01-17 16:06:16 +03:00
data: struct {
A *int16 `json:"a,string"`
B *int16 `json:"b,string"`
2021-02-14 20:21:08 +03:00
C *int16 `json:"c,string"`
}{A: nil, B: nil, C: nil},
2021-01-17 16:06:16 +03:00
},
// PtrHeadInt16ZeroMultiFields
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16ZeroMultiFields",
2021-01-17 16:06:16 +03:00
data: &struct {
A int16 `json:"a"`
B int16 `json:"b"`
}{},
},
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16ZeroMultiFieldsOmitEmpty",
2021-01-17 16:06:16 +03:00
data: &struct {
A int16 `json:"a,omitempty"`
B int16 `json:"b,omitempty"`
}{},
},
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16ZeroMultiFieldsString",
2021-01-17 16:06:16 +03:00
data: &struct {
A int16 `json:"a,string"`
B int16 `json:"b,string"`
}{},
},
// PtrHeadInt16MultiFields
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16MultiFields",
2021-01-17 16:06:16 +03:00
data: &struct {
A int16 `json:"a"`
B int16 `json:"b"`
2021-02-19 09:13:33 +03:00
}{A: 1, B: -2},
2021-01-17 16:06:16 +03:00
},
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16MultiFieldsOmitEmpty",
2021-01-17 16:06:16 +03:00
data: &struct {
A int16 `json:"a,omitempty"`
B int16 `json:"b,omitempty"`
2021-02-19 09:13:33 +03:00
}{A: 1, B: -2},
2021-01-17 16:06:16 +03:00
},
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16MultiFieldsString",
2021-01-17 16:06:16 +03:00
data: &struct {
A int16 `json:"a,string"`
B int16 `json:"b,string"`
2021-02-19 09:13:33 +03:00
}{A: 1, B: -2},
2021-01-17 16:06:16 +03:00
},
// PtrHeadInt16PtrMultiFields
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16PtrMultiFields",
2021-01-17 16:06:16 +03:00
data: &struct {
A *int16 `json:"a"`
B *int16 `json:"b"`
2021-02-19 09:13:33 +03:00
}{A: int16ptr(1), B: int16ptr(-2)},
2021-01-17 16:06:16 +03:00
},
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16PtrMultiFieldsOmitEmpty",
2021-01-17 16:06:16 +03:00
data: &struct {
A *int16 `json:"a,omitempty"`
B *int16 `json:"b,omitempty"`
2021-02-19 09:13:33 +03:00
}{A: int16ptr(1), B: int16ptr(-2)},
2021-01-17 16:06:16 +03:00
},
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16PtrMultiFieldsString",
2021-01-17 16:06:16 +03:00
data: &struct {
A *int16 `json:"a,string"`
B *int16 `json:"b,string"`
2021-02-19 09:13:33 +03:00
}{A: int16ptr(1), B: int16ptr(-2)},
2021-01-17 16:06:16 +03:00
},
// PtrHeadInt16PtrNilMultiFields
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16PtrNilMultiFields",
2021-01-17 16:06:16 +03:00
data: &struct {
A *int16 `json:"a"`
B *int16 `json:"b"`
}{A: nil, B: nil},
},
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16PtrNilMultiFieldsOmitEmpty",
2021-01-17 16:06:16 +03:00
data: &struct {
A *int16 `json:"a,omitempty"`
B *int16 `json:"b,omitempty"`
}{A: nil, B: nil},
},
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16PtrNilMultiFieldsString",
2021-01-17 16:06:16 +03:00
data: &struct {
A *int16 `json:"a,string"`
B *int16 `json:"b,string"`
}{A: nil, B: nil},
},
// PtrHeadInt16NilMultiFields
{
name: "PtrHeadInt16NilMultiFields",
data: (*struct {
A int16 `json:"a"`
B int16 `json:"b"`
})(nil),
},
{
name: "PtrHeadInt16NilMultiFieldsOmitEmpty",
data: (*struct {
A int16 `json:"a,omitempty"`
B int16 `json:"b,omitempty"`
})(nil),
},
{
name: "PtrHeadInt16NilMultiFieldsString",
data: (*struct {
A int16 `json:"a,string"`
B int16 `json:"b,string"`
})(nil),
},
2021-01-17 16:06:16 +03:00
// PtrHeadInt16NilMultiFields
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16NilMultiFields",
2021-01-17 16:06:16 +03:00
data: (*struct {
A *int16 `json:"a"`
B *int16 `json:"b"`
})(nil),
},
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16NilMultiFieldsOmitEmpty",
2021-01-17 16:06:16 +03:00
data: (*struct {
A *int16 `json:"a,omitempty"`
B *int16 `json:"b,omitempty"`
})(nil),
},
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16NilMultiFieldsString",
2021-01-17 16:06:16 +03:00
data: (*struct {
A *int16 `json:"a,string"`
B *int16 `json:"b,string"`
})(nil),
},
// HeadInt16ZeroNotRoot
{
2021-02-14 20:21:08 +03:00
name: "HeadInt16ZeroNotRoot",
2021-01-16 16:16:26 +03:00
data: struct {
A struct {
A int16 `json:"a"`
}
}{},
},
2021-01-17 16:06:16 +03:00
{
2021-02-14 20:21:08 +03:00
name: "HeadInt16ZeroNotRootOmitEmpty",
2021-01-17 16:06:16 +03:00
data: struct {
A struct {
A int16 `json:"a,omitempty"`
}
}{},
},
{
2021-02-14 20:21:08 +03:00
name: "HeadInt16ZeroNotRootString",
2021-01-17 16:06:16 +03:00
data: struct {
A struct {
A int16 `json:"a,string"`
}
}{},
},
// HeadInt16NotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-14 20:21:08 +03:00
name: "HeadInt16NotRoot",
2021-01-16 16:16:26 +03:00
data: struct {
A struct {
A int16 `json:"a"`
}
}{A: struct {
A int16 `json:"a"`
}{A: 1}},
},
{
2021-02-14 20:21:08 +03:00
name: "HeadInt16NotRootOmitEmpty",
2021-01-16 16:16:26 +03:00
data: struct {
A struct {
2021-01-17 16:06:16 +03:00
A int16 `json:"a,omitempty"`
2021-01-16 16:16:26 +03:00
}
}{A: struct {
2021-01-17 16:06:16 +03:00
A int16 `json:"a,omitempty"`
}{A: 1}},
2021-01-16 16:16:26 +03:00
},
{
2021-02-14 20:21:08 +03:00
name: "HeadInt16NotRootString",
2021-01-16 16:16:26 +03:00
data: struct {
A struct {
2021-01-17 16:06:16 +03:00
A int16 `json:"a,string"`
2021-01-16 16:16:26 +03:00
}
2021-01-17 16:06:16 +03:00
}{A: struct {
A int16 `json:"a,string"`
}{A: 1}},
2021-01-16 16:16:26 +03:00
},
2021-01-17 16:06:16 +03:00
// HeadInt16PtrNotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-14 20:21:08 +03:00
name: "HeadInt16PtrNotRoot",
2021-01-16 16:16:26 +03:00
data: struct {
2021-01-17 16:06:16 +03:00
A struct {
A *int16 `json:"a"`
2021-01-16 16:16:26 +03:00
}
2021-01-17 16:06:16 +03:00
}{A: struct {
A *int16 `json:"a"`
}{int16ptr(1)}},
2021-01-16 16:16:26 +03:00
},
{
2021-02-14 20:21:08 +03:00
name: "HeadInt16PtrNotRootOmitEmpty",
2021-01-16 16:16:26 +03:00
data: struct {
2021-01-17 16:06:16 +03:00
A struct {
A *int16 `json:"a,omitempty"`
2021-01-16 16:16:26 +03:00
}
2021-01-17 16:06:16 +03:00
}{A: struct {
A *int16 `json:"a,omitempty"`
}{int16ptr(1)}},
2021-01-16 16:16:26 +03:00
},
{
2021-02-14 20:21:08 +03:00
name: "HeadInt16PtrNotRootString",
2021-01-16 16:16:26 +03:00
data: struct {
2021-01-17 16:06:16 +03:00
A struct {
A *int16 `json:"a,string"`
2021-01-16 16:16:26 +03:00
}
2021-01-17 16:06:16 +03:00
}{A: struct {
A *int16 `json:"a,string"`
}{int16ptr(1)}},
2021-01-16 16:16:26 +03:00
},
2021-01-17 16:06:16 +03:00
// HeadInt16PtrNilNotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-14 20:21:08 +03:00
name: "HeadInt16PtrNilNotRoot",
2021-01-17 16:06:16 +03:00
data: struct {
A struct {
A *int16 `json:"a"`
}
}{},
},
{
2021-02-14 20:21:08 +03:00
name: "HeadInt16PtrNilNotRootOmitEmpty",
2021-01-17 16:06:16 +03:00
data: struct {
A struct {
A *int16 `json:"a,omitempty"`
}
}{},
},
{
2021-02-14 20:21:08 +03:00
name: "HeadInt16PtrNilNotRootString",
2021-01-17 16:06:16 +03:00
data: struct {
A struct {
A *int16 `json:"a,string"`
}
}{},
},
// PtrHeadInt16ZeroNotRoot
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16ZeroNotRoot",
2021-01-17 16:06:16 +03:00
data: struct {
A *struct {
A int16 `json:"a"`
}
}{A: new(struct {
A int16 `json:"a"`
})},
},
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16ZeroNotRootOmitEmpty",
2021-01-17 16:06:16 +03:00
data: struct {
A *struct {
A int16 `json:"a,omitempty"`
}
}{A: new(struct {
A int16 `json:"a,omitempty"`
})},
},
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16ZeroNotRootString",
2021-01-17 16:06:16 +03:00
data: struct {
A *struct {
A int16 `json:"a,string"`
}
}{A: new(struct {
A int16 `json:"a,string"`
})},
},
// PtrHeadInt16NotRoot
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16NotRoot",
2021-01-17 16:06:16 +03:00
data: struct {
A *struct {
A int16 `json:"a"`
}
}{A: &(struct {
A int16 `json:"a"`
}{A: 1})},
},
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16NotRootOmitEmpty",
2021-01-17 16:06:16 +03:00
data: struct {
A *struct {
A int16 `json:"a,omitempty"`
}
}{A: &(struct {
A int16 `json:"a,omitempty"`
}{A: 1})},
},
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16NotRootString",
2021-01-17 16:06:16 +03:00
data: struct {
A *struct {
A int16 `json:"a,string"`
}
}{A: &(struct {
A int16 `json:"a,string"`
}{A: 1})},
},
// PtrHeadInt16PtrNotRoot
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16PtrNotRoot",
2021-01-17 16:06:16 +03:00
data: struct {
A *struct {
A *int16 `json:"a"`
}
}{A: &(struct {
A *int16 `json:"a"`
}{A: int16ptr(1)})},
},
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16PtrNotRootOmitEmpty",
2021-01-17 16:06:16 +03:00
data: struct {
A *struct {
A *int16 `json:"a,omitempty"`
}
}{A: &(struct {
A *int16 `json:"a,omitempty"`
}{A: int16ptr(1)})},
},
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16PtrNotRootString",
2021-01-17 16:06:16 +03:00
data: struct {
A *struct {
A *int16 `json:"a,string"`
}
}{A: &(struct {
A *int16 `json:"a,string"`
}{A: int16ptr(1)})},
},
// PtrHeadInt16PtrNilNotRoot
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16PtrNilNotRoot",
2021-01-17 16:06:16 +03:00
data: struct {
A *struct {
A *int16 `json:"a"`
}
}{A: &(struct {
A *int16 `json:"a"`
}{A: nil})},
},
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16PtrNilNotRootOmitEmpty",
2021-01-17 16:06:16 +03:00
data: struct {
A *struct {
A *int16 `json:"a,omitempty"`
}
}{A: &(struct {
A *int16 `json:"a,omitempty"`
}{A: nil})},
},
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16PtrNilNotRootString",
2021-01-17 16:06:16 +03:00
data: struct {
A *struct {
A *int16 `json:"a,string"`
}
}{A: &(struct {
A *int16 `json:"a,string"`
}{A: nil})},
},
// PtrHeadInt16NilNotRoot
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16NilNotRoot",
2021-01-17 16:06:16 +03:00
data: struct {
A *struct {
A *int16 `json:"a"`
}
}{A: nil},
},
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16NilNotRootOmitEmpty",
2021-01-17 16:06:16 +03:00
data: struct {
A *struct {
A *int16 `json:"a,omitempty"`
} `json:",omitempty"`
}{A: nil},
},
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16NilNotRootString",
2021-01-17 16:06:16 +03:00
data: struct {
A *struct {
A *int16 `json:"a,string"`
} `json:",string"`
}{A: nil},
},
// HeadInt16ZeroMultiFieldsNotRoot
{
2021-02-14 20:21:08 +03:00
name: "HeadInt16ZeroMultiFieldsNotRoot",
2021-01-17 16:06:16 +03:00
data: struct {
A struct {
A int16 `json:"a"`
}
B struct {
B int16 `json:"b"`
}
}{},
},
{
2021-02-14 20:21:08 +03:00
name: "HeadInt16ZeroMultiFieldsNotRootOmitEmpty",
2021-01-17 16:06:16 +03:00
data: struct {
A struct {
A int16 `json:"a,omitempty"`
}
B struct {
B int16 `json:"b,omitempty"`
}
}{},
},
{
2021-02-14 20:21:08 +03:00
name: "HeadInt16ZeroMultiFieldsNotRootString",
2021-01-17 16:06:16 +03:00
data: struct {
A struct {
A int16 `json:"a,string"`
}
B struct {
B int16 `json:"b,string"`
}
}{},
},
// HeadInt16MultiFieldsNotRoot
{
2021-02-14 20:21:08 +03:00
name: "HeadInt16MultiFieldsNotRoot",
2021-01-17 16:06:16 +03:00
data: struct {
A struct {
A int16 `json:"a"`
}
B struct {
B int16 `json:"b"`
}
}{A: struct {
A int16 `json:"a"`
}{A: 1}, B: struct {
B int16 `json:"b"`
2021-02-19 09:13:33 +03:00
}{B: -2}},
2021-01-17 16:06:16 +03:00
},
{
2021-02-14 20:21:08 +03:00
name: "HeadInt16MultiFieldsNotRootOmitEmpty",
2021-01-17 16:06:16 +03:00
data: struct {
A struct {
A int16 `json:"a,omitempty"`
}
B struct {
B int16 `json:"b,omitempty"`
}
}{A: struct {
A int16 `json:"a,omitempty"`
}{A: 1}, B: struct {
B int16 `json:"b,omitempty"`
2021-02-19 09:13:33 +03:00
}{B: -2}},
2021-01-17 16:06:16 +03:00
},
{
2021-02-14 20:21:08 +03:00
name: "HeadInt16MultiFieldsNotRootString",
2021-01-17 16:06:16 +03:00
data: struct {
A struct {
A int16 `json:"a,string"`
}
B struct {
B int16 `json:"b,string"`
}
}{A: struct {
A int16 `json:"a,string"`
}{A: 1}, B: struct {
B int16 `json:"b,string"`
2021-02-19 09:13:33 +03:00
}{B: -2}},
2021-01-17 16:06:16 +03:00
},
// HeadInt16PtrMultiFieldsNotRoot
{
2021-02-14 20:21:08 +03:00
name: "HeadInt16PtrMultiFieldsNotRoot",
2021-01-17 16:06:16 +03:00
data: struct {
A struct {
A *int16 `json:"a"`
}
B struct {
B *int16 `json:"b"`
}
}{A: struct {
A *int16 `json:"a"`
}{A: int16ptr(1)}, B: struct {
B *int16 `json:"b"`
2021-02-19 09:13:33 +03:00
}{B: int16ptr(-2)}},
2021-01-17 16:06:16 +03:00
},
{
2021-02-14 20:21:08 +03:00
name: "HeadInt16PtrMultiFieldsNotRootOmitEmpty",
2021-01-17 16:06:16 +03:00
data: struct {
A struct {
A *int16 `json:"a,omitempty"`
}
B struct {
B *int16 `json:"b,omitempty"`
}
}{A: struct {
A *int16 `json:"a,omitempty"`
}{A: int16ptr(1)}, B: struct {
B *int16 `json:"b,omitempty"`
2021-02-19 09:13:33 +03:00
}{B: int16ptr(-2)}},
2021-01-17 16:06:16 +03:00
},
{
2021-02-14 20:21:08 +03:00
name: "HeadInt16PtrMultiFieldsNotRootString",
2021-01-17 16:06:16 +03:00
data: struct {
A struct {
A *int16 `json:"a,string"`
}
B struct {
B *int16 `json:"b,string"`
}
}{A: struct {
A *int16 `json:"a,string"`
}{A: int16ptr(1)}, B: struct {
B *int16 `json:"b,string"`
2021-02-19 09:13:33 +03:00
}{B: int16ptr(-2)}},
2021-01-17 16:06:16 +03:00
},
// HeadInt16PtrNilMultiFieldsNotRoot
{
2021-02-14 20:21:08 +03:00
name: "HeadInt16PtrNilMultiFieldsNotRoot",
2021-01-17 16:06:16 +03:00
data: struct {
A struct {
A *int16 `json:"a"`
}
B struct {
B *int16 `json:"b"`
}
}{A: struct {
A *int16 `json:"a"`
}{A: nil}, B: struct {
B *int16 `json:"b"`
}{B: nil}},
},
{
2021-02-14 20:21:08 +03:00
name: "HeadInt16PtrNilMultiFieldsNotRootOmitEmpty",
2021-01-17 16:06:16 +03:00
data: struct {
A struct {
A *int16 `json:"a,omitempty"`
}
B struct {
B *int16 `json:"b,omitempty"`
}
}{A: struct {
A *int16 `json:"a,omitempty"`
}{A: nil}, B: struct {
B *int16 `json:"b,omitempty"`
}{B: nil}},
},
{
2021-02-14 20:21:08 +03:00
name: "HeadInt16PtrNilMultiFieldsNotRootString",
2021-01-17 16:06:16 +03:00
data: struct {
A struct {
A *int16 `json:"a,string"`
}
B struct {
B *int16 `json:"b,string"`
}
}{A: struct {
A *int16 `json:"a,string"`
}{A: nil}, B: struct {
B *int16 `json:"b,string"`
}{B: nil}},
},
// PtrHeadInt16ZeroMultiFieldsNotRoot
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16ZeroMultiFieldsNotRoot",
2021-01-17 16:06:16 +03:00
data: &struct {
A struct {
A int16 `json:"a"`
2021-01-16 16:16:26 +03:00
}
2021-01-17 16:06:16 +03:00
B struct {
B int16 `json:"b"`
}
}{},
2021-01-16 16:16:26 +03:00
},
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16ZeroMultiFieldsNotRootOmitEmpty",
2021-01-17 16:06:16 +03:00
data: &struct {
A struct {
A int16 `json:"a,omitempty"`
2021-01-16 16:16:26 +03:00
}
2021-01-17 16:06:16 +03:00
B struct {
B int16 `json:"b,omitempty"`
}
}{},
2021-01-16 16:16:26 +03:00
},
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16ZeroMultiFieldsNotRootString",
2021-01-17 16:06:16 +03:00
data: &struct {
2021-01-16 16:16:26 +03:00
A struct {
2021-01-17 16:06:16 +03:00
A int16 `json:"a,string"`
2021-01-16 16:16:26 +03:00
}
B struct {
2021-01-17 16:06:16 +03:00
B int16 `json:"b,string"`
2021-01-16 16:16:26 +03:00
}
}{},
},
2021-01-17 16:06:16 +03:00
// PtrHeadInt16MultiFieldsNotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16MultiFieldsNotRoot",
2021-01-17 16:06:16 +03:00
data: &struct {
2021-01-16 16:16:26 +03:00
A struct {
A int16 `json:"a"`
}
B struct {
B int16 `json:"b"`
}
}{A: struct {
A int16 `json:"a"`
}{A: 1}, B: struct {
B int16 `json:"b"`
2021-02-19 09:13:33 +03:00
}{B: -2}},
2021-01-16 16:16:26 +03:00
},
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16MultiFieldsNotRootOmitEmpty",
2021-01-17 16:06:16 +03:00
data: &struct {
2021-01-16 16:16:26 +03:00
A struct {
2021-01-17 16:06:16 +03:00
A int16 `json:"a,omitempty"`
2021-01-16 16:16:26 +03:00
}
B struct {
2021-01-17 16:06:16 +03:00
B int16 `json:"b,omitempty"`
2021-01-16 16:16:26 +03:00
}
}{A: struct {
2021-01-17 16:06:16 +03:00
A int16 `json:"a,omitempty"`
}{A: 1}, B: struct {
B int16 `json:"b,omitempty"`
2021-02-19 09:13:33 +03:00
}{B: -2}},
2021-01-16 16:16:26 +03:00
},
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16MultiFieldsNotRootString",
2021-01-17 16:06:16 +03:00
data: &struct {
2021-01-16 16:16:26 +03:00
A struct {
2021-01-17 16:06:16 +03:00
A int16 `json:"a,string"`
2021-01-16 16:16:26 +03:00
}
B struct {
2021-01-17 16:06:16 +03:00
B int16 `json:"b,string"`
2021-01-16 16:16:26 +03:00
}
}{A: struct {
2021-01-17 16:06:16 +03:00
A int16 `json:"a,string"`
}{A: 1}, B: struct {
B int16 `json:"b,string"`
2021-02-19 09:13:33 +03:00
}{B: -2}},
2021-01-16 16:16:26 +03:00
},
2021-01-17 16:06:16 +03:00
// PtrHeadInt16PtrMultiFieldsNotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16PtrMultiFieldsNotRoot",
2021-01-16 16:16:26 +03:00
data: &struct {
2021-01-17 16:06:16 +03:00
A *struct {
A *int16 `json:"a"`
2021-01-16 16:16:26 +03:00
}
2021-01-17 16:06:16 +03:00
B *struct {
B *int16 `json:"b"`
2021-01-16 16:16:26 +03:00
}
2021-01-17 16:06:16 +03:00
}{A: &(struct {
A *int16 `json:"a"`
}{A: int16ptr(1)}), B: &(struct {
B *int16 `json:"b"`
2021-02-19 09:13:33 +03:00
}{B: int16ptr(-2)})},
2021-01-16 16:16:26 +03:00
},
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16PtrMultiFieldsNotRootOmitEmpty",
2021-01-16 16:16:26 +03:00
data: &struct {
2021-01-17 16:06:16 +03:00
A *struct {
A *int16 `json:"a,omitempty"`
}
B *struct {
B *int16 `json:"b,omitempty"`
}
}{A: &(struct {
A *int16 `json:"a,omitempty"`
}{A: int16ptr(1)}), B: &(struct {
B *int16 `json:"b,omitempty"`
2021-02-19 09:13:33 +03:00
}{B: int16ptr(-2)})},
2021-01-17 16:06:16 +03:00
},
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16PtrMultiFieldsNotRootString",
2021-01-17 16:06:16 +03:00
data: &struct {
A *struct {
A *int16 `json:"a,string"`
}
B *struct {
B *int16 `json:"b,string"`
}
}{A: &(struct {
A *int16 `json:"a,string"`
}{A: int16ptr(1)}), B: &(struct {
B *int16 `json:"b,string"`
2021-02-19 09:13:33 +03:00
}{B: int16ptr(-2)})},
2021-01-17 16:06:16 +03:00
},
// PtrHeadInt16PtrNilMultiFieldsNotRoot
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16PtrNilMultiFieldsNotRoot",
2021-01-17 16:06:16 +03:00
data: &struct {
A *struct {
A *int16 `json:"a"`
}
B *struct {
B *int16 `json:"b"`
}
}{A: nil, B: nil},
},
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16PtrNilMultiFieldsNotRootOmitEmpty",
2021-01-17 16:06:16 +03:00
data: &struct {
A *struct {
A *int16 `json:"a,omitempty"`
} `json:",omitempty"`
B *struct {
B *int16 `json:"b,omitempty"`
} `json:",omitempty"`
}{A: nil, B: nil},
},
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16PtrNilMultiFieldsNotRootString",
2021-01-17 16:06:16 +03:00
data: &struct {
A *struct {
A *int16 `json:"a,string"`
} `json:",string"`
B *struct {
B *int16 `json:"b,string"`
} `json:",string"`
}{A: nil, B: nil},
},
// PtrHeadInt16NilMultiFieldsNotRoot
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16NilMultiFieldsNotRoot",
2021-01-17 16:06:16 +03:00
data: (*struct {
A *struct {
A *int16 `json:"a"`
}
B *struct {
B *int16 `json:"b"`
}
})(nil),
},
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16NilMultiFieldsNotRootOmitEmpty",
2021-01-17 16:06:16 +03:00
data: (*struct {
A *struct {
A *int16 `json:"a,omitempty"`
}
B *struct {
B *int16 `json:"b,omitempty"`
}
})(nil),
},
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16NilMultiFieldsNotRootString",
2021-01-17 16:06:16 +03:00
data: (*struct {
A *struct {
A *int16 `json:"a,string"`
}
B *struct {
B *int16 `json:"b,string"`
}
})(nil),
},
// PtrHeadInt16DoubleMultiFieldsNotRoot
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16DoubleMultiFieldsNotRoot",
2021-01-17 16:06:16 +03:00
data: &struct {
A *struct {
2021-01-16 16:16:26 +03:00
A int16 `json:"a"`
2021-01-17 16:06:16 +03:00
B int16 `json:"b"`
2021-01-16 16:16:26 +03:00
}
2021-01-17 16:06:16 +03:00
B *struct {
A int16 `json:"a"`
2021-01-16 16:16:26 +03:00
B int16 `json:"b"`
}
2021-01-17 16:06:16 +03:00
}{A: &(struct {
2021-01-16 16:16:26 +03:00
A int16 `json:"a"`
B int16 `json:"b"`
2021-02-19 09:13:33 +03:00
}{A: 1, B: -2}), B: &(struct {
2021-01-17 16:06:16 +03:00
A int16 `json:"a"`
B int16 `json:"b"`
}{A: 3, B: 4})},
2021-01-16 16:16:26 +03:00
},
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16DoubleMultiFieldsNotRootOmitEmpty",
2021-01-17 16:06:16 +03:00
data: &struct {
A *struct {
A int16 `json:"a,omitempty"`
B int16 `json:"b,omitempty"`
}
B *struct {
A int16 `json:"a,omitempty"`
B int16 `json:"b,omitempty"`
}
}{A: &(struct {
A int16 `json:"a,omitempty"`
B int16 `json:"b,omitempty"`
2021-02-19 09:13:33 +03:00
}{A: 1, B: -2}), B: &(struct {
2021-01-17 16:06:16 +03:00
A int16 `json:"a,omitempty"`
B int16 `json:"b,omitempty"`
}{A: 3, B: 4})},
},
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16DoubleMultiFieldsNotRootString",
2021-01-16 16:16:26 +03:00
data: &struct {
A *struct {
2021-01-17 16:06:16 +03:00
A int16 `json:"a,string"`
B int16 `json:"b,string"`
2021-01-16 16:16:26 +03:00
}
B *struct {
2021-01-17 16:06:16 +03:00
A int16 `json:"a,string"`
B int16 `json:"b,string"`
2021-01-16 16:16:26 +03:00
}
}{A: &(struct {
2021-01-17 16:06:16 +03:00
A int16 `json:"a,string"`
B int16 `json:"b,string"`
2021-02-19 09:13:33 +03:00
}{A: 1, B: -2}), B: &(struct {
2021-01-17 16:06:16 +03:00
A int16 `json:"a,string"`
B int16 `json:"b,string"`
}{A: 3, B: 4})},
2021-01-16 16:16:26 +03:00
},
2021-01-17 16:06:16 +03:00
// PtrHeadInt16NilDoubleMultiFieldsNotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16NilDoubleMultiFieldsNotRoot",
2021-01-16 16:16:26 +03:00
data: &struct {
A *struct {
2021-01-17 16:06:16 +03:00
A int16 `json:"a"`
B int16 `json:"b"`
2021-01-16 16:16:26 +03:00
}
B *struct {
2021-01-17 16:06:16 +03:00
A int16 `json:"a"`
B int16 `json:"b"`
2021-01-16 16:16:26 +03:00
}
}{A: nil, B: nil},
},
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16NilDoubleMultiFieldsNotRootOmitEmpty",
2021-01-17 16:06:16 +03:00
data: &struct {
2021-01-16 16:16:26 +03:00
A *struct {
2021-01-17 16:06:16 +03:00
A int16 `json:"a,omitempty"`
B int16 `json:"b,omitempty"`
} `json:",omitempty"`
2021-01-16 16:16:26 +03:00
B *struct {
2021-01-17 16:06:16 +03:00
A int16 `json:"a,omitempty"`
B int16 `json:"b,omitempty"`
} `json:",omitempty"`
}{A: nil, B: nil},
2021-01-16 16:16:26 +03:00
},
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16NilDoubleMultiFieldsNotRootString",
2021-01-16 16:16:26 +03:00
data: &struct {
A *struct {
2021-01-17 16:06:16 +03:00
A int16 `json:"a,string"`
B int16 `json:"b,string"`
2021-01-16 16:16:26 +03:00
}
B *struct {
2021-01-17 16:06:16 +03:00
A int16 `json:"a,string"`
B int16 `json:"b,string"`
2021-01-16 16:16:26 +03:00
}
2021-01-17 16:06:16 +03:00
}{A: nil, B: nil},
2021-01-16 16:16:26 +03:00
},
2021-01-17 16:06:16 +03:00
// PtrHeadInt16NilDoubleMultiFieldsNotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16NilDoubleMultiFieldsNotRoot",
2021-01-17 16:06:16 +03:00
data: (*struct {
2021-01-16 16:16:26 +03:00
A *struct {
A int16 `json:"a"`
B int16 `json:"b"`
}
B *struct {
A int16 `json:"a"`
B int16 `json:"b"`
}
2021-01-17 16:06:16 +03:00
})(nil),
2021-01-16 16:16:26 +03:00
},
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16NilDoubleMultiFieldsNotRootOmitEmpty",
2021-01-16 16:16:26 +03:00
data: (*struct {
A *struct {
2021-01-17 16:06:16 +03:00
A int16 `json:"a,omitempty"`
B int16 `json:"b,omitempty"`
2021-01-16 16:16:26 +03:00
}
B *struct {
2021-01-17 16:06:16 +03:00
A int16 `json:"a,omitempty"`
B int16 `json:"b,omitempty"`
}
})(nil),
},
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16NilDoubleMultiFieldsNotRootString",
2021-01-17 16:06:16 +03:00
data: (*struct {
A *struct {
A int16 `json:"a,string"`
B int16 `json:"b,string"`
}
B *struct {
A int16 `json:"a,string"`
B int16 `json:"b,string"`
2021-01-16 16:16:26 +03:00
}
})(nil),
},
2021-01-17 16:06:16 +03:00
// PtrHeadInt16PtrDoubleMultiFieldsNotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16PtrDoubleMultiFieldsNotRoot",
2021-01-16 16:16:26 +03:00
data: &struct {
A *struct {
A *int16 `json:"a"`
B *int16 `json:"b"`
}
B *struct {
A *int16 `json:"a"`
B *int16 `json:"b"`
}
}{A: &(struct {
A *int16 `json:"a"`
B *int16 `json:"b"`
2021-02-19 09:13:33 +03:00
}{A: int16ptr(1), B: int16ptr(-2)}), B: &(struct {
2021-01-16 16:16:26 +03:00
A *int16 `json:"a"`
B *int16 `json:"b"`
}{A: int16ptr(3), B: int16ptr(4)})},
},
2021-01-17 16:06:16 +03:00
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16PtrDoubleMultiFieldsNotRootOmitEmpty",
2021-01-17 16:06:16 +03:00
data: &struct {
A *struct {
A *int16 `json:"a,omitempty"`
B *int16 `json:"b,omitempty"`
}
B *struct {
A *int16 `json:"a,omitempty"`
B *int16 `json:"b,omitempty"`
}
}{A: &(struct {
A *int16 `json:"a,omitempty"`
B *int16 `json:"b,omitempty"`
2021-02-19 09:13:33 +03:00
}{A: int16ptr(1), B: int16ptr(-2)}), B: &(struct {
2021-01-17 16:06:16 +03:00
A *int16 `json:"a,omitempty"`
B *int16 `json:"b,omitempty"`
}{A: int16ptr(3), B: int16ptr(4)})},
},
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16PtrDoubleMultiFieldsNotRootString",
2021-01-17 16:06:16 +03:00
data: &struct {
A *struct {
A *int16 `json:"a,string"`
B *int16 `json:"b,string"`
}
B *struct {
A *int16 `json:"a,string"`
B *int16 `json:"b,string"`
}
}{A: &(struct {
A *int16 `json:"a,string"`
B *int16 `json:"b,string"`
2021-02-19 09:13:33 +03:00
}{A: int16ptr(1), B: int16ptr(-2)}), B: &(struct {
2021-01-17 16:06:16 +03:00
A *int16 `json:"a,string"`
B *int16 `json:"b,string"`
}{A: int16ptr(3), B: int16ptr(4)})},
},
// PtrHeadInt16PtrNilDoubleMultiFieldsNotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16PtrNilDoubleMultiFieldsNotRoot",
2021-01-16 16:16:26 +03:00
data: &struct {
A *struct {
A *int16 `json:"a"`
B *int16 `json:"b"`
}
B *struct {
A *int16 `json:"a"`
B *int16 `json:"b"`
}
}{A: nil, B: nil},
},
2021-01-17 16:06:16 +03:00
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16PtrNilDoubleMultiFieldsNotRootOmitEmpty",
2021-01-17 16:06:16 +03:00
data: &struct {
A *struct {
A *int16 `json:"a,omitempty"`
B *int16 `json:"b,omitempty"`
} `json:",omitempty"`
B *struct {
A *int16 `json:"a,omitempty"`
B *int16 `json:"b,omitempty"`
} `json:",omitempty"`
}{A: nil, B: nil},
},
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16PtrNilDoubleMultiFieldsNotRootString",
2021-01-17 16:06:16 +03:00
data: &struct {
A *struct {
A *int16 `json:"a,string"`
B *int16 `json:"b,string"`
}
B *struct {
A *int16 `json:"a,string"`
B *int16 `json:"b,string"`
}
}{A: nil, B: nil},
},
// PtrHeadInt16PtrNilDoubleMultiFieldsNotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16PtrNilDoubleMultiFieldsNotRoot",
2021-01-16 16:16:26 +03:00
data: (*struct {
A *struct {
A *int16 `json:"a"`
B *int16 `json:"b"`
}
B *struct {
A *int16 `json:"a"`
B *int16 `json:"b"`
}
})(nil),
},
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16PtrNilDoubleMultiFieldsNotRootOmitEmpty",
2021-01-17 16:06:16 +03:00
data: (*struct {
A *struct {
A *int16 `json:"a,omitempty"`
B *int16 `json:"b,omitempty"`
}
B *struct {
A *int16 `json:"a,omitempty"`
B *int16 `json:"b,omitempty"`
}
})(nil),
},
{
2021-02-14 20:21:08 +03:00
name: "PtrHeadInt16PtrNilDoubleMultiFieldsNotRootString",
2021-01-17 16:06:16 +03:00
data: (*struct {
A *struct {
A *int16 `json:"a,string"`
B *int16 `json:"b,string"`
}
B *struct {
A *int16 `json:"a,string"`
B *int16 `json:"b,string"`
}
})(nil),
},
// AnonymousHeadInt16
{
2021-02-14 20:21:08 +03:00
name: "AnonymousHeadInt16",
2021-01-17 16:06:16 +03:00
data: struct {
structInt16
B int16 `json:"b"`
}{
structInt16: structInt16{A: 1},
2021-02-19 09:13:33 +03:00
B: -2,
2021-01-17 16:06:16 +03:00
},
},
{
2021-02-14 20:21:08 +03:00
name: "AnonymousHeadInt16OmitEmpty",
2021-01-17 16:06:16 +03:00
data: struct {
structInt16OmitEmpty
B int16 `json:"b,omitempty"`
}{
structInt16OmitEmpty: structInt16OmitEmpty{A: 1},
2021-02-19 09:13:33 +03:00
B: -2,
2021-01-17 16:06:16 +03:00
},
},
{
2021-02-14 20:21:08 +03:00
name: "AnonymousHeadInt16String",
2021-01-17 16:06:16 +03:00
data: struct {
structInt16String
B int16 `json:"b,string"`
}{
structInt16String: structInt16String{A: 1},
2021-02-19 09:13:33 +03:00
B: -2,
2021-01-17 16:06:16 +03:00
},
},
// PtrAnonymousHeadInt16
{
2021-02-14 20:21:08 +03:00
name: "PtrAnonymousHeadInt16",
2021-01-17 16:06:16 +03:00
data: struct {
*structInt16
B int16 `json:"b"`
}{
structInt16: &structInt16{A: 1},
2021-02-19 09:13:33 +03:00
B: -2,
2021-01-17 16:06:16 +03:00
},
},
{
2021-02-14 20:21:08 +03:00
name: "PtrAnonymousHeadInt16OmitEmpty",
2021-01-17 16:06:16 +03:00
data: struct {
*structInt16OmitEmpty
B int16 `json:"b,omitempty"`
}{
structInt16OmitEmpty: &structInt16OmitEmpty{A: 1},
2021-02-19 09:13:33 +03:00
B: -2,
2021-01-17 16:06:16 +03:00
},
},
{
2021-02-14 20:21:08 +03:00
name: "PtrAnonymousHeadInt16String",
2021-01-17 16:06:16 +03:00
data: struct {
*structInt16String
B int16 `json:"b,string"`
}{
structInt16String: &structInt16String{A: 1},
2021-02-19 09:13:33 +03:00
B: -2,
2021-01-17 16:06:16 +03:00
},
},
// NilPtrAnonymousHeadInt16
{
2021-02-14 20:21:08 +03:00
name: "NilPtrAnonymousHeadInt16",
2021-01-16 16:16:26 +03:00
data: struct {
2021-01-17 16:06:16 +03:00
*structInt16
2021-01-16 16:16:26 +03:00
B int16 `json:"b"`
}{
2021-01-17 16:06:16 +03:00
structInt16: nil,
2021-02-19 09:13:33 +03:00
B: -2,
2021-01-16 16:16:26 +03:00
},
},
{
2021-02-14 20:21:08 +03:00
name: "NilPtrAnonymousHeadInt16OmitEmpty",
2021-01-16 16:16:26 +03:00
data: struct {
2021-01-17 16:06:16 +03:00
*structInt16OmitEmpty
B int16 `json:"b,omitempty"`
2021-01-16 16:16:26 +03:00
}{
2021-01-17 16:06:16 +03:00
structInt16OmitEmpty: nil,
2021-02-19 09:13:33 +03:00
B: -2,
2021-01-16 16:16:26 +03:00
},
},
{
2021-02-14 20:21:08 +03:00
name: "NilPtrAnonymousHeadInt16String",
2021-01-16 16:16:26 +03:00
data: struct {
2021-01-17 16:06:16 +03:00
*structInt16String
B int16 `json:"b,string"`
2021-01-16 16:16:26 +03:00
}{
2021-01-17 16:06:16 +03:00
structInt16String: nil,
2021-02-19 09:13:33 +03:00
B: -2,
2021-01-16 16:16:26 +03:00
},
},
2021-01-17 16:06:16 +03:00
// AnonymousHeadInt16Ptr
2021-01-16 16:16:26 +03:00
{
2021-02-14 20:21:08 +03:00
name: "AnonymousHeadInt16Ptr",
2021-01-16 16:16:26 +03:00
data: struct {
structInt16Ptr
B *int16 `json:"b"`
}{
structInt16Ptr: structInt16Ptr{A: int16ptr(1)},
2021-02-19 09:13:33 +03:00
B: int16ptr(-2),
2021-01-16 16:16:26 +03:00
},
},
2021-01-17 16:06:16 +03:00
{
2021-02-14 20:21:08 +03:00
name: "AnonymousHeadInt16PtrOmitEmpty",
2021-01-17 16:06:16 +03:00
data: struct {
structInt16PtrOmitEmpty
B *int16 `json:"b,omitempty"`
}{
structInt16PtrOmitEmpty: structInt16PtrOmitEmpty{A: int16ptr(1)},
2021-02-19 09:13:33 +03:00
B: int16ptr(-2),
2021-01-17 16:06:16 +03:00
},
},
{
2021-02-14 20:21:08 +03:00
name: "AnonymousHeadInt16PtrString",
2021-01-17 16:06:16 +03:00
data: struct {
structInt16PtrString
B *int16 `json:"b,string"`
}{
structInt16PtrString: structInt16PtrString{A: int16ptr(1)},
2021-02-19 09:13:33 +03:00
B: int16ptr(-2),
2021-01-17 16:06:16 +03:00
},
},
// AnonymousHeadInt16PtrNil
2021-01-16 16:16:26 +03:00
{
2021-02-14 20:21:08 +03:00
name: "AnonymousHeadInt16PtrNil",
2021-01-16 16:16:26 +03:00
data: struct {
structInt16Ptr
B *int16 `json:"b"`
}{
structInt16Ptr: structInt16Ptr{A: nil},
2021-02-19 09:13:33 +03:00
B: int16ptr(-2),
2021-01-16 16:16:26 +03:00
},
},
2021-01-17 16:06:16 +03:00
{
2021-02-14 20:21:08 +03:00
name: "AnonymousHeadInt16PtrNilOmitEmpty",
2021-01-17 16:06:16 +03:00
data: struct {
structInt16PtrOmitEmpty
B *int16 `json:"b,omitempty"`
}{
structInt16PtrOmitEmpty: structInt16PtrOmitEmpty{A: nil},
2021-02-19 09:13:33 +03:00
B: int16ptr(-2),
2021-01-17 16:06:16 +03:00
},
},
{
2021-02-14 20:21:08 +03:00
name: "AnonymousHeadInt16PtrNilString",
2021-01-17 16:06:16 +03:00
data: struct {
structInt16PtrString
B *int16 `json:"b,string"`
}{
structInt16PtrString: structInt16PtrString{A: nil},
2021-02-19 09:13:33 +03:00
B: int16ptr(-2),
2021-01-17 16:06:16 +03:00
},
},
// PtrAnonymousHeadInt16Ptr
2021-01-16 16:16:26 +03:00
{
2021-02-14 20:21:08 +03:00
name: "PtrAnonymousHeadInt16Ptr",
2021-01-16 16:16:26 +03:00
data: struct {
*structInt16Ptr
B *int16 `json:"b"`
}{
structInt16Ptr: &structInt16Ptr{A: int16ptr(1)},
2021-02-19 09:13:33 +03:00
B: int16ptr(-2),
2021-01-16 16:16:26 +03:00
},
},
2021-01-17 16:06:16 +03:00
{
2021-02-14 20:21:08 +03:00
name: "PtrAnonymousHeadInt16PtrOmitEmpty",
2021-01-17 16:06:16 +03:00
data: struct {
*structInt16PtrOmitEmpty
B *int16 `json:"b,omitempty"`
}{
structInt16PtrOmitEmpty: &structInt16PtrOmitEmpty{A: int16ptr(1)},
2021-02-19 09:13:33 +03:00
B: int16ptr(-2),
2021-01-17 16:06:16 +03:00
},
},
{
2021-02-14 20:21:08 +03:00
name: "PtrAnonymousHeadInt16PtrString",
2021-01-17 16:06:16 +03:00
data: struct {
*structInt16PtrString
B *int16 `json:"b,string"`
}{
structInt16PtrString: &structInt16PtrString{A: int16ptr(1)},
2021-02-19 09:13:33 +03:00
B: int16ptr(-2),
2021-01-17 16:06:16 +03:00
},
},
// NilPtrAnonymousHeadInt16Ptr
2021-01-16 16:16:26 +03:00
{
2021-02-14 20:21:08 +03:00
name: "NilPtrAnonymousHeadInt16Ptr",
2021-01-16 16:16:26 +03:00
data: struct {
*structInt16Ptr
B *int16 `json:"b"`
}{
structInt16Ptr: nil,
2021-02-19 09:13:33 +03:00
B: int16ptr(-2),
2021-01-16 16:16:26 +03:00
},
},
2021-01-17 16:06:16 +03:00
{
2021-02-14 20:21:08 +03:00
name: "NilPtrAnonymousHeadInt16PtrOmitEmpty",
2021-01-17 16:06:16 +03:00
data: struct {
*structInt16PtrOmitEmpty
B *int16 `json:"b,omitempty"`
}{
structInt16PtrOmitEmpty: nil,
2021-02-19 09:13:33 +03:00
B: int16ptr(-2),
2021-01-17 16:06:16 +03:00
},
},
{
2021-02-14 20:21:08 +03:00
name: "NilPtrAnonymousHeadInt16PtrString",
2021-01-17 16:06:16 +03:00
data: struct {
*structInt16PtrString
B *int16 `json:"b,string"`
}{
structInt16PtrString: nil,
2021-02-19 09:13:33 +03:00
B: int16ptr(-2),
2021-01-17 16:06:16 +03:00
},
},
// AnonymousHeadInt16Only
2021-01-16 16:16:26 +03:00
{
2021-02-14 20:21:08 +03:00
name: "AnonymousHeadInt16Only",
2021-01-16 16:16:26 +03:00
data: struct {
structInt16
}{
structInt16: structInt16{A: 1},
},
},
2021-01-17 16:06:16 +03:00
{
2021-02-14 20:21:08 +03:00
name: "AnonymousHeadInt16OnlyOmitEmpty",
2021-01-17 16:06:16 +03:00
data: struct {
structInt16OmitEmpty
}{
structInt16OmitEmpty: structInt16OmitEmpty{A: 1},
},
},
{
2021-02-14 20:21:08 +03:00
name: "AnonymousHeadInt16OnlyString",
2021-01-17 16:06:16 +03:00
data: struct {
structInt16String
}{
structInt16String: structInt16String{A: 1},
},
},
// PtrAnonymousHeadInt16Only
2021-01-16 16:16:26 +03:00
{
2021-02-14 20:21:08 +03:00
name: "PtrAnonymousHeadInt16Only",
2021-01-16 16:16:26 +03:00
data: struct {
*structInt16
}{
structInt16: &structInt16{A: 1},
},
},
2021-01-17 16:06:16 +03:00
{
2021-02-14 20:21:08 +03:00
name: "PtrAnonymousHeadInt16OnlyOmitEmpty",
2021-01-17 16:06:16 +03:00
data: struct {
*structInt16OmitEmpty
}{
structInt16OmitEmpty: &structInt16OmitEmpty{A: 1},
},
},
{
2021-02-14 20:21:08 +03:00
name: "PtrAnonymousHeadInt16OnlyString",
2021-01-17 16:06:16 +03:00
data: struct {
*structInt16String
}{
structInt16String: &structInt16String{A: 1},
},
},
// NilPtrAnonymousHeadInt16Only
2021-01-16 16:16:26 +03:00
{
2021-02-14 20:21:08 +03:00
name: "NilPtrAnonymousHeadInt16Only",
2021-01-16 16:16:26 +03:00
data: struct {
*structInt16
}{
structInt16: nil,
},
},
2021-01-17 16:06:16 +03:00
{
2021-02-14 20:21:08 +03:00
name: "NilPtrAnonymousHeadInt16OnlyOmitEmpty",
2021-01-17 16:06:16 +03:00
data: struct {
*structInt16OmitEmpty
}{
structInt16OmitEmpty: nil,
},
},
{
2021-02-14 20:21:08 +03:00
name: "NilPtrAnonymousHeadInt16OnlyString",
2021-01-17 16:06:16 +03:00
data: struct {
*structInt16String
}{
structInt16String: nil,
},
},
// AnonymousHeadInt16PtrOnly
2021-01-16 16:16:26 +03:00
{
2021-02-14 20:21:08 +03:00
name: "AnonymousHeadInt16PtrOnly",
2021-01-16 16:16:26 +03:00
data: struct {
structInt16Ptr
}{
structInt16Ptr: structInt16Ptr{A: int16ptr(1)},
},
},
2021-01-17 16:06:16 +03:00
{
2021-02-14 20:21:08 +03:00
name: "AnonymousHeadInt16PtrOnlyOmitEmpty",
2021-01-17 16:06:16 +03:00
data: struct {
structInt16PtrOmitEmpty
}{
structInt16PtrOmitEmpty: structInt16PtrOmitEmpty{A: int16ptr(1)},
},
},
{
2021-02-14 20:21:08 +03:00
name: "AnonymousHeadInt16PtrOnlyString",
2021-01-17 16:06:16 +03:00
data: struct {
structInt16PtrString
}{
structInt16PtrString: structInt16PtrString{A: int16ptr(1)},
},
},
// AnonymousHeadInt16PtrNilOnly
2021-01-16 16:16:26 +03:00
{
2021-02-14 20:21:08 +03:00
name: "AnonymousHeadInt16PtrNilOnly",
2021-01-16 16:16:26 +03:00
data: struct {
structInt16Ptr
}{
structInt16Ptr: structInt16Ptr{A: nil},
},
},
2021-01-17 16:06:16 +03:00
{
2021-02-14 20:21:08 +03:00
name: "AnonymousHeadInt16PtrNilOnlyOmitEmpty",
2021-01-17 16:06:16 +03:00
data: struct {
structInt16PtrOmitEmpty
}{
structInt16PtrOmitEmpty: structInt16PtrOmitEmpty{A: nil},
},
},
{
2021-02-14 20:21:08 +03:00
name: "AnonymousHeadInt16PtrNilOnlyString",
2021-01-17 16:06:16 +03:00
data: struct {
structInt16PtrString
}{
structInt16PtrString: structInt16PtrString{A: nil},
},
},
// PtrAnonymousHeadInt16PtrOnly
2021-01-16 16:16:26 +03:00
{
2021-02-14 20:21:08 +03:00
name: "PtrAnonymousHeadInt16PtrOnly",
2021-01-16 16:16:26 +03:00
data: struct {
*structInt16Ptr
}{
structInt16Ptr: &structInt16Ptr{A: int16ptr(1)},
},
},
2021-01-17 16:06:16 +03:00
{
2021-02-14 20:21:08 +03:00
name: "PtrAnonymousHeadInt16PtrOnlyOmitEmpty",
2021-01-17 16:06:16 +03:00
data: struct {
*structInt16PtrOmitEmpty
}{
structInt16PtrOmitEmpty: &structInt16PtrOmitEmpty{A: int16ptr(1)},
},
},
{
2021-02-14 20:21:08 +03:00
name: "PtrAnonymousHeadInt16PtrOnlyString",
2021-01-17 16:06:16 +03:00
data: struct {
*structInt16PtrString
}{
structInt16PtrString: &structInt16PtrString{A: int16ptr(1)},
},
},
// NilPtrAnonymousHeadInt16PtrOnly
2021-01-16 16:16:26 +03:00
{
2021-02-14 20:21:08 +03:00
name: "NilPtrAnonymousHeadInt16PtrOnly",
2021-01-16 16:16:26 +03:00
data: struct {
*structInt16Ptr
}{
structInt16Ptr: nil,
},
},
2021-01-17 16:06:16 +03:00
{
2021-02-14 20:21:08 +03:00
name: "NilPtrAnonymousHeadInt16PtrOnlyOmitEmpty",
2021-01-17 16:06:16 +03:00
data: struct {
*structInt16PtrOmitEmpty
}{
structInt16PtrOmitEmpty: nil,
},
},
{
2021-02-14 20:21:08 +03:00
name: "NilPtrAnonymousHeadInt16PtrOnlyString",
2021-01-17 16:06:16 +03:00
data: struct {
*structInt16PtrString
}{
structInt16PtrString: 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} {
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
}
}
}
}