go-json/test/cover/cover_uint_test.go

2354 lines
46 KiB
Go
Raw Permalink Normal View History

2021-01-16 16:16:26 +03:00
package json_test
import (
"bytes"
"testing"
"github.com/goccy/go-json"
)
func TestCoverUint(t *testing.T) {
type structUint struct {
A uint `json:"a"`
}
type structUintOmitEmpty struct {
A uint `json:"a,omitempty"`
}
type structUintString struct {
A uint `json:"a,string"`
}
2021-05-06 20:03:39 +03:00
type structUintStringOmitEmpty struct {
A uint `json:"a,string,omitempty"`
}
2021-01-16 16:16:26 +03:00
type structUintPtr struct {
A *uint `json:"a"`
}
type structUintPtrOmitEmpty struct {
A *uint `json:"a,omitempty"`
}
type structUintPtrString struct {
A *uint `json:"a,string"`
}
2021-05-06 20:03:39 +03:00
type structUintPtrStringOmitEmpty struct {
A *uint `json:"a,string,omitempty"`
}
2021-01-16 16:16:26 +03:00
tests := []struct {
2021-02-15 05:24:35 +03:00
name string
data interface{}
2021-01-16 16:16:26 +03:00
}{
2021-03-19 17:31:29 +03:00
{
name: "Uint",
data: uint(10),
},
{
name: "UintPtr",
data: uptr(10),
},
{
name: "UintPtr3",
data: uintptr3(10),
},
{
name: "UintPtrNil",
data: (*uint)(nil),
},
{
name: "UintPtr3Nil",
data: (***uint)(nil),
},
// HeadUintZero
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:24:35 +03:00
name: "HeadUintZero",
2021-01-16 16:16:26 +03:00
data: struct {
A uint `json:"a"`
}{},
},
{
2021-02-15 05:24:35 +03:00
name: "HeadUintZeroOmitEmpty",
data: struct {
A uint `json:"a,omitempty"`
}{},
},
{
2021-02-15 05:24:35 +03:00
name: "HeadUintZeroString",
data: struct {
A uint `json:"a,string"`
}{},
},
2021-05-06 20:03:39 +03:00
{
name: "HeadUintZeroStringOmitEmpty",
data: struct {
A uint `json:"a,string,omitempty"`
}{},
},
// HeadUint
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:24:35 +03:00
name: "HeadUint",
2021-01-16 16:16:26 +03:00
data: struct {
A uint `json:"a"`
}{A: 1},
},
{
2021-02-15 05:24:35 +03:00
name: "HeadUintOmitEmpty",
data: struct {
A uint `json:"a,omitempty"`
}{A: 1},
},
{
2021-02-15 05:24:35 +03:00
name: "HeadUintString",
data: struct {
A uint `json:"a,string"`
}{A: 1},
},
2021-05-06 20:03:39 +03:00
{
name: "HeadUintStringOmitEmpty",
data: struct {
A uint `json:"a,string,omitempty"`
}{A: 1},
},
// HeadUintPtr
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:24:35 +03:00
name: "HeadUintPtr",
2021-01-16 16:16:26 +03:00
data: struct {
A *uint `json:"a"`
}{A: uptr(1)},
},
{
2021-02-15 05:24:35 +03:00
name: "HeadUintPtrOmitEmpty",
data: struct {
A *uint `json:"a,omitempty"`
}{A: uptr(1)},
},
{
2021-02-15 05:24:35 +03:00
name: "HeadUintPtrString",
data: struct {
A *uint `json:"a,string"`
}{A: uptr(1)},
},
2021-05-06 20:03:39 +03:00
{
name: "HeadUintPtrStringOmitEmpty",
data: struct {
A *uint `json:"a,string,omitempty"`
}{A: uptr(1)},
},
// HeadUintPtrNil
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:24:35 +03:00
name: "HeadUintPtrNil",
2021-01-16 16:16:26 +03:00
data: struct {
A *uint `json:"a"`
}{A: nil},
},
{
2021-02-15 05:24:35 +03:00
name: "HeadUintPtrNilOmitEmpty",
data: struct {
A *uint `json:"a,omitempty"`
}{A: nil},
},
{
2021-02-15 05:24:35 +03:00
name: "HeadUintPtrNilString",
data: struct {
A *uint `json:"a,string"`
}{A: nil},
},
2021-05-06 20:03:39 +03:00
{
name: "HeadUintPtrNilStringOmitEmpty",
data: struct {
A *uint `json:"a,string,omitempty"`
}{A: nil},
},
// PtrHeadUintZero
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintZero",
2021-01-16 16:16:26 +03:00
data: &struct {
A uint `json:"a"`
}{},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintZeroOmitEmpty",
data: &struct {
A uint `json:"a,omitempty"`
}{},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintZeroString",
data: &struct {
A uint `json:"a,string"`
}{},
},
2021-05-06 20:03:39 +03:00
{
name: "PtrHeadUintZeroStringOmitEmpty",
data: &struct {
A uint `json:"a,string,omitempty"`
}{},
},
// PtrHeadUint
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUint",
2021-01-16 16:16:26 +03:00
data: &struct {
A uint `json:"a"`
}{A: 1},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintOmitEmpty",
data: &struct {
A uint `json:"a,omitempty"`
}{A: 1},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintString",
data: &struct {
A uint `json:"a,string"`
}{A: 1},
},
2021-05-06 20:03:39 +03:00
{
name: "PtrHeadUintStringOmitEmpty",
data: &struct {
A uint `json:"a,string,omitempty"`
}{A: 1},
},
// PtrHeadUintPtr
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintPtr",
2021-01-16 16:16:26 +03:00
data: &struct {
A *uint `json:"a"`
}{A: uptr(1)},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintPtrOmitEmpty",
data: &struct {
A *uint `json:"a,omitempty"`
}{A: uptr(1)},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintPtrString",
data: &struct {
A *uint `json:"a,string"`
}{A: uptr(1)},
},
2021-05-06 20:03:39 +03:00
{
name: "PtrHeadUintPtrStringOmitEmpty",
data: &struct {
A *uint `json:"a,string,omitempty"`
}{A: uptr(1)},
},
// PtrHeadUintPtrNil
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintPtrNil",
2021-01-16 16:16:26 +03:00
data: &struct {
A *uint `json:"a"`
}{A: nil},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintPtrNilOmitEmpty",
data: &struct {
A *uint `json:"a,omitempty"`
}{A: nil},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintPtrNilString",
data: &struct {
A *uint `json:"a,string"`
}{A: nil},
},
2021-05-06 20:03:39 +03:00
{
name: "PtrHeadUintPtrNilStringOmitEmpty",
data: &struct {
A *uint `json:"a,string,omitempty"`
}{A: nil},
},
// PtrHeadUintNil
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintNil",
2021-01-16 16:16:26 +03:00
data: (*struct {
A *uint `json:"a"`
})(nil),
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintNilOmitEmpty",
data: (*struct {
A *uint `json:"a,omitempty"`
})(nil),
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintNilString",
data: (*struct {
A *uint `json:"a,string"`
})(nil),
},
2021-05-06 20:03:39 +03:00
{
name: "PtrHeadUintNilStringOmitEmpty",
data: (*struct {
A *uint `json:"a,string,omitempty"`
})(nil),
},
// HeadUintZeroMultiFields
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:24:35 +03:00
name: "HeadUintZeroMultiFields",
2021-01-16 16:16:26 +03:00
data: struct {
A uint `json:"a"`
B uint `json:"b"`
2021-02-15 05:24:35 +03:00
C uint `json:"c"`
2021-01-16 16:16:26 +03:00
}{},
},
{
2021-02-15 05:24:35 +03:00
name: "HeadUintZeroMultiFieldsOmitEmpty",
data: struct {
A uint `json:"a,omitempty"`
B uint `json:"b,omitempty"`
2021-02-15 05:24:35 +03:00
C uint `json:"c,omitempty"`
}{},
},
{
2021-05-06 20:03:39 +03:00
name: "HeadUintZeroMultiFieldsString",
data: struct {
A uint `json:"a,string"`
B uint `json:"b,string"`
2021-02-15 05:24:35 +03:00
C uint `json:"c,string"`
}{},
},
2021-05-06 20:03:39 +03:00
{
name: "HeadUintZeroMultiFieldsStringOmitEmpty",
data: struct {
A uint `json:"a,string,omitempty"`
B uint `json:"b,string,omitempty"`
C uint `json:"c,string,omitempty"`
}{},
},
// HeadUintMultiFields
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:24:35 +03:00
name: "HeadUintMultiFields",
2021-01-16 16:16:26 +03:00
data: struct {
A uint `json:"a"`
B uint `json:"b"`
2021-02-15 05:24:35 +03:00
C uint `json:"c"`
}{A: 1, B: 2, C: 3},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:24:35 +03:00
name: "HeadUintMultiFieldsOmitEmpty",
2021-01-16 16:16:26 +03:00
data: struct {
A uint `json:"a,omitempty"`
B uint `json:"b,omitempty"`
2021-02-15 05:24:35 +03:00
C uint `json:"c,omitempty"`
}{A: 1, B: 2, C: 3},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:24:35 +03:00
name: "HeadUintMultiFieldsString",
2021-01-16 16:16:26 +03:00
data: struct {
A uint `json:"a,string"`
B uint `json:"b,string"`
2021-02-15 05:24:35 +03:00
C uint `json:"c,string"`
}{A: 1, B: 2, C: 3},
2021-01-16 16:16:26 +03:00
},
2021-05-06 20:03:39 +03:00
{
name: "HeadUintMultiFieldsStringOmitEmpty",
data: struct {
A uint `json:"a,string,omitempty"`
B uint `json:"b,string,omitempty"`
C uint `json:"c,string,omitempty"`
}{A: 1, B: 2, C: 3},
},
// HeadUintPtrMultiFields
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:24:35 +03:00
name: "HeadUintPtrMultiFields",
data: struct {
A *uint `json:"a"`
B *uint `json:"b"`
2021-02-15 05:24:35 +03:00
C *uint `json:"c"`
}{A: uptr(1), B: uptr(2), C: uptr(3)},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:24:35 +03:00
name: "HeadUintPtrMultiFieldsOmitEmpty",
data: struct {
A *uint `json:"a,omitempty"`
B *uint `json:"b,omitempty"`
2021-02-15 05:24:35 +03:00
C *uint `json:"c,omitempty"`
}{A: uptr(1), B: uptr(2), C: uptr(3)},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:24:35 +03:00
name: "HeadUintPtrMultiFieldsString",
data: struct {
A *uint `json:"a,string"`
B *uint `json:"b,string"`
2021-02-15 05:24:35 +03:00
C *uint `json:"c,string"`
}{A: uptr(1), B: uptr(2), C: uptr(3)},
2021-01-16 16:16:26 +03:00
},
2021-05-06 20:03:39 +03:00
{
name: "HeadUintPtrMultiFieldsStringOmitEmpty",
data: struct {
A *uint `json:"a,string,omitempty"`
B *uint `json:"b,string,omitempty"`
C *uint `json:"c,string,omitempty"`
}{A: uptr(1), B: uptr(2), C: uptr(3)},
},
// HeadUintPtrNilMultiFields
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:24:35 +03:00
name: "HeadUintPtrNilMultiFields",
data: struct {
2021-01-16 16:16:26 +03:00
A *uint `json:"a"`
B *uint `json:"b"`
2021-02-15 05:24:35 +03:00
C *uint `json:"c"`
}{A: nil, B: nil, C: nil},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:24:35 +03:00
name: "HeadUintPtrNilMultiFieldsOmitEmpty",
data: struct {
A *uint `json:"a,omitempty"`
B *uint `json:"b,omitempty"`
2021-02-15 05:24:35 +03:00
C *uint `json:"c,omitempty"`
}{A: nil, B: nil, C: nil},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:24:35 +03:00
name: "HeadUintPtrNilMultiFieldsString",
data: struct {
A *uint `json:"a,string"`
B *uint `json:"b,string"`
2021-02-15 05:24:35 +03:00
C *uint `json:"c,string"`
}{A: nil, B: nil, C: nil},
},
2021-05-06 20:03:39 +03:00
{
name: "HeadUintPtrNilMultiFieldsStringOmitEmpty",
data: struct {
A *uint `json:"a,string,omitempty"`
B *uint `json:"b,string,omitempty"`
C *uint `json:"c,string,omitempty"`
}{A: nil, B: nil, C: nil},
},
// PtrHeadUintZeroMultiFields
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintZeroMultiFields",
data: &struct {
A uint `json:"a"`
B uint `json:"b"`
}{},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintZeroMultiFieldsOmitEmpty",
data: &struct {
A uint `json:"a,omitempty"`
B uint `json:"b,omitempty"`
}{},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintZeroMultiFieldsString",
data: &struct {
A uint `json:"a,string"`
B uint `json:"b,string"`
}{},
},
2021-05-06 20:03:39 +03:00
{
name: "PtrHeadUintZeroMultiFieldsStringOmitEmpty",
data: &struct {
A uint `json:"a,string,omitempty"`
B uint `json:"b,string,omitempty"`
}{},
},
// PtrHeadUintMultiFields
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintMultiFields",
data: &struct {
A uint `json:"a"`
B uint `json:"b"`
}{A: 1, B: 2},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintMultiFieldsOmitEmpty",
data: &struct {
A uint `json:"a,omitempty"`
B uint `json:"b,omitempty"`
}{A: 1, B: 2},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintMultiFieldsString",
data: &struct {
A uint `json:"a,string"`
B uint `json:"b,string"`
}{A: 1, B: 2},
},
2021-05-06 20:03:39 +03:00
{
name: "PtrHeadUintMultiFieldsStringOmitEmpty",
data: &struct {
A uint `json:"a,string,omitempty"`
B uint `json:"b,string,omitempty"`
}{A: 1, B: 2},
},
// PtrHeadUintPtrMultiFields
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintPtrMultiFields",
data: &struct {
A *uint `json:"a"`
B *uint `json:"b"`
}{A: uptr(1), B: uptr(2)},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintPtrMultiFieldsOmitEmpty",
data: &struct {
A *uint `json:"a,omitempty"`
B *uint `json:"b,omitempty"`
}{A: uptr(1), B: uptr(2)},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintPtrMultiFieldsString",
data: &struct {
A *uint `json:"a,string"`
B *uint `json:"b,string"`
}{A: uptr(1), B: uptr(2)},
},
2021-05-06 20:03:39 +03:00
{
name: "PtrHeadUintPtrMultiFieldsStringOmitEmpty",
data: &struct {
A *uint `json:"a,string,omitempty"`
B *uint `json:"b,string,omitempty"`
}{A: uptr(1), B: uptr(2)},
},
// PtrHeadUintPtrNilMultiFields
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintPtrNilMultiFields",
data: &struct {
A *uint `json:"a"`
B *uint `json:"b"`
}{A: nil, B: nil},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintPtrNilMultiFieldsOmitEmpty",
data: &struct {
A *uint `json:"a,omitempty"`
B *uint `json:"b,omitempty"`
}{A: nil, B: nil},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintPtrNilMultiFieldsString",
data: &struct {
A *uint `json:"a,string"`
B *uint `json:"b,string"`
}{A: nil, B: nil},
},
2021-05-06 20:03:39 +03:00
{
name: "PtrHeadUintPtrNilMultiFieldsStringOmitEmpty",
data: &struct {
A *uint `json:"a,string,omitempty"`
B *uint `json:"b,string,omitempty"`
}{A: nil, B: nil},
},
// PtrHeadUintNilMultiFields
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintNilMultiFields",
data: (*struct {
A *uint `json:"a"`
B *uint `json:"b"`
})(nil),
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintNilMultiFieldsOmitEmpty",
data: (*struct {
A *uint `json:"a,omitempty"`
B *uint `json:"b,omitempty"`
})(nil),
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintNilMultiFieldsString",
data: (*struct {
A *uint `json:"a,string"`
B *uint `json:"b,string"`
})(nil),
},
2021-05-06 20:03:39 +03:00
{
name: "PtrHeadUintNilMultiFieldsStringOmitEmpty",
data: (*struct {
A *uint `json:"a,string,omitempty"`
B *uint `json:"b,string,omitempty"`
})(nil),
},
// HeadUintZeroNotRoot
{
2021-02-15 05:24:35 +03:00
name: "HeadUintZeroNotRoot",
2021-01-16 16:16:26 +03:00
data: struct {
A struct {
A uint `json:"a"`
}
}{},
},
{
2021-02-15 05:24:35 +03:00
name: "HeadUintZeroNotRootOmitEmpty",
data: struct {
A struct {
A uint `json:"a,omitempty"`
}
}{},
},
{
2021-02-15 05:24:35 +03:00
name: "HeadUintZeroNotRootString",
data: struct {
A struct {
A uint `json:"a,string"`
}
}{},
},
2021-05-06 20:03:39 +03:00
{
name: "HeadUintZeroNotRootStringOmitEmpty",
data: struct {
A struct {
A uint `json:"a,string,omitempty"`
}
}{},
},
// HeadUintNotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:24:35 +03:00
name: "HeadUintNotRoot",
2021-01-16 16:16:26 +03:00
data: struct {
A struct {
A uint `json:"a"`
}
}{A: struct {
A uint `json:"a"`
}{A: 1}},
},
{
2021-02-15 05:24:35 +03:00
name: "HeadUintNotRootOmitEmpty",
2021-01-16 16:16:26 +03:00
data: struct {
A struct {
A uint `json:"a,omitempty"`
2021-01-16 16:16:26 +03:00
}
}{A: struct {
A uint `json:"a,omitempty"`
}{A: 1}},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:24:35 +03:00
name: "HeadUintNotRootString",
2021-01-16 16:16:26 +03:00
data: struct {
A struct {
A uint `json:"a,string"`
2021-01-16 16:16:26 +03:00
}
}{A: struct {
A uint `json:"a,string"`
}{A: 1}},
2021-01-16 16:16:26 +03:00
},
2021-05-06 20:03:39 +03:00
{
name: "HeadUintNotRootStringOmitEmpty",
data: struct {
A struct {
A uint `json:"a,string,omitempty"`
}
}{A: struct {
A uint `json:"a,string,omitempty"`
}{A: 1}},
},
// HeadUintPtrNotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:24:35 +03:00
name: "HeadUintPtrNotRoot",
2021-01-16 16:16:26 +03:00
data: struct {
A struct {
A *uint `json:"a"`
2021-01-16 16:16:26 +03:00
}
}{A: struct {
A *uint `json:"a"`
}{uptr(1)}},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:24:35 +03:00
name: "HeadUintPtrNotRootOmitEmpty",
2021-01-16 16:16:26 +03:00
data: struct {
A struct {
A *uint `json:"a,omitempty"`
2021-01-16 16:16:26 +03:00
}
}{A: struct {
A *uint `json:"a,omitempty"`
}{uptr(1)}},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:24:35 +03:00
name: "HeadUintPtrNotRootString",
2021-01-16 16:16:26 +03:00
data: struct {
A struct {
A *uint `json:"a,string"`
2021-01-16 16:16:26 +03:00
}
}{A: struct {
A *uint `json:"a,string"`
}{uptr(1)}},
2021-01-16 16:16:26 +03:00
},
2021-05-06 20:03:39 +03:00
{
name: "HeadUintPtrNotRootStringOmitEmpty",
data: struct {
A struct {
A *uint `json:"a,string,omitempty"`
}
}{A: struct {
A *uint `json:"a,string,omitempty"`
}{uptr(1)}},
},
// HeadUintPtrNilNotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:24:35 +03:00
name: "HeadUintPtrNilNotRoot",
data: struct {
A struct {
A *uint `json:"a"`
}
}{},
},
{
2021-02-15 05:24:35 +03:00
name: "HeadUintPtrNilNotRootOmitEmpty",
data: struct {
A struct {
A *uint `json:"a,omitempty"`
}
}{},
},
{
2021-02-15 05:24:35 +03:00
name: "HeadUintPtrNilNotRootString",
data: struct {
A struct {
A *uint `json:"a,string"`
}
}{},
},
2021-05-06 20:03:39 +03:00
{
name: "HeadUintPtrNilNotRootStringOmitEmpty",
data: struct {
A struct {
A *uint `json:"a,string,omitempty"`
}
}{},
},
// PtrHeadUintZeroNotRoot
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintZeroNotRoot",
data: struct {
A *struct {
A uint `json:"a"`
}
}{A: new(struct {
A uint `json:"a"`
})},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintZeroNotRootOmitEmpty",
data: struct {
A *struct {
A uint `json:"a,omitempty"`
}
}{A: new(struct {
A uint `json:"a,omitempty"`
})},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintZeroNotRootString",
data: struct {
A *struct {
A uint `json:"a,string"`
}
}{A: new(struct {
A uint `json:"a,string"`
})},
},
2021-05-06 20:03:39 +03:00
{
name: "PtrHeadUintZeroNotRootStringOmitEmpty",
data: struct {
A *struct {
A uint `json:"a,string,omitempty"`
}
}{A: new(struct {
A uint `json:"a,string,omitempty"`
})},
},
// PtrHeadUintNotRoot
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintNotRoot",
data: struct {
A *struct {
A uint `json:"a"`
}
}{A: &(struct {
A uint `json:"a"`
}{A: 1})},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintNotRootOmitEmpty",
data: struct {
A *struct {
A uint `json:"a,omitempty"`
}
}{A: &(struct {
A uint `json:"a,omitempty"`
}{A: 1})},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintNotRootString",
data: struct {
A *struct {
A uint `json:"a,string"`
}
}{A: &(struct {
A uint `json:"a,string"`
}{A: 1})},
},
2021-05-06 20:03:39 +03:00
{
name: "PtrHeadUintNotRootStringOmitEmpty",
data: struct {
A *struct {
A uint `json:"a,string,omitempty"`
}
}{A: &(struct {
A uint `json:"a,string,omitempty"`
}{A: 1})},
},
// PtrHeadUintPtrNotRoot
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintPtrNotRoot",
data: struct {
A *struct {
A *uint `json:"a"`
}
}{A: &(struct {
A *uint `json:"a"`
}{A: uptr(1)})},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintPtrNotRootOmitEmpty",
data: struct {
A *struct {
A *uint `json:"a,omitempty"`
}
}{A: &(struct {
A *uint `json:"a,omitempty"`
}{A: uptr(1)})},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintPtrNotRootString",
data: struct {
A *struct {
A *uint `json:"a,string"`
}
}{A: &(struct {
A *uint `json:"a,string"`
}{A: uptr(1)})},
},
2021-05-06 20:03:39 +03:00
{
name: "PtrHeadUintPtrNotRootStringOmitEmpty",
data: struct {
A *struct {
A *uint `json:"a,string,omitempty"`
}
}{A: &(struct {
A *uint `json:"a,string,omitempty"`
}{A: uptr(1)})},
},
// PtrHeadUintPtrNilNotRoot
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintPtrNilNotRoot",
data: struct {
A *struct {
A *uint `json:"a"`
}
}{A: &(struct {
A *uint `json:"a"`
}{A: nil})},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintPtrNilNotRootOmitEmpty",
data: struct {
A *struct {
A *uint `json:"a,omitempty"`
}
}{A: &(struct {
A *uint `json:"a,omitempty"`
}{A: nil})},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintPtrNilNotRootString",
data: struct {
A *struct {
A *uint `json:"a,string"`
}
}{A: &(struct {
A *uint `json:"a,string"`
}{A: nil})},
},
2021-05-06 20:03:39 +03:00
{
name: "PtrHeadUintPtrNilNotRootStringOmitEmpty",
data: struct {
A *struct {
A *uint `json:"a,string,omitempty"`
}
}{A: &(struct {
A *uint `json:"a,string,omitempty"`
}{A: nil})},
},
// PtrHeadUintNilNotRoot
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintNilNotRoot",
data: struct {
A *struct {
A *uint `json:"a"`
}
}{A: nil},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintNilNotRootOmitEmpty",
data: struct {
A *struct {
A *uint `json:"a,omitempty"`
} `json:",omitempty"`
}{A: nil},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintNilNotRootString",
data: struct {
A *struct {
A *uint `json:"a,string"`
} `json:",string"`
}{A: nil},
},
2021-05-06 20:03:39 +03:00
{
name: "PtrHeadUintNilNotRootStringOmitEmpty",
data: struct {
A *struct {
A *uint `json:"a,string,omitempty"`
} `json:",string,omitempty"`
}{A: nil},
},
// HeadUintZeroMultiFieldsNotRoot
{
2021-02-15 05:24:35 +03:00
name: "HeadUintZeroMultiFieldsNotRoot",
data: struct {
A struct {
A uint `json:"a"`
}
B struct {
B uint `json:"b"`
}
}{},
},
{
2021-02-15 05:24:35 +03:00
name: "HeadUintZeroMultiFieldsNotRootOmitEmpty",
data: struct {
A struct {
A uint `json:"a,omitempty"`
}
B struct {
B uint `json:"b,omitempty"`
}
}{},
},
{
2021-02-15 05:24:35 +03:00
name: "HeadUintZeroMultiFieldsNotRootString",
data: struct {
A struct {
A uint `json:"a,string"`
}
B struct {
B uint `json:"b,string"`
}
}{},
},
2021-05-06 20:03:39 +03:00
{
name: "HeadUintZeroMultiFieldsNotRootStringOmitEmpty",
data: struct {
A struct {
A uint `json:"a,string,omitempty"`
}
B struct {
B uint `json:"b,string,omitempty"`
}
}{},
},
// HeadUintMultiFieldsNotRoot
{
2021-02-15 05:24:35 +03:00
name: "HeadUintMultiFieldsNotRoot",
data: struct {
A struct {
A uint `json:"a"`
}
B struct {
B uint `json:"b"`
}
}{A: struct {
A uint `json:"a"`
}{A: 1}, B: struct {
B uint `json:"b"`
}{B: 2}},
},
{
2021-02-15 05:24:35 +03:00
name: "HeadUintMultiFieldsNotRootOmitEmpty",
data: struct {
A struct {
A uint `json:"a,omitempty"`
}
B struct {
B uint `json:"b,omitempty"`
}
}{A: struct {
A uint `json:"a,omitempty"`
}{A: 1}, B: struct {
B uint `json:"b,omitempty"`
}{B: 2}},
},
{
2021-02-15 05:24:35 +03:00
name: "HeadUintMultiFieldsNotRootString",
data: struct {
A struct {
A uint `json:"a,string"`
}
B struct {
B uint `json:"b,string"`
}
}{A: struct {
A uint `json:"a,string"`
}{A: 1}, B: struct {
B uint `json:"b,string"`
}{B: 2}},
},
2021-05-06 20:03:39 +03:00
{
name: "HeadUintMultiFieldsNotRootStringOmitEmpty",
data: struct {
A struct {
A uint `json:"a,string,omitempty"`
}
B struct {
B uint `json:"b,string,omitempty"`
}
}{A: struct {
A uint `json:"a,string,omitempty"`
}{A: 1}, B: struct {
B uint `json:"b,string,omitempty"`
}{B: 2}},
},
// HeadUintPtrMultiFieldsNotRoot
{
2021-02-15 05:24:35 +03:00
name: "HeadUintPtrMultiFieldsNotRoot",
data: struct {
A struct {
A *uint `json:"a"`
}
B struct {
B *uint `json:"b"`
}
}{A: struct {
A *uint `json:"a"`
}{A: uptr(1)}, B: struct {
B *uint `json:"b"`
}{B: uptr(2)}},
},
{
2021-02-15 05:24:35 +03:00
name: "HeadUintPtrMultiFieldsNotRootOmitEmpty",
data: struct {
A struct {
A *uint `json:"a,omitempty"`
}
B struct {
B *uint `json:"b,omitempty"`
}
}{A: struct {
A *uint `json:"a,omitempty"`
}{A: uptr(1)}, B: struct {
B *uint `json:"b,omitempty"`
}{B: uptr(2)}},
},
{
2021-02-15 05:24:35 +03:00
name: "HeadUintPtrMultiFieldsNotRootString",
data: struct {
A struct {
A *uint `json:"a,string"`
}
B struct {
B *uint `json:"b,string"`
}
}{A: struct {
A *uint `json:"a,string"`
}{A: uptr(1)}, B: struct {
B *uint `json:"b,string"`
}{B: uptr(2)}},
},
2021-05-06 20:03:39 +03:00
{
name: "HeadUintPtrMultiFieldsNotRootStringOmitEmpty",
data: struct {
A struct {
A *uint `json:"a,string,omitempty"`
}
B struct {
B *uint `json:"b,string,omitempty"`
}
}{A: struct {
A *uint `json:"a,string,omitempty"`
}{A: uptr(1)}, B: struct {
B *uint `json:"b,string,omitempty"`
}{B: uptr(2)}},
},
// HeadUintPtrNilMultiFieldsNotRoot
{
2021-02-15 05:24:35 +03:00
name: "HeadUintPtrNilMultiFieldsNotRoot",
data: struct {
A struct {
A *uint `json:"a"`
}
B struct {
B *uint `json:"b"`
}
}{A: struct {
A *uint `json:"a"`
}{A: nil}, B: struct {
B *uint `json:"b"`
}{B: nil}},
},
{
2021-02-15 05:24:35 +03:00
name: "HeadUintPtrNilMultiFieldsNotRootOmitEmpty",
data: struct {
A struct {
A *uint `json:"a,omitempty"`
}
B struct {
B *uint `json:"b,omitempty"`
}
}{A: struct {
A *uint `json:"a,omitempty"`
}{A: nil}, B: struct {
B *uint `json:"b,omitempty"`
}{B: nil}},
},
{
2021-02-15 05:24:35 +03:00
name: "HeadUintPtrNilMultiFieldsNotRootString",
data: struct {
A struct {
A *uint `json:"a,string"`
}
B struct {
B *uint `json:"b,string"`
}
}{A: struct {
A *uint `json:"a,string"`
}{A: nil}, B: struct {
B *uint `json:"b,string"`
}{B: nil}},
},
2021-05-06 20:03:39 +03:00
{
name: "HeadUintPtrNilMultiFieldsNotRootStringOmitEmpty",
data: struct {
A struct {
A *uint `json:"a,string,omitempty"`
}
B struct {
B *uint `json:"b,string,omitempty"`
}
}{A: struct {
A *uint `json:"a,string,omitempty"`
}{A: nil}, B: struct {
B *uint `json:"b,string,omitempty"`
}{B: nil}},
},
// PtrHeadUintZeroMultiFieldsNotRoot
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintZeroMultiFieldsNotRoot",
data: &struct {
A struct {
A uint `json:"a"`
2021-01-16 16:16:26 +03:00
}
B struct {
B uint `json:"b"`
}
}{},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintZeroMultiFieldsNotRootOmitEmpty",
data: &struct {
A struct {
A uint `json:"a,omitempty"`
2021-01-16 16:16:26 +03:00
}
B struct {
B uint `json:"b,omitempty"`
}
}{},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintZeroMultiFieldsNotRootString",
data: &struct {
2021-01-16 16:16:26 +03:00
A struct {
A uint `json:"a,string"`
2021-01-16 16:16:26 +03:00
}
B struct {
B uint `json:"b,string"`
2021-01-16 16:16:26 +03:00
}
}{},
},
2021-05-06 20:03:39 +03:00
{
name: "PtrHeadUintZeroMultiFieldsNotRootStringOmitEmpty",
data: &struct {
A struct {
A uint `json:"a,string,omitempty"`
}
B struct {
B uint `json:"b,string,omitempty"`
}
}{},
},
// PtrHeadUintMultiFieldsNotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintMultiFieldsNotRoot",
data: &struct {
2021-01-16 16:16:26 +03:00
A struct {
A uint `json:"a"`
}
B struct {
B uint `json:"b"`
}
}{A: struct {
A uint `json:"a"`
}{A: 1}, B: struct {
B uint `json:"b"`
}{B: 2}},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintMultiFieldsNotRootOmitEmpty",
data: &struct {
2021-01-16 16:16:26 +03:00
A struct {
A uint `json:"a,omitempty"`
2021-01-16 16:16:26 +03:00
}
B struct {
B uint `json:"b,omitempty"`
2021-01-16 16:16:26 +03:00
}
}{A: struct {
A uint `json:"a,omitempty"`
}{A: 1}, B: struct {
B uint `json:"b,omitempty"`
}{B: 2}},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintMultiFieldsNotRootString",
data: &struct {
2021-01-16 16:16:26 +03:00
A struct {
A uint `json:"a,string"`
2021-01-16 16:16:26 +03:00
}
B struct {
B uint `json:"b,string"`
2021-01-16 16:16:26 +03:00
}
}{A: struct {
A uint `json:"a,string"`
}{A: 1}, B: struct {
B uint `json:"b,string"`
}{B: 2}},
2021-01-16 16:16:26 +03:00
},
2021-05-06 20:03:39 +03:00
{
name: "PtrHeadUintMultiFieldsNotRootStringOmitEmpty",
data: &struct {
A struct {
A uint `json:"a,string,omitempty"`
}
B struct {
B uint `json:"b,string,omitempty"`
}
}{A: struct {
A uint `json:"a,string,omitempty"`
}{A: 1}, B: struct {
B uint `json:"b,string,omitempty"`
}{B: 2}},
},
// PtrHeadUintPtrMultiFieldsNotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintPtrMultiFieldsNotRoot",
2021-01-16 16:16:26 +03:00
data: &struct {
A *struct {
A *uint `json:"a"`
2021-01-16 16:16:26 +03:00
}
B *struct {
B *uint `json:"b"`
2021-01-16 16:16:26 +03:00
}
}{A: &(struct {
A *uint `json:"a"`
}{A: uptr(1)}), B: &(struct {
B *uint `json:"b"`
}{B: uptr(2)})},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintPtrMultiFieldsNotRootOmitEmpty",
2021-01-16 16:16:26 +03:00
data: &struct {
A *struct {
A *uint `json:"a,omitempty"`
}
B *struct {
B *uint `json:"b,omitempty"`
}
}{A: &(struct {
A *uint `json:"a,omitempty"`
}{A: uptr(1)}), B: &(struct {
B *uint `json:"b,omitempty"`
}{B: uptr(2)})},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintPtrMultiFieldsNotRootString",
data: &struct {
A *struct {
A *uint `json:"a,string"`
}
B *struct {
B *uint `json:"b,string"`
}
}{A: &(struct {
A *uint `json:"a,string"`
}{A: uptr(1)}), B: &(struct {
B *uint `json:"b,string"`
}{B: uptr(2)})},
},
2021-05-06 20:03:39 +03:00
{
name: "PtrHeadUintPtrMultiFieldsNotRootStringOmitEmpty",
data: &struct {
A *struct {
A *uint `json:"a,string,omitempty"`
}
B *struct {
B *uint `json:"b,string,omitempty"`
}
}{A: &(struct {
A *uint `json:"a,string,omitempty"`
}{A: uptr(1)}), B: &(struct {
B *uint `json:"b,string,omitempty"`
}{B: uptr(2)})},
},
// PtrHeadUintPtrNilMultiFieldsNotRoot
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintPtrNilMultiFieldsNotRoot",
data: &struct {
A *struct {
A *uint `json:"a"`
}
B *struct {
B *uint `json:"b"`
}
}{A: nil, B: nil},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintPtrNilMultiFieldsNotRootOmitEmpty",
data: &struct {
A *struct {
A *uint `json:"a,omitempty"`
} `json:",omitempty"`
B *struct {
B *uint `json:"b,omitempty"`
} `json:",omitempty"`
}{A: nil, B: nil},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintPtrNilMultiFieldsNotRootString",
data: &struct {
A *struct {
A *uint `json:"a,string"`
} `json:",string"`
B *struct {
B *uint `json:"b,string"`
} `json:",string"`
}{A: nil, B: nil},
},
2021-05-06 20:03:39 +03:00
{
name: "PtrHeadUintPtrNilMultiFieldsNotRootStringOmitEmpty",
data: &struct {
A *struct {
A *uint `json:"a,string,omitempty"`
} `json:",string,omitempty"`
B *struct {
B *uint `json:"b,string,omitempty"`
} `json:",string,omitempty"`
}{A: nil, B: nil},
},
// PtrHeadUintNilMultiFieldsNotRoot
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintNilMultiFieldsNotRoot",
data: (*struct {
A *struct {
A *uint `json:"a"`
}
B *struct {
B *uint `json:"b"`
}
})(nil),
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintNilMultiFieldsNotRootOmitEmpty",
data: (*struct {
A *struct {
A *uint `json:"a,omitempty"`
}
B *struct {
B *uint `json:"b,omitempty"`
}
})(nil),
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintNilMultiFieldsNotRootString",
data: (*struct {
A *struct {
A *uint `json:"a,string"`
}
B *struct {
B *uint `json:"b,string"`
}
})(nil),
},
2021-05-06 20:03:39 +03:00
{
name: "PtrHeadUintNilMultiFieldsNotRootStringOmitEmpty",
data: (*struct {
A *struct {
A *uint `json:"a,string,omitempty"`
}
B *struct {
B *uint `json:"b,string,omitempty"`
}
})(nil),
},
// PtrHeadUintDoubleMultiFieldsNotRoot
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintDoubleMultiFieldsNotRoot",
data: &struct {
A *struct {
2021-01-16 16:16:26 +03:00
A uint `json:"a"`
B uint `json:"b"`
2021-01-16 16:16:26 +03:00
}
B *struct {
A uint `json:"a"`
2021-01-16 16:16:26 +03:00
B uint `json:"b"`
}
}{A: &(struct {
2021-01-16 16:16:26 +03:00
A uint `json:"a"`
B uint `json:"b"`
}{A: 1, B: 2}), B: &(struct {
A uint `json:"a"`
B uint `json:"b"`
}{A: 3, B: 4})},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintDoubleMultiFieldsNotRootOmitEmpty",
data: &struct {
A *struct {
A uint `json:"a,omitempty"`
B uint `json:"b,omitempty"`
}
B *struct {
A uint `json:"a,omitempty"`
B uint `json:"b,omitempty"`
}
}{A: &(struct {
A uint `json:"a,omitempty"`
B uint `json:"b,omitempty"`
}{A: 1, B: 2}), B: &(struct {
A uint `json:"a,omitempty"`
B uint `json:"b,omitempty"`
}{A: 3, B: 4})},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintDoubleMultiFieldsNotRootString",
2021-01-16 16:16:26 +03:00
data: &struct {
A *struct {
A uint `json:"a,string"`
B uint `json:"b,string"`
2021-01-16 16:16:26 +03:00
}
B *struct {
A uint `json:"a,string"`
B uint `json:"b,string"`
2021-01-16 16:16:26 +03:00
}
}{A: &(struct {
A uint `json:"a,string"`
B uint `json:"b,string"`
}{A: 1, B: 2}), B: &(struct {
A uint `json:"a,string"`
B uint `json:"b,string"`
}{A: 3, B: 4})},
2021-01-16 16:16:26 +03:00
},
2021-05-06 20:03:39 +03:00
{
name: "PtrHeadUintDoubleMultiFieldsNotRootStringOmitEmpty",
data: &struct {
A *struct {
A uint `json:"a,string,omitempty"`
B uint `json:"b,string,omitempty"`
}
B *struct {
A uint `json:"a,string,omitempty"`
B uint `json:"b,string,omitempty"`
}
}{A: &(struct {
A uint `json:"a,string,omitempty"`
B uint `json:"b,string,omitempty"`
}{A: 1, B: 2}), B: &(struct {
A uint `json:"a,string,omitempty"`
B uint `json:"b,string,omitempty"`
}{A: 3, B: 4})},
},
// PtrHeadUintNilDoubleMultiFieldsNotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintNilDoubleMultiFieldsNotRoot",
2021-01-16 16:16:26 +03:00
data: &struct {
A *struct {
A uint `json:"a"`
B uint `json:"b"`
2021-01-16 16:16:26 +03:00
}
B *struct {
A uint `json:"a"`
B uint `json:"b"`
2021-01-16 16:16:26 +03:00
}
}{A: nil, B: nil},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintNilDoubleMultiFieldsNotRootOmitEmpty",
data: &struct {
2021-01-16 16:16:26 +03:00
A *struct {
A uint `json:"a,omitempty"`
B uint `json:"b,omitempty"`
} `json:",omitempty"`
2021-01-16 16:16:26 +03:00
B *struct {
A uint `json:"a,omitempty"`
B uint `json:"b,omitempty"`
} `json:",omitempty"`
}{A: nil, B: nil},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintNilDoubleMultiFieldsNotRootString",
2021-01-16 16:16:26 +03:00
data: &struct {
A *struct {
A uint `json:"a,string"`
B uint `json:"b,string"`
2021-01-16 16:16:26 +03:00
}
B *struct {
A uint `json:"a,string"`
B uint `json:"b,string"`
2021-01-16 16:16:26 +03:00
}
}{A: nil, B: nil},
2021-01-16 16:16:26 +03:00
},
2021-05-06 20:03:39 +03:00
{
name: "PtrHeadUintNilDoubleMultiFieldsNotRootStringOmitEmpty",
data: &struct {
A *struct {
A uint `json:"a,string,omitempty"`
B uint `json:"b,string,omitempty"`
}
B *struct {
A uint `json:"a,string,omitempty"`
B uint `json:"b,string,omitempty"`
}
}{A: nil, B: nil},
},
// PtrHeadUintNilDoubleMultiFieldsNotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintNilDoubleMultiFieldsNotRoot",
data: (*struct {
2021-01-16 16:16:26 +03:00
A *struct {
A uint `json:"a"`
B uint `json:"b"`
}
B *struct {
A uint `json:"a"`
B uint `json:"b"`
}
})(nil),
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintNilDoubleMultiFieldsNotRootOmitEmpty",
2021-01-16 16:16:26 +03:00
data: (*struct {
A *struct {
A uint `json:"a,omitempty"`
B uint `json:"b,omitempty"`
2021-01-16 16:16:26 +03:00
}
B *struct {
A uint `json:"a,omitempty"`
B uint `json:"b,omitempty"`
}
})(nil),
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintNilDoubleMultiFieldsNotRootString",
data: (*struct {
A *struct {
A uint `json:"a,string"`
B uint `json:"b,string"`
}
B *struct {
A uint `json:"a,string"`
B uint `json:"b,string"`
2021-01-16 16:16:26 +03:00
}
})(nil),
},
2021-05-06 20:03:39 +03:00
{
name: "PtrHeadUintNilDoubleMultiFieldsNotRootStringOmitEmpty",
data: (*struct {
A *struct {
A uint `json:"a,string,omitempty"`
B uint `json:"b,string,omitempty"`
}
B *struct {
A uint `json:"a,string,omitempty"`
B uint `json:"b,string,omitempty"`
}
})(nil),
},
// PtrHeadUintPtrDoubleMultiFieldsNotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintPtrDoubleMultiFieldsNotRoot",
2021-01-16 16:16:26 +03:00
data: &struct {
A *struct {
A *uint `json:"a"`
B *uint `json:"b"`
}
B *struct {
A *uint `json:"a"`
B *uint `json:"b"`
}
}{A: &(struct {
A *uint `json:"a"`
B *uint `json:"b"`
}{A: uptr(1), B: uptr(2)}), B: &(struct {
A *uint `json:"a"`
B *uint `json:"b"`
}{A: uptr(3), B: uptr(4)})},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintPtrDoubleMultiFieldsNotRootOmitEmpty",
data: &struct {
A *struct {
A *uint `json:"a,omitempty"`
B *uint `json:"b,omitempty"`
}
B *struct {
A *uint `json:"a,omitempty"`
B *uint `json:"b,omitempty"`
}
}{A: &(struct {
A *uint `json:"a,omitempty"`
B *uint `json:"b,omitempty"`
}{A: uptr(1), B: uptr(2)}), B: &(struct {
A *uint `json:"a,omitempty"`
B *uint `json:"b,omitempty"`
}{A: uptr(3), B: uptr(4)})},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintPtrDoubleMultiFieldsNotRootString",
data: &struct {
A *struct {
A *uint `json:"a,string"`
B *uint `json:"b,string"`
}
B *struct {
A *uint `json:"a,string"`
B *uint `json:"b,string"`
}
}{A: &(struct {
A *uint `json:"a,string"`
B *uint `json:"b,string"`
}{A: uptr(1), B: uptr(2)}), B: &(struct {
A *uint `json:"a,string"`
B *uint `json:"b,string"`
}{A: uptr(3), B: uptr(4)})},
},
2021-05-06 20:03:39 +03:00
{
name: "PtrHeadUintPtrDoubleMultiFieldsNotRootStringOmitEmpty",
data: &struct {
A *struct {
A *uint `json:"a,string,omitempty"`
B *uint `json:"b,string,omitempty"`
}
B *struct {
A *uint `json:"a,string,omitempty"`
B *uint `json:"b,string,omitempty"`
}
}{A: &(struct {
A *uint `json:"a,string,omitempty"`
B *uint `json:"b,string,omitempty"`
}{A: uptr(1), B: uptr(2)}), B: &(struct {
A *uint `json:"a,string,omitempty"`
B *uint `json:"b,string,omitempty"`
}{A: uptr(3), B: uptr(4)})},
},
// PtrHeadUintPtrNilDoubleMultiFieldsNotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintPtrNilDoubleMultiFieldsNotRoot",
2021-01-16 16:16:26 +03:00
data: &struct {
A *struct {
A *uint `json:"a"`
B *uint `json:"b"`
}
B *struct {
A *uint `json:"a"`
B *uint `json:"b"`
}
}{A: nil, B: nil},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintPtrNilDoubleMultiFieldsNotRootOmitEmpty",
data: &struct {
A *struct {
A *uint `json:"a,omitempty"`
B *uint `json:"b,omitempty"`
} `json:",omitempty"`
B *struct {
A *uint `json:"a,omitempty"`
B *uint `json:"b,omitempty"`
} `json:",omitempty"`
}{A: nil, B: nil},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintPtrNilDoubleMultiFieldsNotRootString",
data: &struct {
A *struct {
A *uint `json:"a,string"`
B *uint `json:"b,string"`
}
B *struct {
A *uint `json:"a,string"`
B *uint `json:"b,string"`
}
}{A: nil, B: nil},
},
2021-05-06 20:03:39 +03:00
{
name: "PtrHeadUintPtrNilDoubleMultiFieldsNotRootStringOmitEmpty",
data: &struct {
A *struct {
A *uint `json:"a,string,omitempty"`
B *uint `json:"b,string,omitempty"`
}
B *struct {
A *uint `json:"a,string,omitempty"`
B *uint `json:"b,string,omitempty"`
}
}{A: nil, B: nil},
},
// PtrHeadUintPtrNilDoubleMultiFieldsNotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintPtrNilDoubleMultiFieldsNotRoot",
2021-01-16 16:16:26 +03:00
data: (*struct {
A *struct {
A *uint `json:"a"`
B *uint `json:"b"`
}
B *struct {
A *uint `json:"a"`
B *uint `json:"b"`
}
})(nil),
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintPtrNilDoubleMultiFieldsNotRootOmitEmpty",
data: (*struct {
A *struct {
A *uint `json:"a,omitempty"`
B *uint `json:"b,omitempty"`
}
B *struct {
A *uint `json:"a,omitempty"`
B *uint `json:"b,omitempty"`
}
})(nil),
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintPtrNilDoubleMultiFieldsNotRootString",
data: (*struct {
A *struct {
A *uint `json:"a,string"`
B *uint `json:"b,string"`
}
B *struct {
A *uint `json:"a,string"`
B *uint `json:"b,string"`
}
})(nil),
},
2021-05-06 20:03:39 +03:00
{
name: "PtrHeadUintPtrNilDoubleMultiFieldsNotRootStringOmitEmpty",
data: (*struct {
A *struct {
A *uint `json:"a,string,omitempty"`
B *uint `json:"b,string,omitempty"`
}
B *struct {
A *uint `json:"a,string,omitempty"`
B *uint `json:"b,string,omitempty"`
}
})(nil),
},
// AnonymousHeadUint
{
2021-02-15 05:24:35 +03:00
name: "AnonymousHeadUint",
data: struct {
structUint
B uint `json:"b"`
}{
structUint: structUint{A: 1},
B: 2,
},
},
{
2021-02-15 05:24:35 +03:00
name: "AnonymousHeadUintOmitEmpty",
data: struct {
structUintOmitEmpty
B uint `json:"b,omitempty"`
}{
structUintOmitEmpty: structUintOmitEmpty{A: 1},
B: 2,
},
},
{
2021-02-15 05:24:35 +03:00
name: "AnonymousHeadUintString",
data: struct {
structUintString
B uint `json:"b,string"`
}{
structUintString: structUintString{A: 1},
B: 2,
},
},
2021-05-06 20:03:39 +03:00
{
name: "AnonymousHeadUintStringOmitEmpty",
data: struct {
structUintStringOmitEmpty
B uint `json:"b,string,omitempty"`
}{
structUintStringOmitEmpty: structUintStringOmitEmpty{A: 1},
B: 2,
},
},
// PtrAnonymousHeadUint
{
2021-02-15 05:24:35 +03:00
name: "PtrAnonymousHeadUint",
data: struct {
*structUint
B uint `json:"b"`
}{
structUint: &structUint{A: 1},
B: 2,
},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrAnonymousHeadUintOmitEmpty",
data: struct {
*structUintOmitEmpty
B uint `json:"b,omitempty"`
}{
structUintOmitEmpty: &structUintOmitEmpty{A: 1},
B: 2,
},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrAnonymousHeadUintString",
data: struct {
*structUintString
B uint `json:"b,string"`
}{
structUintString: &structUintString{A: 1},
B: 2,
},
},
2021-05-06 20:03:39 +03:00
{
name: "PtrAnonymousHeadUintStringOmitEmpty",
data: struct {
*structUintStringOmitEmpty
B uint `json:"b,string,omitempty"`
}{
structUintStringOmitEmpty: &structUintStringOmitEmpty{A: 1},
B: 2,
},
},
// NilPtrAnonymousHeadUint
{
2021-02-15 05:24:35 +03:00
name: "NilPtrAnonymousHeadUint",
2021-01-16 16:16:26 +03:00
data: struct {
*structUint
2021-01-16 16:16:26 +03:00
B uint `json:"b"`
}{
structUint: nil,
2021-01-16 16:16:26 +03:00
B: 2,
},
},
{
2021-02-15 05:24:35 +03:00
name: "NilPtrAnonymousHeadUintOmitEmpty",
2021-01-16 16:16:26 +03:00
data: struct {
*structUintOmitEmpty
B uint `json:"b,omitempty"`
2021-01-16 16:16:26 +03:00
}{
structUintOmitEmpty: nil,
B: 2,
2021-01-16 16:16:26 +03:00
},
},
{
2021-02-15 05:24:35 +03:00
name: "NilPtrAnonymousHeadUintString",
2021-01-16 16:16:26 +03:00
data: struct {
*structUintString
B uint `json:"b,string"`
2021-01-16 16:16:26 +03:00
}{
structUintString: nil,
B: 2,
2021-01-16 16:16:26 +03:00
},
},
2021-05-06 20:03:39 +03:00
{
name: "NilPtrAnonymousHeadUintStringOmitEmpty",
data: struct {
*structUintStringOmitEmpty
B uint `json:"b,string,omitempty"`
}{
structUintStringOmitEmpty: nil,
B: 2,
},
},
// AnonymousHeadUintPtr
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:24:35 +03:00
name: "AnonymousHeadUintPtr",
2021-01-16 16:16:26 +03:00
data: struct {
structUintPtr
B *uint `json:"b"`
}{
structUintPtr: structUintPtr{A: uptr(1)},
B: uptr(2),
},
},
{
2021-02-15 05:24:35 +03:00
name: "AnonymousHeadUintPtrOmitEmpty",
data: struct {
structUintPtrOmitEmpty
B *uint `json:"b,omitempty"`
}{
structUintPtrOmitEmpty: structUintPtrOmitEmpty{A: uptr(1)},
B: uptr(2),
},
},
{
2021-02-15 05:24:35 +03:00
name: "AnonymousHeadUintPtrString",
data: struct {
structUintPtrString
B *uint `json:"b,string"`
}{
structUintPtrString: structUintPtrString{A: uptr(1)},
B: uptr(2),
},
},
2021-05-06 20:03:39 +03:00
{
name: "AnonymousHeadUintPtrStringOmitEmpty",
data: struct {
structUintPtrStringOmitEmpty
B *uint `json:"b,string,omitempty"`
}{
structUintPtrStringOmitEmpty: structUintPtrStringOmitEmpty{A: uptr(1)},
B: uptr(2),
},
},
// AnonymousHeadUintPtrNil
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:24:35 +03:00
name: "AnonymousHeadUintPtrNil",
2021-01-16 16:16:26 +03:00
data: struct {
structUintPtr
B *uint `json:"b"`
}{
structUintPtr: structUintPtr{A: nil},
B: uptr(2),
},
},
{
2021-02-15 05:24:35 +03:00
name: "AnonymousHeadUintPtrNilOmitEmpty",
data: struct {
structUintPtrOmitEmpty
B *uint `json:"b,omitempty"`
}{
structUintPtrOmitEmpty: structUintPtrOmitEmpty{A: nil},
B: uptr(2),
},
},
{
2021-02-15 05:24:35 +03:00
name: "AnonymousHeadUintPtrNilString",
data: struct {
structUintPtrString
B *uint `json:"b,string"`
}{
structUintPtrString: structUintPtrString{A: nil},
B: uptr(2),
},
},
2021-05-06 20:03:39 +03:00
{
name: "AnonymousHeadUintPtrNilStringOmitEmpty",
data: struct {
structUintPtrStringOmitEmpty
B *uint `json:"b,string,omitempty"`
}{
structUintPtrStringOmitEmpty: structUintPtrStringOmitEmpty{A: nil},
B: uptr(2),
},
},
// PtrAnonymousHeadUintPtr
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:24:35 +03:00
name: "PtrAnonymousHeadUintPtr",
2021-01-16 16:16:26 +03:00
data: struct {
*structUintPtr
B *uint `json:"b"`
}{
structUintPtr: &structUintPtr{A: uptr(1)},
B: uptr(2),
},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrAnonymousHeadUintPtrOmitEmpty",
data: struct {
*structUintPtrOmitEmpty
B *uint `json:"b,omitempty"`
}{
structUintPtrOmitEmpty: &structUintPtrOmitEmpty{A: uptr(1)},
B: uptr(2),
},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrAnonymousHeadUintPtrString",
data: struct {
*structUintPtrString
B *uint `json:"b,string"`
}{
structUintPtrString: &structUintPtrString{A: uptr(1)},
B: uptr(2),
},
},
2021-05-06 20:03:39 +03:00
{
name: "PtrAnonymousHeadUintPtrStringOmitEmpty",
data: struct {
*structUintPtrStringOmitEmpty
B *uint `json:"b,string,omitempty"`
}{
structUintPtrStringOmitEmpty: &structUintPtrStringOmitEmpty{A: uptr(1)},
B: uptr(2),
},
},
// NilPtrAnonymousHeadUintPtr
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:24:35 +03:00
name: "NilPtrAnonymousHeadUintPtr",
2021-01-16 16:16:26 +03:00
data: struct {
*structUintPtr
B *uint `json:"b"`
}{
structUintPtr: nil,
B: uptr(2),
},
},
{
2021-02-15 05:24:35 +03:00
name: "NilPtrAnonymousHeadUintPtrOmitEmpty",
data: struct {
*structUintPtrOmitEmpty
B *uint `json:"b,omitempty"`
}{
structUintPtrOmitEmpty: nil,
B: uptr(2),
},
},
{
2021-02-15 05:24:35 +03:00
name: "NilPtrAnonymousHeadUintPtrString",
data: struct {
*structUintPtrString
B *uint `json:"b,string"`
}{
structUintPtrString: nil,
B: uptr(2),
},
},
2021-05-06 20:03:39 +03:00
{
name: "NilPtrAnonymousHeadUintPtrStringOmitEmpty",
data: struct {
*structUintPtrStringOmitEmpty
B *uint `json:"b,string,omitempty"`
}{
structUintPtrStringOmitEmpty: nil,
B: uptr(2),
},
},
// AnonymousHeadUintOnly
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:24:35 +03:00
name: "AnonymousHeadUintOnly",
2021-01-16 16:16:26 +03:00
data: struct {
structUint
}{
structUint: structUint{A: 1},
},
},
{
2021-02-15 05:24:35 +03:00
name: "AnonymousHeadUintOnlyOmitEmpty",
data: struct {
structUintOmitEmpty
}{
structUintOmitEmpty: structUintOmitEmpty{A: 1},
},
},
{
2021-02-15 05:24:35 +03:00
name: "AnonymousHeadUintOnlyString",
data: struct {
structUintString
}{
structUintString: structUintString{A: 1},
},
},
2021-05-06 20:03:39 +03:00
{
name: "AnonymousHeadUintOnlyStringOmitEmpty",
data: struct {
structUintStringOmitEmpty
}{
structUintStringOmitEmpty: structUintStringOmitEmpty{A: 1},
},
},
// PtrAnonymousHeadUintOnly
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:24:35 +03:00
name: "PtrAnonymousHeadUintOnly",
2021-01-16 16:16:26 +03:00
data: struct {
*structUint
}{
structUint: &structUint{A: 1},
},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrAnonymousHeadUintOnlyOmitEmpty",
data: struct {
*structUintOmitEmpty
}{
structUintOmitEmpty: &structUintOmitEmpty{A: 1},
},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrAnonymousHeadUintOnlyString",
data: struct {
*structUintString
}{
structUintString: &structUintString{A: 1},
},
},
2021-05-06 20:03:39 +03:00
{
name: "PtrAnonymousHeadUintOnlyStringOmitEmpty",
data: struct {
*structUintStringOmitEmpty
}{
structUintStringOmitEmpty: &structUintStringOmitEmpty{A: 1},
},
},
// NilPtrAnonymousHeadUintOnly
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:24:35 +03:00
name: "NilPtrAnonymousHeadUintOnly",
2021-01-16 16:16:26 +03:00
data: struct {
*structUint
}{
structUint: nil,
},
},
{
2021-02-15 05:24:35 +03:00
name: "NilPtrAnonymousHeadUintOnlyOmitEmpty",
data: struct {
*structUintOmitEmpty
}{
structUintOmitEmpty: nil,
},
},
{
2021-02-15 05:24:35 +03:00
name: "NilPtrAnonymousHeadUintOnlyString",
data: struct {
*structUintString
}{
structUintString: nil,
},
},
2021-05-06 20:03:39 +03:00
{
name: "NilPtrAnonymousHeadUintOnlyStringOmitEmpty",
data: struct {
*structUintStringOmitEmpty
}{
structUintStringOmitEmpty: nil,
},
},
// AnonymousHeadUintPtrOnly
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:24:35 +03:00
name: "AnonymousHeadUintPtrOnly",
2021-01-16 16:16:26 +03:00
data: struct {
structUintPtr
}{
structUintPtr: structUintPtr{A: uptr(1)},
},
},
{
2021-02-15 05:24:35 +03:00
name: "AnonymousHeadUintPtrOnlyOmitEmpty",
data: struct {
structUintPtrOmitEmpty
}{
structUintPtrOmitEmpty: structUintPtrOmitEmpty{A: uptr(1)},
},
},
{
2021-02-15 05:24:35 +03:00
name: "AnonymousHeadUintPtrOnlyString",
data: struct {
structUintPtrString
}{
structUintPtrString: structUintPtrString{A: uptr(1)},
},
},
2021-05-06 20:03:39 +03:00
{
name: "AnonymousHeadUintPtrOnlyStringOmitEmpty",
data: struct {
structUintPtrStringOmitEmpty
}{
structUintPtrStringOmitEmpty: structUintPtrStringOmitEmpty{A: uptr(1)},
},
},
// AnonymousHeadUintPtrNilOnly
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:24:35 +03:00
name: "AnonymousHeadUintPtrNilOnly",
2021-01-16 16:16:26 +03:00
data: struct {
structUintPtr
}{
structUintPtr: structUintPtr{A: nil},
},
},
{
2021-02-15 05:24:35 +03:00
name: "AnonymousHeadUintPtrNilOnlyOmitEmpty",
data: struct {
structUintPtrOmitEmpty
}{
structUintPtrOmitEmpty: structUintPtrOmitEmpty{A: nil},
},
},
{
2021-02-15 05:24:35 +03:00
name: "AnonymousHeadUintPtrNilOnlyString",
data: struct {
structUintPtrString
}{
structUintPtrString: structUintPtrString{A: nil},
},
},
2021-05-06 20:03:39 +03:00
{
name: "AnonymousHeadUintPtrNilOnlyStringOmitEmpty",
data: struct {
structUintPtrStringOmitEmpty
}{
structUintPtrStringOmitEmpty: structUintPtrStringOmitEmpty{A: nil},
},
},
// PtrAnonymousHeadUintPtrOnly
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:24:35 +03:00
name: "PtrAnonymousHeadUintPtrOnly",
2021-01-16 16:16:26 +03:00
data: struct {
*structUintPtr
}{
structUintPtr: &structUintPtr{A: uptr(1)},
},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrAnonymousHeadUintPtrOnlyOmitEmpty",
data: struct {
*structUintPtrOmitEmpty
}{
structUintPtrOmitEmpty: &structUintPtrOmitEmpty{A: uptr(1)},
},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrAnonymousHeadUintPtrOnlyString",
data: struct {
*structUintPtrString
}{
structUintPtrString: &structUintPtrString{A: uptr(1)},
},
},
2021-05-06 20:03:39 +03:00
{
name: "PtrAnonymousHeadUintPtrOnlyStringOmitEmpty",
data: struct {
*structUintPtrStringOmitEmpty
}{
structUintPtrStringOmitEmpty: &structUintPtrStringOmitEmpty{A: uptr(1)},
},
},
// NilPtrAnonymousHeadUintPtrOnly
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:24:35 +03:00
name: "NilPtrAnonymousHeadUintPtrOnly",
2021-01-16 16:16:26 +03:00
data: struct {
*structUintPtr
}{
structUintPtr: nil,
},
},
{
2021-02-15 05:24:35 +03:00
name: "NilPtrAnonymousHeadUintPtrOnlyOmitEmpty",
data: struct {
*structUintPtrOmitEmpty
}{
structUintPtrOmitEmpty: nil,
},
},
{
2021-02-15 05:24:35 +03:00
name: "NilPtrAnonymousHeadUintPtrOnlyString",
data: struct {
*structUintPtrString
}{
structUintPtrString: nil,
},
},
2021-05-06 20:03:39 +03:00
{
name: "NilPtrAnonymousHeadUintPtrOnlyStringOmitEmpty",
data: struct {
*structUintPtrStringOmitEmpty
}{
structUintPtrStringOmitEmpty: nil,
},
},
2021-01-16 16:16:26 +03:00
}
for _, test := range tests {
for _, indent := range []bool{true, false} {
for _, htmlEscape := range []bool{true, false} {
var buf bytes.Buffer
enc := json.NewEncoder(&buf)
enc.SetEscapeHTML(htmlEscape)
if indent {
enc.SetIndent("", " ")
}
if err := enc.Encode(test.data); err != nil {
2021-02-15 05:24:35 +03:00
t.Fatalf("%s(htmlEscape:%T): %+v: %s", test.name, htmlEscape, 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:%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
}
}
}
}