go-json/test/cover/cover_uint16_test.go

1808 lines
36 KiB
Go
Raw Normal View History

2021-01-16 16:16:26 +03:00
package json_test
import (
"bytes"
"testing"
"github.com/goccy/go-json"
)
func TestCoverUint16(t *testing.T) {
type structUint16 struct {
A uint16 `json:"a"`
}
type structUint16OmitEmpty struct {
A uint16 `json:"a,omitempty"`
}
type structUint16String struct {
A uint16 `json:"a,string"`
}
2021-01-16 16:16:26 +03:00
type structUint16Ptr struct {
A *uint16 `json:"a"`
}
type structUint16PtrOmitEmpty struct {
A *uint16 `json:"a,omitempty"`
}
type structUint16PtrString struct {
A *uint16 `json:"a,string"`
}
2021-01-16 16:16:26 +03:00
tests := []struct {
2021-02-15 05:27:47 +03:00
name string
data interface{}
2021-01-16 16:16:26 +03:00
}{
2021-03-19 17:31:29 +03:00
{
name: "Uint16",
data: uint16(10),
},
{
name: "Uint16Ptr",
data: uint16ptr(10),
},
{
name: "Uint16Ptr3",
data: uint16ptr3(10),
},
{
name: "Uint16PtrNil",
data: (*uint16)(nil),
},
{
name: "Uint16Ptr3Nil",
data: (***uint16)(nil),
},
// HeadUint16Zero
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:27:47 +03:00
name: "HeadUint16Zero",
2021-01-16 16:16:26 +03:00
data: struct {
A uint16 `json:"a"`
}{},
},
{
2021-02-15 05:27:47 +03:00
name: "HeadUint16ZeroOmitEmpty",
data: struct {
A uint16 `json:"a,omitempty"`
}{},
},
{
2021-02-15 05:27:47 +03:00
name: "HeadUint16ZeroString",
data: struct {
A uint16 `json:"a,string"`
}{},
},
// HeadUint16
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:27:47 +03:00
name: "HeadUint16",
2021-01-16 16:16:26 +03:00
data: struct {
A uint16 `json:"a"`
}{A: 1},
},
{
2021-02-15 05:27:47 +03:00
name: "HeadUint16OmitEmpty",
data: struct {
A uint16 `json:"a,omitempty"`
}{A: 1},
},
{
2021-02-15 05:27:47 +03:00
name: "HeadUint16String",
data: struct {
A uint16 `json:"a,string"`
}{A: 1},
},
// HeadUint16Ptr
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:27:47 +03:00
name: "HeadUint16Ptr",
2021-01-16 16:16:26 +03:00
data: struct {
A *uint16 `json:"a"`
}{A: uint16ptr(1)},
},
{
2021-02-15 05:27:47 +03:00
name: "HeadUint16PtrOmitEmpty",
data: struct {
A *uint16 `json:"a,omitempty"`
}{A: uint16ptr(1)},
},
{
2021-02-15 05:27:47 +03:00
name: "HeadUint16PtrString",
data: struct {
A *uint16 `json:"a,string"`
}{A: uint16ptr(1)},
},
// HeadUint16PtrNil
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:27:47 +03:00
name: "HeadUint16PtrNil",
2021-01-16 16:16:26 +03:00
data: struct {
A *uint16 `json:"a"`
}{A: nil},
},
{
2021-02-15 05:27:47 +03:00
name: "HeadUint16PtrNilOmitEmpty",
data: struct {
A *uint16 `json:"a,omitempty"`
}{A: nil},
},
{
2021-02-15 05:27:47 +03:00
name: "HeadUint16PtrNilString",
data: struct {
A *uint16 `json:"a,string"`
}{A: nil},
},
// PtrHeadUint16Zero
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16Zero",
2021-01-16 16:16:26 +03:00
data: &struct {
A uint16 `json:"a"`
}{},
},
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16ZeroOmitEmpty",
data: &struct {
A uint16 `json:"a,omitempty"`
}{},
},
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16ZeroString",
data: &struct {
A uint16 `json:"a,string"`
}{},
},
// PtrHeadUint16
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16",
2021-01-16 16:16:26 +03:00
data: &struct {
A uint16 `json:"a"`
}{A: 1},
},
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16OmitEmpty",
data: &struct {
A uint16 `json:"a,omitempty"`
}{A: 1},
},
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16String",
data: &struct {
A uint16 `json:"a,string"`
}{A: 1},
},
// PtrHeadUint16Ptr
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16Ptr",
2021-01-16 16:16:26 +03:00
data: &struct {
A *uint16 `json:"a"`
}{A: uint16ptr(1)},
},
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16PtrOmitEmpty",
data: &struct {
A *uint16 `json:"a,omitempty"`
}{A: uint16ptr(1)},
},
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16PtrString",
data: &struct {
A *uint16 `json:"a,string"`
}{A: uint16ptr(1)},
},
// PtrHeadUint16PtrNil
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16PtrNil",
2021-01-16 16:16:26 +03:00
data: &struct {
A *uint16 `json:"a"`
}{A: nil},
},
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16PtrNilOmitEmpty",
data: &struct {
A *uint16 `json:"a,omitempty"`
}{A: nil},
},
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16PtrNilString",
data: &struct {
A *uint16 `json:"a,string"`
}{A: nil},
},
// PtrHeadUint16Nil
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16Nil",
2021-01-16 16:16:26 +03:00
data: (*struct {
A *uint16 `json:"a"`
})(nil),
},
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16NilOmitEmpty",
data: (*struct {
A *uint16 `json:"a,omitempty"`
})(nil),
},
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16NilString",
data: (*struct {
A *uint16 `json:"a,string"`
})(nil),
},
// HeadUint16ZeroMultiFields
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:27:47 +03:00
name: "HeadUint16ZeroMultiFields",
2021-01-16 16:16:26 +03:00
data: struct {
A uint16 `json:"a"`
B uint16 `json:"b"`
2021-02-15 05:27:47 +03:00
C uint16 `json:"c"`
2021-01-16 16:16:26 +03:00
}{},
},
{
2021-02-15 05:27:47 +03:00
name: "HeadUint16ZeroMultiFieldsOmitEmpty",
data: struct {
A uint16 `json:"a,omitempty"`
B uint16 `json:"b,omitempty"`
2021-02-15 05:27:47 +03:00
C uint16 `json:"c,omitempty"`
}{},
},
{
2021-02-15 05:27:47 +03:00
name: "HeadUint16ZeroMultiFields",
data: struct {
A uint16 `json:"a,string"`
B uint16 `json:"b,string"`
2021-02-15 05:27:47 +03:00
C uint16 `json:"c,string"`
}{},
},
// HeadUint16MultiFields
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:27:47 +03:00
name: "HeadUint16MultiFields",
2021-01-16 16:16:26 +03:00
data: struct {
A uint16 `json:"a"`
B uint16 `json:"b"`
2021-02-15 05:27:47 +03:00
C uint16 `json:"c"`
}{A: 1, B: 2, C: 3},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:27:47 +03:00
name: "HeadUint16MultiFieldsOmitEmpty",
2021-01-16 16:16:26 +03:00
data: struct {
A uint16 `json:"a,omitempty"`
B uint16 `json:"b,omitempty"`
2021-02-15 05:27:47 +03:00
C uint16 `json:"c,omitempty"`
}{A: 1, B: 2, C: 3},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:27:47 +03:00
name: "HeadUint16MultiFieldsString",
2021-01-16 16:16:26 +03:00
data: struct {
A uint16 `json:"a,string"`
B uint16 `json:"b,string"`
2021-02-15 05:27:47 +03:00
C uint16 `json:"c,string"`
}{A: 1, B: 2, C: 3},
2021-01-16 16:16:26 +03:00
},
// HeadUint16PtrMultiFields
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:27:47 +03:00
name: "HeadUint16PtrMultiFields",
data: struct {
A *uint16 `json:"a"`
B *uint16 `json:"b"`
2021-02-15 05:27:47 +03:00
C *uint16 `json:"c"`
}{A: uint16ptr(1), B: uint16ptr(2), C: uint16ptr(3)},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:27:47 +03:00
name: "HeadUint16PtrMultiFieldsOmitEmpty",
data: struct {
A *uint16 `json:"a,omitempty"`
B *uint16 `json:"b,omitempty"`
2021-02-15 05:27:47 +03:00
C *uint16 `json:"c,omitempty"`
}{A: uint16ptr(1), B: uint16ptr(2), C: uint16ptr(3)},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:27:47 +03:00
name: "HeadUint16PtrMultiFieldsString",
data: struct {
A *uint16 `json:"a,string"`
B *uint16 `json:"b,string"`
2021-02-15 05:27:47 +03:00
C *uint16 `json:"c,string"`
}{A: uint16ptr(1), B: uint16ptr(2), C: uint16ptr(3)},
2021-01-16 16:16:26 +03:00
},
// HeadUint16PtrNilMultiFields
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:27:47 +03:00
name: "HeadUint16PtrNilMultiFields",
data: struct {
2021-01-16 16:16:26 +03:00
A *uint16 `json:"a"`
B *uint16 `json:"b"`
2021-02-15 05:27:47 +03:00
C *uint16 `json:"c"`
}{A: nil, B: nil, C: nil},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:27:47 +03:00
name: "HeadUint16PtrNilMultiFieldsOmitEmpty",
data: struct {
A *uint16 `json:"a,omitempty"`
B *uint16 `json:"b,omitempty"`
2021-02-15 05:27:47 +03:00
C *uint16 `json:"c,omitempty"`
}{A: nil, B: nil, C: nil},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:27:47 +03:00
name: "HeadUint16PtrNilMultiFieldsString",
data: struct {
A *uint16 `json:"a,string"`
B *uint16 `json:"b,string"`
2021-02-15 05:27:47 +03:00
C *uint16 `json:"c,string"`
}{A: nil, B: nil, C: nil},
},
// PtrHeadUint16ZeroMultiFields
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16ZeroMultiFields",
data: &struct {
A uint16 `json:"a"`
B uint16 `json:"b"`
}{},
},
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16ZeroMultiFieldsOmitEmpty",
data: &struct {
A uint16 `json:"a,omitempty"`
B uint16 `json:"b,omitempty"`
}{},
},
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16ZeroMultiFieldsString",
data: &struct {
A uint16 `json:"a,string"`
B uint16 `json:"b,string"`
}{},
},
// PtrHeadUint16MultiFields
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16MultiFields",
data: &struct {
A uint16 `json:"a"`
B uint16 `json:"b"`
}{A: 1, B: 2},
},
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16MultiFieldsOmitEmpty",
data: &struct {
A uint16 `json:"a,omitempty"`
B uint16 `json:"b,omitempty"`
}{A: 1, B: 2},
},
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16MultiFieldsString",
data: &struct {
A uint16 `json:"a,string"`
B uint16 `json:"b,string"`
}{A: 1, B: 2},
},
// PtrHeadUint16PtrMultiFields
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16PtrMultiFields",
data: &struct {
A *uint16 `json:"a"`
B *uint16 `json:"b"`
}{A: uint16ptr(1), B: uint16ptr(2)},
},
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16PtrMultiFieldsOmitEmpty",
data: &struct {
A *uint16 `json:"a,omitempty"`
B *uint16 `json:"b,omitempty"`
}{A: uint16ptr(1), B: uint16ptr(2)},
},
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16PtrMultiFieldsString",
data: &struct {
A *uint16 `json:"a,string"`
B *uint16 `json:"b,string"`
}{A: uint16ptr(1), B: uint16ptr(2)},
},
// PtrHeadUint16PtrNilMultiFields
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16PtrNilMultiFields",
data: &struct {
A *uint16 `json:"a"`
B *uint16 `json:"b"`
}{A: nil, B: nil},
},
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16PtrNilMultiFieldsOmitEmpty",
data: &struct {
A *uint16 `json:"a,omitempty"`
B *uint16 `json:"b,omitempty"`
}{A: nil, B: nil},
},
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16PtrNilMultiFieldsString",
data: &struct {
A *uint16 `json:"a,string"`
B *uint16 `json:"b,string"`
}{A: nil, B: nil},
},
// PtrHeadUint16NilMultiFields
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16NilMultiFields",
data: (*struct {
A *uint16 `json:"a"`
B *uint16 `json:"b"`
})(nil),
},
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16NilMultiFieldsOmitEmpty",
data: (*struct {
A *uint16 `json:"a,omitempty"`
B *uint16 `json:"b,omitempty"`
})(nil),
},
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16NilMultiFieldsString",
data: (*struct {
A *uint16 `json:"a,string"`
B *uint16 `json:"b,string"`
})(nil),
},
// HeadUint16ZeroNotRoot
{
2021-02-15 05:27:47 +03:00
name: "HeadUint16ZeroNotRoot",
2021-01-16 16:16:26 +03:00
data: struct {
A struct {
A uint16 `json:"a"`
}
}{},
},
{
2021-02-15 05:27:47 +03:00
name: "HeadUint16ZeroNotRootOmitEmpty",
data: struct {
A struct {
A uint16 `json:"a,omitempty"`
}
}{},
},
{
2021-02-15 05:27:47 +03:00
name: "HeadUint16ZeroNotRootString",
data: struct {
A struct {
A uint16 `json:"a,string"`
}
}{},
},
// HeadUint16NotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:27:47 +03:00
name: "HeadUint16NotRoot",
2021-01-16 16:16:26 +03:00
data: struct {
A struct {
A uint16 `json:"a"`
}
}{A: struct {
A uint16 `json:"a"`
}{A: 1}},
},
{
2021-02-15 05:27:47 +03:00
name: "HeadUint16NotRootOmitEmpty",
2021-01-16 16:16:26 +03:00
data: struct {
A struct {
A uint16 `json:"a,omitempty"`
2021-01-16 16:16:26 +03:00
}
}{A: struct {
A uint16 `json:"a,omitempty"`
}{A: 1}},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:27:47 +03:00
name: "HeadUint16NotRootString",
2021-01-16 16:16:26 +03:00
data: struct {
A struct {
A uint16 `json:"a,string"`
2021-01-16 16:16:26 +03:00
}
}{A: struct {
A uint16 `json:"a,string"`
}{A: 1}},
2021-01-16 16:16:26 +03:00
},
// HeadUint16PtrNotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:27:47 +03:00
name: "HeadUint16PtrNotRoot",
2021-01-16 16:16:26 +03:00
data: struct {
A struct {
A *uint16 `json:"a"`
2021-01-16 16:16:26 +03:00
}
}{A: struct {
A *uint16 `json:"a"`
}{uint16ptr(1)}},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:27:47 +03:00
name: "HeadUint16PtrNotRootOmitEmpty",
2021-01-16 16:16:26 +03:00
data: struct {
A struct {
A *uint16 `json:"a,omitempty"`
2021-01-16 16:16:26 +03:00
}
}{A: struct {
A *uint16 `json:"a,omitempty"`
}{uint16ptr(1)}},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:27:47 +03:00
name: "HeadUint16PtrNotRootString",
2021-01-16 16:16:26 +03:00
data: struct {
A struct {
A *uint16 `json:"a,string"`
2021-01-16 16:16:26 +03:00
}
}{A: struct {
A *uint16 `json:"a,string"`
}{uint16ptr(1)}},
2021-01-16 16:16:26 +03:00
},
// HeadUint16PtrNilNotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:27:47 +03:00
name: "HeadUint16PtrNilNotRoot",
data: struct {
A struct {
A *uint16 `json:"a"`
}
}{},
},
{
2021-02-15 05:27:47 +03:00
name: "HeadUint16PtrNilNotRootOmitEmpty",
data: struct {
A struct {
A *uint16 `json:"a,omitempty"`
}
}{},
},
{
2021-02-15 05:27:47 +03:00
name: "HeadUint16PtrNilNotRootString",
data: struct {
A struct {
A *uint16 `json:"a,string"`
}
}{},
},
// PtrHeadUint16ZeroNotRoot
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16ZeroNotRoot",
data: struct {
A *struct {
A uint16 `json:"a"`
}
}{A: new(struct {
A uint16 `json:"a"`
})},
},
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16ZeroNotRootOmitEmpty",
data: struct {
A *struct {
A uint16 `json:"a,omitempty"`
}
}{A: new(struct {
A uint16 `json:"a,omitempty"`
})},
},
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16ZeroNotRootString",
data: struct {
A *struct {
A uint16 `json:"a,string"`
}
}{A: new(struct {
A uint16 `json:"a,string"`
})},
},
// PtrHeadUint16NotRoot
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16NotRoot",
data: struct {
A *struct {
A uint16 `json:"a"`
}
}{A: &(struct {
A uint16 `json:"a"`
}{A: 1})},
},
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16NotRootOmitEmpty",
data: struct {
A *struct {
A uint16 `json:"a,omitempty"`
}
}{A: &(struct {
A uint16 `json:"a,omitempty"`
}{A: 1})},
},
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16NotRootString",
data: struct {
A *struct {
A uint16 `json:"a,string"`
}
}{A: &(struct {
A uint16 `json:"a,string"`
}{A: 1})},
},
// PtrHeadUint16PtrNotRoot
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16PtrNotRoot",
data: struct {
A *struct {
A *uint16 `json:"a"`
}
}{A: &(struct {
A *uint16 `json:"a"`
}{A: uint16ptr(1)})},
},
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16PtrNotRootOmitEmpty",
data: struct {
A *struct {
A *uint16 `json:"a,omitempty"`
}
}{A: &(struct {
A *uint16 `json:"a,omitempty"`
}{A: uint16ptr(1)})},
},
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16PtrNotRootString",
data: struct {
A *struct {
A *uint16 `json:"a,string"`
}
}{A: &(struct {
A *uint16 `json:"a,string"`
}{A: uint16ptr(1)})},
},
// PtrHeadUint16PtrNilNotRoot
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16PtrNilNotRoot",
data: struct {
A *struct {
A *uint16 `json:"a"`
}
}{A: &(struct {
A *uint16 `json:"a"`
}{A: nil})},
},
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16PtrNilNotRootOmitEmpty",
data: struct {
A *struct {
A *uint16 `json:"a,omitempty"`
}
}{A: &(struct {
A *uint16 `json:"a,omitempty"`
}{A: nil})},
},
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16PtrNilNotRootString",
data: struct {
A *struct {
A *uint16 `json:"a,string"`
}
}{A: &(struct {
A *uint16 `json:"a,string"`
}{A: nil})},
},
// PtrHeadUint16NilNotRoot
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16NilNotRoot",
data: struct {
A *struct {
A *uint16 `json:"a"`
}
}{A: nil},
},
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16NilNotRootOmitEmpty",
data: struct {
A *struct {
A *uint16 `json:"a,omitempty"`
} `json:",omitempty"`
}{A: nil},
},
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16NilNotRootString",
data: struct {
A *struct {
A *uint16 `json:"a,string"`
} `json:",string"`
}{A: nil},
},
// HeadUint16ZeroMultiFieldsNotRoot
{
2021-02-15 05:27:47 +03:00
name: "HeadUint16ZeroMultiFieldsNotRoot",
data: struct {
A struct {
A uint16 `json:"a"`
}
B struct {
B uint16 `json:"b"`
}
}{},
},
{
2021-02-15 05:27:47 +03:00
name: "HeadUint16ZeroMultiFieldsNotRootOmitEmpty",
data: struct {
A struct {
A uint16 `json:"a,omitempty"`
}
B struct {
B uint16 `json:"b,omitempty"`
}
}{},
},
{
2021-02-15 05:27:47 +03:00
name: "HeadUint16ZeroMultiFieldsNotRootString",
data: struct {
A struct {
A uint16 `json:"a,string"`
}
B struct {
B uint16 `json:"b,string"`
}
}{},
},
// HeadUint16MultiFieldsNotRoot
{
2021-02-15 05:27:47 +03:00
name: "HeadUint16MultiFieldsNotRoot",
data: struct {
A struct {
A uint16 `json:"a"`
}
B struct {
B uint16 `json:"b"`
}
}{A: struct {
A uint16 `json:"a"`
}{A: 1}, B: struct {
B uint16 `json:"b"`
}{B: 2}},
},
{
2021-02-15 05:27:47 +03:00
name: "HeadUint16MultiFieldsNotRootOmitEmpty",
data: struct {
A struct {
A uint16 `json:"a,omitempty"`
}
B struct {
B uint16 `json:"b,omitempty"`
}
}{A: struct {
A uint16 `json:"a,omitempty"`
}{A: 1}, B: struct {
B uint16 `json:"b,omitempty"`
}{B: 2}},
},
{
2021-02-15 05:27:47 +03:00
name: "HeadUint16MultiFieldsNotRootString",
data: struct {
A struct {
A uint16 `json:"a,string"`
}
B struct {
B uint16 `json:"b,string"`
}
}{A: struct {
A uint16 `json:"a,string"`
}{A: 1}, B: struct {
B uint16 `json:"b,string"`
}{B: 2}},
},
// HeadUint16PtrMultiFieldsNotRoot
{
2021-02-15 05:27:47 +03:00
name: "HeadUint16PtrMultiFieldsNotRoot",
data: struct {
A struct {
A *uint16 `json:"a"`
}
B struct {
B *uint16 `json:"b"`
}
}{A: struct {
A *uint16 `json:"a"`
}{A: uint16ptr(1)}, B: struct {
B *uint16 `json:"b"`
}{B: uint16ptr(2)}},
},
{
2021-02-15 05:27:47 +03:00
name: "HeadUint16PtrMultiFieldsNotRootOmitEmpty",
data: struct {
A struct {
A *uint16 `json:"a,omitempty"`
}
B struct {
B *uint16 `json:"b,omitempty"`
}
}{A: struct {
A *uint16 `json:"a,omitempty"`
}{A: uint16ptr(1)}, B: struct {
B *uint16 `json:"b,omitempty"`
}{B: uint16ptr(2)}},
},
{
2021-02-15 05:27:47 +03:00
name: "HeadUint16PtrMultiFieldsNotRootString",
data: struct {
A struct {
A *uint16 `json:"a,string"`
}
B struct {
B *uint16 `json:"b,string"`
}
}{A: struct {
A *uint16 `json:"a,string"`
}{A: uint16ptr(1)}, B: struct {
B *uint16 `json:"b,string"`
}{B: uint16ptr(2)}},
},
// HeadUint16PtrNilMultiFieldsNotRoot
{
2021-02-15 05:27:47 +03:00
name: "HeadUint16PtrNilMultiFieldsNotRoot",
data: struct {
A struct {
A *uint16 `json:"a"`
}
B struct {
B *uint16 `json:"b"`
}
}{A: struct {
A *uint16 `json:"a"`
}{A: nil}, B: struct {
B *uint16 `json:"b"`
}{B: nil}},
},
{
2021-02-15 05:27:47 +03:00
name: "HeadUint16PtrNilMultiFieldsNotRootOmitEmpty",
data: struct {
A struct {
A *uint16 `json:"a,omitempty"`
}
B struct {
B *uint16 `json:"b,omitempty"`
}
}{A: struct {
A *uint16 `json:"a,omitempty"`
}{A: nil}, B: struct {
B *uint16 `json:"b,omitempty"`
}{B: nil}},
},
{
2021-02-15 05:27:47 +03:00
name: "HeadUint16PtrNilMultiFieldsNotRootString",
data: struct {
A struct {
A *uint16 `json:"a,string"`
}
B struct {
B *uint16 `json:"b,string"`
}
}{A: struct {
A *uint16 `json:"a,string"`
}{A: nil}, B: struct {
B *uint16 `json:"b,string"`
}{B: nil}},
},
// PtrHeadUint16ZeroMultiFieldsNotRoot
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16ZeroMultiFieldsNotRoot",
data: &struct {
A struct {
A uint16 `json:"a"`
2021-01-16 16:16:26 +03:00
}
B struct {
B uint16 `json:"b"`
}
}{},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16ZeroMultiFieldsNotRootOmitEmpty",
data: &struct {
A struct {
A uint16 `json:"a,omitempty"`
2021-01-16 16:16:26 +03:00
}
B struct {
B uint16 `json:"b,omitempty"`
}
}{},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16ZeroMultiFieldsNotRootString",
data: &struct {
2021-01-16 16:16:26 +03:00
A struct {
A uint16 `json:"a,string"`
2021-01-16 16:16:26 +03:00
}
B struct {
B uint16 `json:"b,string"`
2021-01-16 16:16:26 +03:00
}
}{},
},
// PtrHeadUint16MultiFieldsNotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16MultiFieldsNotRoot",
data: &struct {
2021-01-16 16:16:26 +03:00
A struct {
A uint16 `json:"a"`
}
B struct {
B uint16 `json:"b"`
}
}{A: struct {
A uint16 `json:"a"`
}{A: 1}, B: struct {
B uint16 `json:"b"`
}{B: 2}},
},
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16MultiFieldsNotRootOmitEmpty",
data: &struct {
2021-01-16 16:16:26 +03:00
A struct {
A uint16 `json:"a,omitempty"`
2021-01-16 16:16:26 +03:00
}
B struct {
B uint16 `json:"b,omitempty"`
2021-01-16 16:16:26 +03:00
}
}{A: struct {
A uint16 `json:"a,omitempty"`
}{A: 1}, B: struct {
B uint16 `json:"b,omitempty"`
}{B: 2}},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16MultiFieldsNotRootString",
data: &struct {
2021-01-16 16:16:26 +03:00
A struct {
A uint16 `json:"a,string"`
2021-01-16 16:16:26 +03:00
}
B struct {
B uint16 `json:"b,string"`
2021-01-16 16:16:26 +03:00
}
}{A: struct {
A uint16 `json:"a,string"`
}{A: 1}, B: struct {
B uint16 `json:"b,string"`
}{B: 2}},
2021-01-16 16:16:26 +03:00
},
// PtrHeadUint16PtrMultiFieldsNotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16PtrMultiFieldsNotRoot",
2021-01-16 16:16:26 +03:00
data: &struct {
A *struct {
A *uint16 `json:"a"`
2021-01-16 16:16:26 +03:00
}
B *struct {
B *uint16 `json:"b"`
2021-01-16 16:16:26 +03:00
}
}{A: &(struct {
A *uint16 `json:"a"`
}{A: uint16ptr(1)}), B: &(struct {
B *uint16 `json:"b"`
}{B: uint16ptr(2)})},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16PtrMultiFieldsNotRootOmitEmpty",
2021-01-16 16:16:26 +03:00
data: &struct {
A *struct {
A *uint16 `json:"a,omitempty"`
}
B *struct {
B *uint16 `json:"b,omitempty"`
}
}{A: &(struct {
A *uint16 `json:"a,omitempty"`
}{A: uint16ptr(1)}), B: &(struct {
B *uint16 `json:"b,omitempty"`
}{B: uint16ptr(2)})},
},
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16PtrMultiFieldsNotRootString",
data: &struct {
A *struct {
A *uint16 `json:"a,string"`
}
B *struct {
B *uint16 `json:"b,string"`
}
}{A: &(struct {
A *uint16 `json:"a,string"`
}{A: uint16ptr(1)}), B: &(struct {
B *uint16 `json:"b,string"`
}{B: uint16ptr(2)})},
},
// PtrHeadUint16PtrNilMultiFieldsNotRoot
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16PtrNilMultiFieldsNotRoot",
data: &struct {
A *struct {
A *uint16 `json:"a"`
}
B *struct {
B *uint16 `json:"b"`
}
}{A: nil, B: nil},
},
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16PtrNilMultiFieldsNotRootOmitEmpty",
data: &struct {
A *struct {
A *uint16 `json:"a,omitempty"`
} `json:",omitempty"`
B *struct {
B *uint16 `json:"b,omitempty"`
} `json:",omitempty"`
}{A: nil, B: nil},
},
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16PtrNilMultiFieldsNotRootString",
data: &struct {
A *struct {
A *uint16 `json:"a,string"`
} `json:",string"`
B *struct {
B *uint16 `json:"b,string"`
} `json:",string"`
}{A: nil, B: nil},
},
// PtrHeadUint16NilMultiFieldsNotRoot
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16NilMultiFieldsNotRoot",
data: (*struct {
A *struct {
A *uint16 `json:"a"`
}
B *struct {
B *uint16 `json:"b"`
}
})(nil),
},
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16NilMultiFieldsNotRootOmitEmpty",
data: (*struct {
A *struct {
A *uint16 `json:"a,omitempty"`
}
B *struct {
B *uint16 `json:"b,omitempty"`
}
})(nil),
},
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16NilMultiFieldsNotRootString",
data: (*struct {
A *struct {
A *uint16 `json:"a,string"`
}
B *struct {
B *uint16 `json:"b,string"`
}
})(nil),
},
// PtrHeadUint16DoubleMultiFieldsNotRoot
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16DoubleMultiFieldsNotRoot",
data: &struct {
A *struct {
2021-01-16 16:16:26 +03:00
A uint16 `json:"a"`
B uint16 `json:"b"`
2021-01-16 16:16:26 +03:00
}
B *struct {
A uint16 `json:"a"`
2021-01-16 16:16:26 +03:00
B uint16 `json:"b"`
}
}{A: &(struct {
2021-01-16 16:16:26 +03:00
A uint16 `json:"a"`
B uint16 `json:"b"`
}{A: 1, B: 2}), B: &(struct {
A uint16 `json:"a"`
B uint16 `json:"b"`
}{A: 3, B: 4})},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16DoubleMultiFieldsNotRootOmitEmpty",
data: &struct {
A *struct {
A uint16 `json:"a,omitempty"`
B uint16 `json:"b,omitempty"`
}
B *struct {
A uint16 `json:"a,omitempty"`
B uint16 `json:"b,omitempty"`
}
}{A: &(struct {
A uint16 `json:"a,omitempty"`
B uint16 `json:"b,omitempty"`
}{A: 1, B: 2}), B: &(struct {
A uint16 `json:"a,omitempty"`
B uint16 `json:"b,omitempty"`
}{A: 3, B: 4})},
},
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16DoubleMultiFieldsNotRootString",
2021-01-16 16:16:26 +03:00
data: &struct {
A *struct {
A uint16 `json:"a,string"`
B uint16 `json:"b,string"`
2021-01-16 16:16:26 +03:00
}
B *struct {
A uint16 `json:"a,string"`
B uint16 `json:"b,string"`
2021-01-16 16:16:26 +03:00
}
}{A: &(struct {
A uint16 `json:"a,string"`
B uint16 `json:"b,string"`
}{A: 1, B: 2}), B: &(struct {
A uint16 `json:"a,string"`
B uint16 `json:"b,string"`
}{A: 3, B: 4})},
2021-01-16 16:16:26 +03:00
},
// PtrHeadUint16NilDoubleMultiFieldsNotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16NilDoubleMultiFieldsNotRoot",
2021-01-16 16:16:26 +03:00
data: &struct {
A *struct {
A uint16 `json:"a"`
B uint16 `json:"b"`
2021-01-16 16:16:26 +03:00
}
B *struct {
A uint16 `json:"a"`
B uint16 `json:"b"`
2021-01-16 16:16:26 +03:00
}
}{A: nil, B: nil},
},
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16NilDoubleMultiFieldsNotRootOmitEmpty",
data: &struct {
2021-01-16 16:16:26 +03:00
A *struct {
A uint16 `json:"a,omitempty"`
B uint16 `json:"b,omitempty"`
} `json:",omitempty"`
2021-01-16 16:16:26 +03:00
B *struct {
A uint16 `json:"a,omitempty"`
B uint16 `json:"b,omitempty"`
} `json:",omitempty"`
}{A: nil, B: nil},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16NilDoubleMultiFieldsNotRootString",
2021-01-16 16:16:26 +03:00
data: &struct {
A *struct {
A uint16 `json:"a,string"`
B uint16 `json:"b,string"`
2021-01-16 16:16:26 +03:00
}
B *struct {
A uint16 `json:"a,string"`
B uint16 `json:"b,string"`
2021-01-16 16:16:26 +03:00
}
}{A: nil, B: nil},
2021-01-16 16:16:26 +03:00
},
// PtrHeadUint16NilDoubleMultiFieldsNotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16NilDoubleMultiFieldsNotRoot",
data: (*struct {
2021-01-16 16:16:26 +03:00
A *struct {
A uint16 `json:"a"`
B uint16 `json:"b"`
}
B *struct {
A uint16 `json:"a"`
B uint16 `json:"b"`
}
})(nil),
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16NilDoubleMultiFieldsNotRootOmitEmpty",
2021-01-16 16:16:26 +03:00
data: (*struct {
A *struct {
A uint16 `json:"a,omitempty"`
B uint16 `json:"b,omitempty"`
2021-01-16 16:16:26 +03:00
}
B *struct {
A uint16 `json:"a,omitempty"`
B uint16 `json:"b,omitempty"`
}
})(nil),
},
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16NilDoubleMultiFieldsNotRootString",
data: (*struct {
A *struct {
A uint16 `json:"a,string"`
B uint16 `json:"b,string"`
}
B *struct {
A uint16 `json:"a,string"`
B uint16 `json:"b,string"`
2021-01-16 16:16:26 +03:00
}
})(nil),
},
// PtrHeadUint16PtrDoubleMultiFieldsNotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16PtrDoubleMultiFieldsNotRoot",
2021-01-16 16:16:26 +03:00
data: &struct {
A *struct {
A *uint16 `json:"a"`
B *uint16 `json:"b"`
}
B *struct {
A *uint16 `json:"a"`
B *uint16 `json:"b"`
}
}{A: &(struct {
A *uint16 `json:"a"`
B *uint16 `json:"b"`
}{A: uint16ptr(1), B: uint16ptr(2)}), B: &(struct {
A *uint16 `json:"a"`
B *uint16 `json:"b"`
}{A: uint16ptr(3), B: uint16ptr(4)})},
},
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16PtrDoubleMultiFieldsNotRootOmitEmpty",
data: &struct {
A *struct {
A *uint16 `json:"a,omitempty"`
B *uint16 `json:"b,omitempty"`
}
B *struct {
A *uint16 `json:"a,omitempty"`
B *uint16 `json:"b,omitempty"`
}
}{A: &(struct {
A *uint16 `json:"a,omitempty"`
B *uint16 `json:"b,omitempty"`
}{A: uint16ptr(1), B: uint16ptr(2)}), B: &(struct {
A *uint16 `json:"a,omitempty"`
B *uint16 `json:"b,omitempty"`
}{A: uint16ptr(3), B: uint16ptr(4)})},
},
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16PtrDoubleMultiFieldsNotRootString",
data: &struct {
A *struct {
A *uint16 `json:"a,string"`
B *uint16 `json:"b,string"`
}
B *struct {
A *uint16 `json:"a,string"`
B *uint16 `json:"b,string"`
}
}{A: &(struct {
A *uint16 `json:"a,string"`
B *uint16 `json:"b,string"`
}{A: uint16ptr(1), B: uint16ptr(2)}), B: &(struct {
A *uint16 `json:"a,string"`
B *uint16 `json:"b,string"`
}{A: uint16ptr(3), B: uint16ptr(4)})},
},
// PtrHeadUint16PtrNilDoubleMultiFieldsNotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16PtrNilDoubleMultiFieldsNotRoot",
2021-01-16 16:16:26 +03:00
data: &struct {
A *struct {
A *uint16 `json:"a"`
B *uint16 `json:"b"`
}
B *struct {
A *uint16 `json:"a"`
B *uint16 `json:"b"`
}
}{A: nil, B: nil},
},
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16PtrNilDoubleMultiFieldsNotRootOmitEmpty",
data: &struct {
A *struct {
A *uint16 `json:"a,omitempty"`
B *uint16 `json:"b,omitempty"`
} `json:",omitempty"`
B *struct {
A *uint16 `json:"a,omitempty"`
B *uint16 `json:"b,omitempty"`
} `json:",omitempty"`
}{A: nil, B: nil},
},
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16PtrNilDoubleMultiFieldsNotRootString",
data: &struct {
A *struct {
A *uint16 `json:"a,string"`
B *uint16 `json:"b,string"`
}
B *struct {
A *uint16 `json:"a,string"`
B *uint16 `json:"b,string"`
}
}{A: nil, B: nil},
},
// PtrHeadUint16PtrNilDoubleMultiFieldsNotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16PtrNilDoubleMultiFieldsNotRoot",
2021-01-16 16:16:26 +03:00
data: (*struct {
A *struct {
A *uint16 `json:"a"`
B *uint16 `json:"b"`
}
B *struct {
A *uint16 `json:"a"`
B *uint16 `json:"b"`
}
})(nil),
},
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16PtrNilDoubleMultiFieldsNotRootOmitEmpty",
data: (*struct {
A *struct {
A *uint16 `json:"a,omitempty"`
B *uint16 `json:"b,omitempty"`
}
B *struct {
A *uint16 `json:"a,omitempty"`
B *uint16 `json:"b,omitempty"`
}
})(nil),
},
{
2021-02-15 05:27:47 +03:00
name: "PtrHeadUint16PtrNilDoubleMultiFieldsNotRootString",
data: (*struct {
A *struct {
A *uint16 `json:"a,string"`
B *uint16 `json:"b,string"`
}
B *struct {
A *uint16 `json:"a,string"`
B *uint16 `json:"b,string"`
}
})(nil),
},
// AnonymousHeadUint16
{
2021-02-15 05:27:47 +03:00
name: "AnonymousHeadUint16",
data: struct {
structUint16
B uint16 `json:"b"`
}{
structUint16: structUint16{A: 1},
B: 2,
},
},
{
2021-02-15 05:27:47 +03:00
name: "AnonymousHeadUint16OmitEmpty",
data: struct {
structUint16OmitEmpty
B uint16 `json:"b,omitempty"`
}{
structUint16OmitEmpty: structUint16OmitEmpty{A: 1},
B: 2,
},
},
{
2021-02-15 05:27:47 +03:00
name: "AnonymousHeadUint16String",
data: struct {
structUint16String
B uint16 `json:"b,string"`
}{
structUint16String: structUint16String{A: 1},
B: 2,
},
},
// PtrAnonymousHeadUint16
{
2021-02-15 05:27:47 +03:00
name: "PtrAnonymousHeadUint16",
data: struct {
*structUint16
B uint16 `json:"b"`
}{
structUint16: &structUint16{A: 1},
B: 2,
},
},
{
2021-02-15 05:27:47 +03:00
name: "PtrAnonymousHeadUint16OmitEmpty",
data: struct {
*structUint16OmitEmpty
B uint16 `json:"b,omitempty"`
}{
structUint16OmitEmpty: &structUint16OmitEmpty{A: 1},
B: 2,
},
},
{
2021-02-15 05:27:47 +03:00
name: "PtrAnonymousHeadUint16String",
data: struct {
*structUint16String
B uint16 `json:"b,string"`
}{
structUint16String: &structUint16String{A: 1},
B: 2,
},
},
// NilPtrAnonymousHeadUint16
{
2021-02-15 05:27:47 +03:00
name: "NilPtrAnonymousHeadUint16",
2021-01-16 16:16:26 +03:00
data: struct {
*structUint16
2021-01-16 16:16:26 +03:00
B uint16 `json:"b"`
}{
structUint16: nil,
2021-01-16 16:16:26 +03:00
B: 2,
},
},
{
2021-02-15 05:27:47 +03:00
name: "NilPtrAnonymousHeadUint16OmitEmpty",
2021-01-16 16:16:26 +03:00
data: struct {
*structUint16OmitEmpty
B uint16 `json:"b,omitempty"`
2021-01-16 16:16:26 +03:00
}{
structUint16OmitEmpty: nil,
B: 2,
2021-01-16 16:16:26 +03:00
},
},
{
2021-02-15 05:27:47 +03:00
name: "NilPtrAnonymousHeadUint16String",
2021-01-16 16:16:26 +03:00
data: struct {
*structUint16String
B uint16 `json:"b,string"`
2021-01-16 16:16:26 +03:00
}{
structUint16String: nil,
B: 2,
2021-01-16 16:16:26 +03:00
},
},
// AnonymousHeadUint16Ptr
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:27:47 +03:00
name: "AnonymousHeadUint16Ptr",
2021-01-16 16:16:26 +03:00
data: struct {
structUint16Ptr
B *uint16 `json:"b"`
}{
structUint16Ptr: structUint16Ptr{A: uint16ptr(1)},
B: uint16ptr(2),
},
},
{
2021-02-15 05:27:47 +03:00
name: "AnonymousHeadUint16PtrOmitEmpty",
data: struct {
structUint16PtrOmitEmpty
B *uint16 `json:"b,omitempty"`
}{
structUint16PtrOmitEmpty: structUint16PtrOmitEmpty{A: uint16ptr(1)},
B: uint16ptr(2),
},
},
{
2021-02-15 05:27:47 +03:00
name: "AnonymousHeadUint16PtrString",
data: struct {
structUint16PtrString
B *uint16 `json:"b,string"`
}{
structUint16PtrString: structUint16PtrString{A: uint16ptr(1)},
B: uint16ptr(2),
},
},
// AnonymousHeadUint16PtrNil
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:27:47 +03:00
name: "AnonymousHeadUint16PtrNil",
2021-01-16 16:16:26 +03:00
data: struct {
structUint16Ptr
B *uint16 `json:"b"`
}{
structUint16Ptr: structUint16Ptr{A: nil},
B: uint16ptr(2),
},
},
{
2021-02-15 05:27:47 +03:00
name: "AnonymousHeadUint16PtrNilOmitEmpty",
data: struct {
structUint16PtrOmitEmpty
B *uint16 `json:"b,omitempty"`
}{
structUint16PtrOmitEmpty: structUint16PtrOmitEmpty{A: nil},
B: uint16ptr(2),
},
},
{
2021-02-15 05:27:47 +03:00
name: "AnonymousHeadUint16PtrNilString",
data: struct {
structUint16PtrString
B *uint16 `json:"b,string"`
}{
structUint16PtrString: structUint16PtrString{A: nil},
B: uint16ptr(2),
},
},
// PtrAnonymousHeadUint16Ptr
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:27:47 +03:00
name: "PtrAnonymousHeadUint16Ptr",
2021-01-16 16:16:26 +03:00
data: struct {
*structUint16Ptr
B *uint16 `json:"b"`
}{
structUint16Ptr: &structUint16Ptr{A: uint16ptr(1)},
B: uint16ptr(2),
},
},
{
2021-02-15 05:27:47 +03:00
name: "PtrAnonymousHeadUint16PtrOmitEmpty",
data: struct {
*structUint16PtrOmitEmpty
B *uint16 `json:"b,omitempty"`
}{
structUint16PtrOmitEmpty: &structUint16PtrOmitEmpty{A: uint16ptr(1)},
B: uint16ptr(2),
},
},
{
2021-02-15 05:27:47 +03:00
name: "PtrAnonymousHeadUint16PtrString",
data: struct {
*structUint16PtrString
B *uint16 `json:"b,string"`
}{
structUint16PtrString: &structUint16PtrString{A: uint16ptr(1)},
B: uint16ptr(2),
},
},
// NilPtrAnonymousHeadUint16Ptr
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:27:47 +03:00
name: "NilPtrAnonymousHeadUint16Ptr",
2021-01-16 16:16:26 +03:00
data: struct {
*structUint16Ptr
B *uint16 `json:"b"`
}{
structUint16Ptr: nil,
B: uint16ptr(2),
},
},
{
2021-02-15 05:27:47 +03:00
name: "NilPtrAnonymousHeadUint16PtrOmitEmpty",
data: struct {
*structUint16PtrOmitEmpty
B *uint16 `json:"b,omitempty"`
}{
structUint16PtrOmitEmpty: nil,
B: uint16ptr(2),
},
},
{
2021-02-15 05:27:47 +03:00
name: "NilPtrAnonymousHeadUint16PtrString",
data: struct {
*structUint16PtrString
B *uint16 `json:"b,string"`
}{
structUint16PtrString: nil,
B: uint16ptr(2),
},
},
// AnonymousHeadUint16Only
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:27:47 +03:00
name: "AnonymousHeadUint16Only",
2021-01-16 16:16:26 +03:00
data: struct {
structUint16
}{
structUint16: structUint16{A: 1},
},
},
{
2021-02-15 05:27:47 +03:00
name: "AnonymousHeadUint16OnlyOmitEmpty",
data: struct {
structUint16OmitEmpty
}{
structUint16OmitEmpty: structUint16OmitEmpty{A: 1},
},
},
{
2021-02-15 05:27:47 +03:00
name: "AnonymousHeadUint16OnlyString",
data: struct {
structUint16String
}{
structUint16String: structUint16String{A: 1},
},
},
// PtrAnonymousHeadUint16Only
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:27:47 +03:00
name: "PtrAnonymousHeadUint16Only",
2021-01-16 16:16:26 +03:00
data: struct {
*structUint16
}{
structUint16: &structUint16{A: 1},
},
},
{
2021-02-15 05:27:47 +03:00
name: "PtrAnonymousHeadUint16OnlyOmitEmpty",
data: struct {
*structUint16OmitEmpty
}{
structUint16OmitEmpty: &structUint16OmitEmpty{A: 1},
},
},
{
2021-02-15 05:27:47 +03:00
name: "PtrAnonymousHeadUint16OnlyString",
data: struct {
*structUint16String
}{
structUint16String: &structUint16String{A: 1},
},
},
// NilPtrAnonymousHeadUint16Only
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:27:47 +03:00
name: "NilPtrAnonymousHeadUint16Only",
2021-01-16 16:16:26 +03:00
data: struct {
*structUint16
}{
structUint16: nil,
},
},
{
2021-02-15 05:27:47 +03:00
name: "NilPtrAnonymousHeadUint16OnlyOmitEmpty",
data: struct {
*structUint16OmitEmpty
}{
structUint16OmitEmpty: nil,
},
},
{
2021-02-15 05:27:47 +03:00
name: "NilPtrAnonymousHeadUint16OnlyString",
data: struct {
*structUint16String
}{
structUint16String: nil,
},
},
// AnonymousHeadUint16PtrOnly
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:27:47 +03:00
name: "AnonymousHeadUint16PtrOnly",
2021-01-16 16:16:26 +03:00
data: struct {
structUint16Ptr
}{
structUint16Ptr: structUint16Ptr{A: uint16ptr(1)},
},
},
{
2021-02-15 05:27:47 +03:00
name: "AnonymousHeadUint16PtrOnlyOmitEmpty",
data: struct {
structUint16PtrOmitEmpty
}{
structUint16PtrOmitEmpty: structUint16PtrOmitEmpty{A: uint16ptr(1)},
},
},
{
2021-02-15 05:27:47 +03:00
name: "AnonymousHeadUint16PtrOnlyString",
data: struct {
structUint16PtrString
}{
structUint16PtrString: structUint16PtrString{A: uint16ptr(1)},
},
},
// AnonymousHeadUint16PtrNilOnly
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:27:47 +03:00
name: "AnonymousHeadUint16PtrNilOnly",
2021-01-16 16:16:26 +03:00
data: struct {
structUint16Ptr
}{
structUint16Ptr: structUint16Ptr{A: nil},
},
},
{
2021-02-15 05:27:47 +03:00
name: "AnonymousHeadUint16PtrNilOnlyOmitEmpty",
data: struct {
structUint16PtrOmitEmpty
}{
structUint16PtrOmitEmpty: structUint16PtrOmitEmpty{A: nil},
},
},
{
2021-02-15 05:27:47 +03:00
name: "AnonymousHeadUint16PtrNilOnlyString",
data: struct {
structUint16PtrString
}{
structUint16PtrString: structUint16PtrString{A: nil},
},
},
// PtrAnonymousHeadUint16PtrOnly
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:27:47 +03:00
name: "PtrAnonymousHeadUint16PtrOnly",
2021-01-16 16:16:26 +03:00
data: struct {
*structUint16Ptr
}{
structUint16Ptr: &structUint16Ptr{A: uint16ptr(1)},
},
},
{
2021-02-15 05:27:47 +03:00
name: "PtrAnonymousHeadUint16PtrOnlyOmitEmpty",
data: struct {
*structUint16PtrOmitEmpty
}{
structUint16PtrOmitEmpty: &structUint16PtrOmitEmpty{A: uint16ptr(1)},
},
},
{
2021-02-15 05:27:47 +03:00
name: "PtrAnonymousHeadUint16PtrOnlyString",
data: struct {
*structUint16PtrString
}{
structUint16PtrString: &structUint16PtrString{A: uint16ptr(1)},
},
},
// NilPtrAnonymousHeadUint16PtrOnly
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:27:47 +03:00
name: "NilPtrAnonymousHeadUint16PtrOnly",
2021-01-16 16:16:26 +03:00
data: struct {
*structUint16Ptr
}{
structUint16Ptr: nil,
},
},
{
2021-02-15 05:27:47 +03:00
name: "NilPtrAnonymousHeadUint16PtrOnlyOmitEmpty",
data: struct {
*structUint16PtrOmitEmpty
}{
structUint16PtrOmitEmpty: nil,
},
},
{
2021-02-15 05:27:47 +03:00
name: "NilPtrAnonymousHeadUint16PtrOnlyString",
data: struct {
*structUint16PtrString
}{
structUint16PtrString: nil,
},
},
2021-01-16 16:16:26 +03:00
}
for _, test := range tests {
for _, indent := range []bool{true, false} {
for _, htmlEscape := range []bool{true, false} {
var buf bytes.Buffer
enc := json.NewEncoder(&buf)
enc.SetEscapeHTML(htmlEscape)
if indent {
enc.SetIndent("", " ")
}
if err := enc.Encode(test.data); err != nil {
t.Fatalf("%s(htmlEscape:%v,indent:%v): %+v: %s", test.name, htmlEscape, indent, test.data, err)
2021-01-16 16:16:26 +03:00
}
stdresult := encodeByEncodingJSON(test.data, indent, htmlEscape)
if buf.String() != stdresult {
t.Errorf("%s(htmlEscape:%v,indent:%v): doesn't compatible with encoding/json. expected %q but got %q", test.name, htmlEscape, indent, stdresult, buf.String())
}
2021-01-16 16:16:26 +03:00
}
}
}
}