go-json/cover_uint64_test.go

1787 lines
35 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 TestCoverUint64(t *testing.T) {
type structUint64 struct {
A uint64 `json:"a"`
}
type structUint64OmitEmpty struct {
A uint64 `json:"a,omitempty"`
}
type structUint64String struct {
A uint64 `json:"a,string"`
}
2021-01-16 16:16:26 +03:00
type structUint64Ptr struct {
A *uint64 `json:"a"`
}
type structUint64PtrOmitEmpty struct {
A *uint64 `json:"a,omitempty"`
}
type structUint64PtrString struct {
A *uint64 `json:"a,string"`
}
2021-01-16 16:16:26 +03:00
tests := []struct {
2021-02-15 05:28:09 +03:00
name string
data interface{}
2021-01-16 16:16:26 +03:00
}{
// HeadUint64Zero
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:28:09 +03:00
name: "HeadUint64Zero",
2021-01-16 16:16:26 +03:00
data: struct {
A uint64 `json:"a"`
}{},
},
{
2021-02-15 05:28:09 +03:00
name: "HeadUint64ZeroOmitEmpty",
data: struct {
A uint64 `json:"a,omitempty"`
}{},
},
{
2021-02-15 05:28:09 +03:00
name: "HeadUint64ZeroString",
data: struct {
A uint64 `json:"a,string"`
}{},
},
// HeadUint64
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:28:09 +03:00
name: "HeadUint64",
2021-01-16 16:16:26 +03:00
data: struct {
A uint64 `json:"a"`
}{A: 1},
},
{
2021-02-15 05:28:09 +03:00
name: "HeadUint64OmitEmpty",
data: struct {
A uint64 `json:"a,omitempty"`
}{A: 1},
},
{
2021-02-15 05:28:09 +03:00
name: "HeadUint64String",
data: struct {
A uint64 `json:"a,string"`
}{A: 1},
},
// HeadUint64Ptr
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:28:09 +03:00
name: "HeadUint64Ptr",
2021-01-16 16:16:26 +03:00
data: struct {
A *uint64 `json:"a"`
}{A: uint64ptr(1)},
},
{
2021-02-15 05:28:09 +03:00
name: "HeadUint64PtrOmitEmpty",
data: struct {
A *uint64 `json:"a,omitempty"`
}{A: uint64ptr(1)},
},
{
2021-02-15 05:28:09 +03:00
name: "HeadUint64PtrString",
data: struct {
A *uint64 `json:"a,string"`
}{A: uint64ptr(1)},
},
// HeadUint64PtrNil
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:28:09 +03:00
name: "HeadUint64PtrNil",
2021-01-16 16:16:26 +03:00
data: struct {
A *uint64 `json:"a"`
}{A: nil},
},
{
2021-02-15 05:28:09 +03:00
name: "HeadUint64PtrNilOmitEmpty",
data: struct {
A *uint64 `json:"a,omitempty"`
}{A: nil},
},
{
2021-02-15 05:28:09 +03:00
name: "HeadUint64PtrNilString",
data: struct {
A *uint64 `json:"a,string"`
}{A: nil},
},
// PtrHeadUint64Zero
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64Zero",
2021-01-16 16:16:26 +03:00
data: &struct {
A uint64 `json:"a"`
}{},
},
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64ZeroOmitEmpty",
data: &struct {
A uint64 `json:"a,omitempty"`
}{},
},
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64ZeroString",
data: &struct {
A uint64 `json:"a,string"`
}{},
},
// PtrHeadUint64
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64",
2021-01-16 16:16:26 +03:00
data: &struct {
A uint64 `json:"a"`
}{A: 1},
},
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64OmitEmpty",
data: &struct {
A uint64 `json:"a,omitempty"`
}{A: 1},
},
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64String",
data: &struct {
A uint64 `json:"a,string"`
}{A: 1},
},
// PtrHeadUint64Ptr
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64Ptr",
2021-01-16 16:16:26 +03:00
data: &struct {
A *uint64 `json:"a"`
}{A: uint64ptr(1)},
},
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64PtrOmitEmpty",
data: &struct {
A *uint64 `json:"a,omitempty"`
}{A: uint64ptr(1)},
},
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64PtrString",
data: &struct {
A *uint64 `json:"a,string"`
}{A: uint64ptr(1)},
},
// PtrHeadUint64PtrNil
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64PtrNil",
2021-01-16 16:16:26 +03:00
data: &struct {
A *uint64 `json:"a"`
}{A: nil},
},
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64PtrNilOmitEmpty",
data: &struct {
A *uint64 `json:"a,omitempty"`
}{A: nil},
},
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64PtrNilString",
data: &struct {
A *uint64 `json:"a,string"`
}{A: nil},
},
// PtrHeadUint64Nil
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64Nil",
2021-01-16 16:16:26 +03:00
data: (*struct {
A *uint64 `json:"a"`
})(nil),
},
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64NilOmitEmpty",
data: (*struct {
A *uint64 `json:"a,omitempty"`
})(nil),
},
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64NilString",
data: (*struct {
A *uint64 `json:"a,string"`
})(nil),
},
// HeadUint64ZeroMultiFields
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:28:09 +03:00
name: "HeadUint64ZeroMultiFields",
2021-01-16 16:16:26 +03:00
data: struct {
A uint64 `json:"a"`
B uint64 `json:"b"`
2021-02-15 05:28:09 +03:00
C uint64 `json:"c"`
2021-01-16 16:16:26 +03:00
}{},
},
{
2021-02-15 05:28:09 +03:00
name: "HeadUint64ZeroMultiFieldsOmitEmpty",
data: struct {
A uint64 `json:"a,omitempty"`
B uint64 `json:"b,omitempty"`
2021-02-15 05:28:09 +03:00
C uint64 `json:"c,omitempty"`
}{},
},
{
2021-02-15 05:28:09 +03:00
name: "HeadUint64ZeroMultiFields",
data: struct {
A uint64 `json:"a,string"`
B uint64 `json:"b,string"`
2021-02-15 05:28:09 +03:00
C uint64 `json:"c,string"`
}{},
},
// HeadUint64MultiFields
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:28:09 +03:00
name: "HeadUint64MultiFields",
2021-01-16 16:16:26 +03:00
data: struct {
A uint64 `json:"a"`
B uint64 `json:"b"`
2021-02-15 05:28:09 +03:00
C uint64 `json:"c"`
}{A: 1, B: 2, C: 3},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:28:09 +03:00
name: "HeadUint64MultiFieldsOmitEmpty",
2021-01-16 16:16:26 +03:00
data: struct {
A uint64 `json:"a,omitempty"`
B uint64 `json:"b,omitempty"`
2021-02-15 05:28:09 +03:00
C uint64 `json:"c,omitempty"`
}{A: 1, B: 2, C: 3},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:28:09 +03:00
name: "HeadUint64MultiFieldsString",
2021-01-16 16:16:26 +03:00
data: struct {
A uint64 `json:"a,string"`
B uint64 `json:"b,string"`
2021-02-15 05:28:09 +03:00
C uint64 `json:"c,string"`
}{A: 1, B: 2, C: 3},
2021-01-16 16:16:26 +03:00
},
// HeadUint64PtrMultiFields
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:28:09 +03:00
name: "HeadUint64PtrMultiFields",
data: struct {
A *uint64 `json:"a"`
B *uint64 `json:"b"`
2021-02-15 05:28:09 +03:00
C *uint64 `json:"c"`
}{A: uint64ptr(1), B: uint64ptr(2), C: uint64ptr(3)},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:28:09 +03:00
name: "HeadUint64PtrMultiFieldsOmitEmpty",
data: struct {
A *uint64 `json:"a,omitempty"`
B *uint64 `json:"b,omitempty"`
2021-02-15 05:28:09 +03:00
C *uint64 `json:"c,omitempty"`
}{A: uint64ptr(1), B: uint64ptr(2), C: uint64ptr(3)},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:28:09 +03:00
name: "HeadUint64PtrMultiFieldsString",
data: struct {
A *uint64 `json:"a,string"`
B *uint64 `json:"b,string"`
2021-02-15 05:28:09 +03:00
C *uint64 `json:"c,string"`
}{A: uint64ptr(1), B: uint64ptr(2), C: uint64ptr(3)},
2021-01-16 16:16:26 +03:00
},
// HeadUint64PtrNilMultiFields
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:28:09 +03:00
name: "HeadUint64PtrNilMultiFields",
data: struct {
2021-01-16 16:16:26 +03:00
A *uint64 `json:"a"`
B *uint64 `json:"b"`
2021-02-15 05:28:09 +03:00
C *uint64 `json:"c"`
}{A: nil, B: nil, C: nil},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:28:09 +03:00
name: "HeadUint64PtrNilMultiFieldsOmitEmpty",
data: struct {
A *uint64 `json:"a,omitempty"`
B *uint64 `json:"b,omitempty"`
2021-02-15 05:28:09 +03:00
C *uint64 `json:"c,omitempty"`
}{A: nil, B: nil, C: nil},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:28:09 +03:00
name: "HeadUint64PtrNilMultiFieldsString",
data: struct {
A *uint64 `json:"a,string"`
B *uint64 `json:"b,string"`
2021-02-15 05:28:09 +03:00
C *uint64 `json:"c,string"`
}{A: nil, B: nil, C: nil},
},
// PtrHeadUint64ZeroMultiFields
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64ZeroMultiFields",
data: &struct {
A uint64 `json:"a"`
B uint64 `json:"b"`
}{},
},
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64ZeroMultiFieldsOmitEmpty",
data: &struct {
A uint64 `json:"a,omitempty"`
B uint64 `json:"b,omitempty"`
}{},
},
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64ZeroMultiFieldsString",
data: &struct {
A uint64 `json:"a,string"`
B uint64 `json:"b,string"`
}{},
},
// PtrHeadUint64MultiFields
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64MultiFields",
data: &struct {
A uint64 `json:"a"`
B uint64 `json:"b"`
}{A: 1, B: 2},
},
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64MultiFieldsOmitEmpty",
data: &struct {
A uint64 `json:"a,omitempty"`
B uint64 `json:"b,omitempty"`
}{A: 1, B: 2},
},
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64MultiFieldsString",
data: &struct {
A uint64 `json:"a,string"`
B uint64 `json:"b,string"`
}{A: 1, B: 2},
},
// PtrHeadUint64PtrMultiFields
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64PtrMultiFields",
data: &struct {
A *uint64 `json:"a"`
B *uint64 `json:"b"`
}{A: uint64ptr(1), B: uint64ptr(2)},
},
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64PtrMultiFieldsOmitEmpty",
data: &struct {
A *uint64 `json:"a,omitempty"`
B *uint64 `json:"b,omitempty"`
}{A: uint64ptr(1), B: uint64ptr(2)},
},
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64PtrMultiFieldsString",
data: &struct {
A *uint64 `json:"a,string"`
B *uint64 `json:"b,string"`
}{A: uint64ptr(1), B: uint64ptr(2)},
},
// PtrHeadUint64PtrNilMultiFields
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64PtrNilMultiFields",
data: &struct {
A *uint64 `json:"a"`
B *uint64 `json:"b"`
}{A: nil, B: nil},
},
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64PtrNilMultiFieldsOmitEmpty",
data: &struct {
A *uint64 `json:"a,omitempty"`
B *uint64 `json:"b,omitempty"`
}{A: nil, B: nil},
},
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64PtrNilMultiFieldsString",
data: &struct {
A *uint64 `json:"a,string"`
B *uint64 `json:"b,string"`
}{A: nil, B: nil},
},
// PtrHeadUint64NilMultiFields
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64NilMultiFields",
data: (*struct {
A *uint64 `json:"a"`
B *uint64 `json:"b"`
})(nil),
},
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64NilMultiFieldsOmitEmpty",
data: (*struct {
A *uint64 `json:"a,omitempty"`
B *uint64 `json:"b,omitempty"`
})(nil),
},
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64NilMultiFieldsString",
data: (*struct {
A *uint64 `json:"a,string"`
B *uint64 `json:"b,string"`
})(nil),
},
// HeadUint64ZeroNotRoot
{
2021-02-15 05:28:09 +03:00
name: "HeadUint64ZeroNotRoot",
2021-01-16 16:16:26 +03:00
data: struct {
A struct {
A uint64 `json:"a"`
}
}{},
},
{
2021-02-15 05:28:09 +03:00
name: "HeadUint64ZeroNotRootOmitEmpty",
data: struct {
A struct {
A uint64 `json:"a,omitempty"`
}
}{},
},
{
2021-02-15 05:28:09 +03:00
name: "HeadUint64ZeroNotRootString",
data: struct {
A struct {
A uint64 `json:"a,string"`
}
}{},
},
// HeadUint64NotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:28:09 +03:00
name: "HeadUint64NotRoot",
2021-01-16 16:16:26 +03:00
data: struct {
A struct {
A uint64 `json:"a"`
}
}{A: struct {
A uint64 `json:"a"`
}{A: 1}},
},
{
2021-02-15 05:28:09 +03:00
name: "HeadUint64NotRootOmitEmpty",
2021-01-16 16:16:26 +03:00
data: struct {
A struct {
A uint64 `json:"a,omitempty"`
2021-01-16 16:16:26 +03:00
}
}{A: struct {
A uint64 `json:"a,omitempty"`
}{A: 1}},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:28:09 +03:00
name: "HeadUint64NotRootString",
2021-01-16 16:16:26 +03:00
data: struct {
A struct {
A uint64 `json:"a,string"`
2021-01-16 16:16:26 +03:00
}
}{A: struct {
A uint64 `json:"a,string"`
}{A: 1}},
2021-01-16 16:16:26 +03:00
},
// HeadUint64PtrNotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:28:09 +03:00
name: "HeadUint64PtrNotRoot",
2021-01-16 16:16:26 +03:00
data: struct {
A struct {
A *uint64 `json:"a"`
2021-01-16 16:16:26 +03:00
}
}{A: struct {
A *uint64 `json:"a"`
}{uint64ptr(1)}},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:28:09 +03:00
name: "HeadUint64PtrNotRootOmitEmpty",
2021-01-16 16:16:26 +03:00
data: struct {
A struct {
A *uint64 `json:"a,omitempty"`
2021-01-16 16:16:26 +03:00
}
}{A: struct {
A *uint64 `json:"a,omitempty"`
}{uint64ptr(1)}},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:28:09 +03:00
name: "HeadUint64PtrNotRootString",
2021-01-16 16:16:26 +03:00
data: struct {
A struct {
A *uint64 `json:"a,string"`
2021-01-16 16:16:26 +03:00
}
}{A: struct {
A *uint64 `json:"a,string"`
}{uint64ptr(1)}},
2021-01-16 16:16:26 +03:00
},
// HeadUint64PtrNilNotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:28:09 +03:00
name: "HeadUint64PtrNilNotRoot",
data: struct {
A struct {
A *uint64 `json:"a"`
}
}{},
},
{
2021-02-15 05:28:09 +03:00
name: "HeadUint64PtrNilNotRootOmitEmpty",
data: struct {
A struct {
A *uint64 `json:"a,omitempty"`
}
}{},
},
{
2021-02-15 05:28:09 +03:00
name: "HeadUint64PtrNilNotRootString",
data: struct {
A struct {
A *uint64 `json:"a,string"`
}
}{},
},
// PtrHeadUint64ZeroNotRoot
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64ZeroNotRoot",
data: struct {
A *struct {
A uint64 `json:"a"`
}
}{A: new(struct {
A uint64 `json:"a"`
})},
},
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64ZeroNotRootOmitEmpty",
data: struct {
A *struct {
A uint64 `json:"a,omitempty"`
}
}{A: new(struct {
A uint64 `json:"a,omitempty"`
})},
},
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64ZeroNotRootString",
data: struct {
A *struct {
A uint64 `json:"a,string"`
}
}{A: new(struct {
A uint64 `json:"a,string"`
})},
},
// PtrHeadUint64NotRoot
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64NotRoot",
data: struct {
A *struct {
A uint64 `json:"a"`
}
}{A: &(struct {
A uint64 `json:"a"`
}{A: 1})},
},
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64NotRootOmitEmpty",
data: struct {
A *struct {
A uint64 `json:"a,omitempty"`
}
}{A: &(struct {
A uint64 `json:"a,omitempty"`
}{A: 1})},
},
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64NotRootString",
data: struct {
A *struct {
A uint64 `json:"a,string"`
}
}{A: &(struct {
A uint64 `json:"a,string"`
}{A: 1})},
},
// PtrHeadUint64PtrNotRoot
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64PtrNotRoot",
data: struct {
A *struct {
A *uint64 `json:"a"`
}
}{A: &(struct {
A *uint64 `json:"a"`
}{A: uint64ptr(1)})},
},
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64PtrNotRootOmitEmpty",
data: struct {
A *struct {
A *uint64 `json:"a,omitempty"`
}
}{A: &(struct {
A *uint64 `json:"a,omitempty"`
}{A: uint64ptr(1)})},
},
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64PtrNotRootString",
data: struct {
A *struct {
A *uint64 `json:"a,string"`
}
}{A: &(struct {
A *uint64 `json:"a,string"`
}{A: uint64ptr(1)})},
},
// PtrHeadUint64PtrNilNotRoot
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64PtrNilNotRoot",
data: struct {
A *struct {
A *uint64 `json:"a"`
}
}{A: &(struct {
A *uint64 `json:"a"`
}{A: nil})},
},
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64PtrNilNotRootOmitEmpty",
data: struct {
A *struct {
A *uint64 `json:"a,omitempty"`
}
}{A: &(struct {
A *uint64 `json:"a,omitempty"`
}{A: nil})},
},
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64PtrNilNotRootString",
data: struct {
A *struct {
A *uint64 `json:"a,string"`
}
}{A: &(struct {
A *uint64 `json:"a,string"`
}{A: nil})},
},
// PtrHeadUint64NilNotRoot
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64NilNotRoot",
data: struct {
A *struct {
A *uint64 `json:"a"`
}
}{A: nil},
},
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64NilNotRootOmitEmpty",
data: struct {
A *struct {
A *uint64 `json:"a,omitempty"`
} `json:",omitempty"`
}{A: nil},
},
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64NilNotRootString",
data: struct {
A *struct {
A *uint64 `json:"a,string"`
} `json:",string"`
}{A: nil},
},
// HeadUint64ZeroMultiFieldsNotRoot
{
2021-02-15 05:28:09 +03:00
name: "HeadUint64ZeroMultiFieldsNotRoot",
data: struct {
A struct {
A uint64 `json:"a"`
}
B struct {
B uint64 `json:"b"`
}
}{},
},
{
2021-02-15 05:28:09 +03:00
name: "HeadUint64ZeroMultiFieldsNotRootOmitEmpty",
data: struct {
A struct {
A uint64 `json:"a,omitempty"`
}
B struct {
B uint64 `json:"b,omitempty"`
}
}{},
},
{
2021-02-15 05:28:09 +03:00
name: "HeadUint64ZeroMultiFieldsNotRootString",
data: struct {
A struct {
A uint64 `json:"a,string"`
}
B struct {
B uint64 `json:"b,string"`
}
}{},
},
// HeadUint64MultiFieldsNotRoot
{
2021-02-15 05:28:09 +03:00
name: "HeadUint64MultiFieldsNotRoot",
data: struct {
A struct {
A uint64 `json:"a"`
}
B struct {
B uint64 `json:"b"`
}
}{A: struct {
A uint64 `json:"a"`
}{A: 1}, B: struct {
B uint64 `json:"b"`
}{B: 2}},
},
{
2021-02-15 05:28:09 +03:00
name: "HeadUint64MultiFieldsNotRootOmitEmpty",
data: struct {
A struct {
A uint64 `json:"a,omitempty"`
}
B struct {
B uint64 `json:"b,omitempty"`
}
}{A: struct {
A uint64 `json:"a,omitempty"`
}{A: 1}, B: struct {
B uint64 `json:"b,omitempty"`
}{B: 2}},
},
{
2021-02-15 05:28:09 +03:00
name: "HeadUint64MultiFieldsNotRootString",
data: struct {
A struct {
A uint64 `json:"a,string"`
}
B struct {
B uint64 `json:"b,string"`
}
}{A: struct {
A uint64 `json:"a,string"`
}{A: 1}, B: struct {
B uint64 `json:"b,string"`
}{B: 2}},
},
// HeadUint64PtrMultiFieldsNotRoot
{
2021-02-15 05:28:09 +03:00
name: "HeadUint64PtrMultiFieldsNotRoot",
data: struct {
A struct {
A *uint64 `json:"a"`
}
B struct {
B *uint64 `json:"b"`
}
}{A: struct {
A *uint64 `json:"a"`
}{A: uint64ptr(1)}, B: struct {
B *uint64 `json:"b"`
}{B: uint64ptr(2)}},
},
{
2021-02-15 05:28:09 +03:00
name: "HeadUint64PtrMultiFieldsNotRootOmitEmpty",
data: struct {
A struct {
A *uint64 `json:"a,omitempty"`
}
B struct {
B *uint64 `json:"b,omitempty"`
}
}{A: struct {
A *uint64 `json:"a,omitempty"`
}{A: uint64ptr(1)}, B: struct {
B *uint64 `json:"b,omitempty"`
}{B: uint64ptr(2)}},
},
{
2021-02-15 05:28:09 +03:00
name: "HeadUint64PtrMultiFieldsNotRootString",
data: struct {
A struct {
A *uint64 `json:"a,string"`
}
B struct {
B *uint64 `json:"b,string"`
}
}{A: struct {
A *uint64 `json:"a,string"`
}{A: uint64ptr(1)}, B: struct {
B *uint64 `json:"b,string"`
}{B: uint64ptr(2)}},
},
// HeadUint64PtrNilMultiFieldsNotRoot
{
2021-02-15 05:28:09 +03:00
name: "HeadUint64PtrNilMultiFieldsNotRoot",
data: struct {
A struct {
A *uint64 `json:"a"`
}
B struct {
B *uint64 `json:"b"`
}
}{A: struct {
A *uint64 `json:"a"`
}{A: nil}, B: struct {
B *uint64 `json:"b"`
}{B: nil}},
},
{
2021-02-15 05:28:09 +03:00
name: "HeadUint64PtrNilMultiFieldsNotRootOmitEmpty",
data: struct {
A struct {
A *uint64 `json:"a,omitempty"`
}
B struct {
B *uint64 `json:"b,omitempty"`
}
}{A: struct {
A *uint64 `json:"a,omitempty"`
}{A: nil}, B: struct {
B *uint64 `json:"b,omitempty"`
}{B: nil}},
},
{
2021-02-15 05:28:09 +03:00
name: "HeadUint64PtrNilMultiFieldsNotRootString",
data: struct {
A struct {
A *uint64 `json:"a,string"`
}
B struct {
B *uint64 `json:"b,string"`
}
}{A: struct {
A *uint64 `json:"a,string"`
}{A: nil}, B: struct {
B *uint64 `json:"b,string"`
}{B: nil}},
},
// PtrHeadUint64ZeroMultiFieldsNotRoot
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64ZeroMultiFieldsNotRoot",
data: &struct {
A struct {
A uint64 `json:"a"`
2021-01-16 16:16:26 +03:00
}
B struct {
B uint64 `json:"b"`
}
}{},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64ZeroMultiFieldsNotRootOmitEmpty",
data: &struct {
A struct {
A uint64 `json:"a,omitempty"`
2021-01-16 16:16:26 +03:00
}
B struct {
B uint64 `json:"b,omitempty"`
}
}{},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64ZeroMultiFieldsNotRootString",
data: &struct {
2021-01-16 16:16:26 +03:00
A struct {
A uint64 `json:"a,string"`
2021-01-16 16:16:26 +03:00
}
B struct {
B uint64 `json:"b,string"`
2021-01-16 16:16:26 +03:00
}
}{},
},
// PtrHeadUint64MultiFieldsNotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64MultiFieldsNotRoot",
data: &struct {
2021-01-16 16:16:26 +03:00
A struct {
A uint64 `json:"a"`
}
B struct {
B uint64 `json:"b"`
}
}{A: struct {
A uint64 `json:"a"`
}{A: 1}, B: struct {
B uint64 `json:"b"`
}{B: 2}},
},
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64MultiFieldsNotRootOmitEmpty",
data: &struct {
2021-01-16 16:16:26 +03:00
A struct {
A uint64 `json:"a,omitempty"`
2021-01-16 16:16:26 +03:00
}
B struct {
B uint64 `json:"b,omitempty"`
2021-01-16 16:16:26 +03:00
}
}{A: struct {
A uint64 `json:"a,omitempty"`
}{A: 1}, B: struct {
B uint64 `json:"b,omitempty"`
}{B: 2}},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64MultiFieldsNotRootString",
data: &struct {
2021-01-16 16:16:26 +03:00
A struct {
A uint64 `json:"a,string"`
2021-01-16 16:16:26 +03:00
}
B struct {
B uint64 `json:"b,string"`
2021-01-16 16:16:26 +03:00
}
}{A: struct {
A uint64 `json:"a,string"`
}{A: 1}, B: struct {
B uint64 `json:"b,string"`
}{B: 2}},
2021-01-16 16:16:26 +03:00
},
// PtrHeadUint64PtrMultiFieldsNotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64PtrMultiFieldsNotRoot",
2021-01-16 16:16:26 +03:00
data: &struct {
A *struct {
A *uint64 `json:"a"`
2021-01-16 16:16:26 +03:00
}
B *struct {
B *uint64 `json:"b"`
2021-01-16 16:16:26 +03:00
}
}{A: &(struct {
A *uint64 `json:"a"`
}{A: uint64ptr(1)}), B: &(struct {
B *uint64 `json:"b"`
}{B: uint64ptr(2)})},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64PtrMultiFieldsNotRootOmitEmpty",
2021-01-16 16:16:26 +03:00
data: &struct {
A *struct {
A *uint64 `json:"a,omitempty"`
}
B *struct {
B *uint64 `json:"b,omitempty"`
}
}{A: &(struct {
A *uint64 `json:"a,omitempty"`
}{A: uint64ptr(1)}), B: &(struct {
B *uint64 `json:"b,omitempty"`
}{B: uint64ptr(2)})},
},
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64PtrMultiFieldsNotRootString",
data: &struct {
A *struct {
A *uint64 `json:"a,string"`
}
B *struct {
B *uint64 `json:"b,string"`
}
}{A: &(struct {
A *uint64 `json:"a,string"`
}{A: uint64ptr(1)}), B: &(struct {
B *uint64 `json:"b,string"`
}{B: uint64ptr(2)})},
},
// PtrHeadUint64PtrNilMultiFieldsNotRoot
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64PtrNilMultiFieldsNotRoot",
data: &struct {
A *struct {
A *uint64 `json:"a"`
}
B *struct {
B *uint64 `json:"b"`
}
}{A: nil, B: nil},
},
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64PtrNilMultiFieldsNotRootOmitEmpty",
data: &struct {
A *struct {
A *uint64 `json:"a,omitempty"`
} `json:",omitempty"`
B *struct {
B *uint64 `json:"b,omitempty"`
} `json:",omitempty"`
}{A: nil, B: nil},
},
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64PtrNilMultiFieldsNotRootString",
data: &struct {
A *struct {
A *uint64 `json:"a,string"`
} `json:",string"`
B *struct {
B *uint64 `json:"b,string"`
} `json:",string"`
}{A: nil, B: nil},
},
// PtrHeadUint64NilMultiFieldsNotRoot
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64NilMultiFieldsNotRoot",
data: (*struct {
A *struct {
A *uint64 `json:"a"`
}
B *struct {
B *uint64 `json:"b"`
}
})(nil),
},
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64NilMultiFieldsNotRootOmitEmpty",
data: (*struct {
A *struct {
A *uint64 `json:"a,omitempty"`
}
B *struct {
B *uint64 `json:"b,omitempty"`
}
})(nil),
},
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64NilMultiFieldsNotRootString",
data: (*struct {
A *struct {
A *uint64 `json:"a,string"`
}
B *struct {
B *uint64 `json:"b,string"`
}
})(nil),
},
// PtrHeadUint64DoubleMultiFieldsNotRoot
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64DoubleMultiFieldsNotRoot",
data: &struct {
A *struct {
2021-01-16 16:16:26 +03:00
A uint64 `json:"a"`
B uint64 `json:"b"`
2021-01-16 16:16:26 +03:00
}
B *struct {
A uint64 `json:"a"`
2021-01-16 16:16:26 +03:00
B uint64 `json:"b"`
}
}{A: &(struct {
2021-01-16 16:16:26 +03:00
A uint64 `json:"a"`
B uint64 `json:"b"`
}{A: 1, B: 2}), B: &(struct {
A uint64 `json:"a"`
B uint64 `json:"b"`
}{A: 3, B: 4})},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64DoubleMultiFieldsNotRootOmitEmpty",
data: &struct {
A *struct {
A uint64 `json:"a,omitempty"`
B uint64 `json:"b,omitempty"`
}
B *struct {
A uint64 `json:"a,omitempty"`
B uint64 `json:"b,omitempty"`
}
}{A: &(struct {
A uint64 `json:"a,omitempty"`
B uint64 `json:"b,omitempty"`
}{A: 1, B: 2}), B: &(struct {
A uint64 `json:"a,omitempty"`
B uint64 `json:"b,omitempty"`
}{A: 3, B: 4})},
},
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64DoubleMultiFieldsNotRootString",
2021-01-16 16:16:26 +03:00
data: &struct {
A *struct {
A uint64 `json:"a,string"`
B uint64 `json:"b,string"`
2021-01-16 16:16:26 +03:00
}
B *struct {
A uint64 `json:"a,string"`
B uint64 `json:"b,string"`
2021-01-16 16:16:26 +03:00
}
}{A: &(struct {
A uint64 `json:"a,string"`
B uint64 `json:"b,string"`
}{A: 1, B: 2}), B: &(struct {
A uint64 `json:"a,string"`
B uint64 `json:"b,string"`
}{A: 3, B: 4})},
2021-01-16 16:16:26 +03:00
},
// PtrHeadUint64NilDoubleMultiFieldsNotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64NilDoubleMultiFieldsNotRoot",
2021-01-16 16:16:26 +03:00
data: &struct {
A *struct {
A uint64 `json:"a"`
B uint64 `json:"b"`
2021-01-16 16:16:26 +03:00
}
B *struct {
A uint64 `json:"a"`
B uint64 `json:"b"`
2021-01-16 16:16:26 +03:00
}
}{A: nil, B: nil},
},
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64NilDoubleMultiFieldsNotRootOmitEmpty",
data: &struct {
2021-01-16 16:16:26 +03:00
A *struct {
A uint64 `json:"a,omitempty"`
B uint64 `json:"b,omitempty"`
} `json:",omitempty"`
2021-01-16 16:16:26 +03:00
B *struct {
A uint64 `json:"a,omitempty"`
B uint64 `json:"b,omitempty"`
} `json:",omitempty"`
}{A: nil, B: nil},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64NilDoubleMultiFieldsNotRootString",
2021-01-16 16:16:26 +03:00
data: &struct {
A *struct {
A uint64 `json:"a,string"`
B uint64 `json:"b,string"`
2021-01-16 16:16:26 +03:00
}
B *struct {
A uint64 `json:"a,string"`
B uint64 `json:"b,string"`
2021-01-16 16:16:26 +03:00
}
}{A: nil, B: nil},
2021-01-16 16:16:26 +03:00
},
// PtrHeadUint64NilDoubleMultiFieldsNotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64NilDoubleMultiFieldsNotRoot",
data: (*struct {
2021-01-16 16:16:26 +03:00
A *struct {
A uint64 `json:"a"`
B uint64 `json:"b"`
}
B *struct {
A uint64 `json:"a"`
B uint64 `json:"b"`
}
})(nil),
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64NilDoubleMultiFieldsNotRootOmitEmpty",
2021-01-16 16:16:26 +03:00
data: (*struct {
A *struct {
A uint64 `json:"a,omitempty"`
B uint64 `json:"b,omitempty"`
2021-01-16 16:16:26 +03:00
}
B *struct {
A uint64 `json:"a,omitempty"`
B uint64 `json:"b,omitempty"`
}
})(nil),
},
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64NilDoubleMultiFieldsNotRootString",
data: (*struct {
A *struct {
A uint64 `json:"a,string"`
B uint64 `json:"b,string"`
}
B *struct {
A uint64 `json:"a,string"`
B uint64 `json:"b,string"`
2021-01-16 16:16:26 +03:00
}
})(nil),
},
// PtrHeadUint64PtrDoubleMultiFieldsNotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64PtrDoubleMultiFieldsNotRoot",
2021-01-16 16:16:26 +03:00
data: &struct {
A *struct {
A *uint64 `json:"a"`
B *uint64 `json:"b"`
}
B *struct {
A *uint64 `json:"a"`
B *uint64 `json:"b"`
}
}{A: &(struct {
A *uint64 `json:"a"`
B *uint64 `json:"b"`
}{A: uint64ptr(1), B: uint64ptr(2)}), B: &(struct {
A *uint64 `json:"a"`
B *uint64 `json:"b"`
}{A: uint64ptr(3), B: uint64ptr(4)})},
},
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64PtrDoubleMultiFieldsNotRootOmitEmpty",
data: &struct {
A *struct {
A *uint64 `json:"a,omitempty"`
B *uint64 `json:"b,omitempty"`
}
B *struct {
A *uint64 `json:"a,omitempty"`
B *uint64 `json:"b,omitempty"`
}
}{A: &(struct {
A *uint64 `json:"a,omitempty"`
B *uint64 `json:"b,omitempty"`
}{A: uint64ptr(1), B: uint64ptr(2)}), B: &(struct {
A *uint64 `json:"a,omitempty"`
B *uint64 `json:"b,omitempty"`
}{A: uint64ptr(3), B: uint64ptr(4)})},
},
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64PtrDoubleMultiFieldsNotRootString",
data: &struct {
A *struct {
A *uint64 `json:"a,string"`
B *uint64 `json:"b,string"`
}
B *struct {
A *uint64 `json:"a,string"`
B *uint64 `json:"b,string"`
}
}{A: &(struct {
A *uint64 `json:"a,string"`
B *uint64 `json:"b,string"`
}{A: uint64ptr(1), B: uint64ptr(2)}), B: &(struct {
A *uint64 `json:"a,string"`
B *uint64 `json:"b,string"`
}{A: uint64ptr(3), B: uint64ptr(4)})},
},
// PtrHeadUint64PtrNilDoubleMultiFieldsNotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64PtrNilDoubleMultiFieldsNotRoot",
2021-01-16 16:16:26 +03:00
data: &struct {
A *struct {
A *uint64 `json:"a"`
B *uint64 `json:"b"`
}
B *struct {
A *uint64 `json:"a"`
B *uint64 `json:"b"`
}
}{A: nil, B: nil},
},
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64PtrNilDoubleMultiFieldsNotRootOmitEmpty",
data: &struct {
A *struct {
A *uint64 `json:"a,omitempty"`
B *uint64 `json:"b,omitempty"`
} `json:",omitempty"`
B *struct {
A *uint64 `json:"a,omitempty"`
B *uint64 `json:"b,omitempty"`
} `json:",omitempty"`
}{A: nil, B: nil},
},
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64PtrNilDoubleMultiFieldsNotRootString",
data: &struct {
A *struct {
A *uint64 `json:"a,string"`
B *uint64 `json:"b,string"`
}
B *struct {
A *uint64 `json:"a,string"`
B *uint64 `json:"b,string"`
}
}{A: nil, B: nil},
},
// PtrHeadUint64PtrNilDoubleMultiFieldsNotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64PtrNilDoubleMultiFieldsNotRoot",
2021-01-16 16:16:26 +03:00
data: (*struct {
A *struct {
A *uint64 `json:"a"`
B *uint64 `json:"b"`
}
B *struct {
A *uint64 `json:"a"`
B *uint64 `json:"b"`
}
})(nil),
},
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64PtrNilDoubleMultiFieldsNotRootOmitEmpty",
data: (*struct {
A *struct {
A *uint64 `json:"a,omitempty"`
B *uint64 `json:"b,omitempty"`
}
B *struct {
A *uint64 `json:"a,omitempty"`
B *uint64 `json:"b,omitempty"`
}
})(nil),
},
{
2021-02-15 05:28:09 +03:00
name: "PtrHeadUint64PtrNilDoubleMultiFieldsNotRootString",
data: (*struct {
A *struct {
A *uint64 `json:"a,string"`
B *uint64 `json:"b,string"`
}
B *struct {
A *uint64 `json:"a,string"`
B *uint64 `json:"b,string"`
}
})(nil),
},
// AnonymousHeadUint64
{
2021-02-15 05:28:09 +03:00
name: "AnonymousHeadUint64",
data: struct {
structUint64
B uint64 `json:"b"`
}{
structUint64: structUint64{A: 1},
B: 2,
},
},
{
2021-02-15 05:28:09 +03:00
name: "AnonymousHeadUint64OmitEmpty",
data: struct {
structUint64OmitEmpty
B uint64 `json:"b,omitempty"`
}{
structUint64OmitEmpty: structUint64OmitEmpty{A: 1},
B: 2,
},
},
{
2021-02-15 05:28:09 +03:00
name: "AnonymousHeadUint64String",
data: struct {
structUint64String
B uint64 `json:"b,string"`
}{
structUint64String: structUint64String{A: 1},
B: 2,
},
},
// PtrAnonymousHeadUint64
{
2021-02-15 05:28:09 +03:00
name: "PtrAnonymousHeadUint64",
data: struct {
*structUint64
B uint64 `json:"b"`
}{
structUint64: &structUint64{A: 1},
B: 2,
},
},
{
2021-02-15 05:28:09 +03:00
name: "PtrAnonymousHeadUint64OmitEmpty",
data: struct {
*structUint64OmitEmpty
B uint64 `json:"b,omitempty"`
}{
structUint64OmitEmpty: &structUint64OmitEmpty{A: 1},
B: 2,
},
},
{
2021-02-15 05:28:09 +03:00
name: "PtrAnonymousHeadUint64String",
data: struct {
*structUint64String
B uint64 `json:"b,string"`
}{
structUint64String: &structUint64String{A: 1},
B: 2,
},
},
// NilPtrAnonymousHeadUint64
{
2021-02-15 05:28:09 +03:00
name: "NilPtrAnonymousHeadUint64",
2021-01-16 16:16:26 +03:00
data: struct {
*structUint64
2021-01-16 16:16:26 +03:00
B uint64 `json:"b"`
}{
structUint64: nil,
2021-01-16 16:16:26 +03:00
B: 2,
},
},
{
2021-02-15 05:28:09 +03:00
name: "NilPtrAnonymousHeadUint64OmitEmpty",
2021-01-16 16:16:26 +03:00
data: struct {
*structUint64OmitEmpty
B uint64 `json:"b,omitempty"`
2021-01-16 16:16:26 +03:00
}{
structUint64OmitEmpty: nil,
B: 2,
2021-01-16 16:16:26 +03:00
},
},
{
2021-02-15 05:28:09 +03:00
name: "NilPtrAnonymousHeadUint64String",
2021-01-16 16:16:26 +03:00
data: struct {
*structUint64String
B uint64 `json:"b,string"`
2021-01-16 16:16:26 +03:00
}{
structUint64String: nil,
B: 2,
2021-01-16 16:16:26 +03:00
},
},
// AnonymousHeadUint64Ptr
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:28:09 +03:00
name: "AnonymousHeadUint64Ptr",
2021-01-16 16:16:26 +03:00
data: struct {
structUint64Ptr
B *uint64 `json:"b"`
}{
structUint64Ptr: structUint64Ptr{A: uint64ptr(1)},
B: uint64ptr(2),
},
},
{
2021-02-15 05:28:09 +03:00
name: "AnonymousHeadUint64PtrOmitEmpty",
data: struct {
structUint64PtrOmitEmpty
B *uint64 `json:"b,omitempty"`
}{
structUint64PtrOmitEmpty: structUint64PtrOmitEmpty{A: uint64ptr(1)},
B: uint64ptr(2),
},
},
{
2021-02-15 05:28:09 +03:00
name: "AnonymousHeadUint64PtrString",
data: struct {
structUint64PtrString
B *uint64 `json:"b,string"`
}{
structUint64PtrString: structUint64PtrString{A: uint64ptr(1)},
B: uint64ptr(2),
},
},
// AnonymousHeadUint64PtrNil
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:28:09 +03:00
name: "AnonymousHeadUint64PtrNil",
2021-01-16 16:16:26 +03:00
data: struct {
structUint64Ptr
B *uint64 `json:"b"`
}{
structUint64Ptr: structUint64Ptr{A: nil},
B: uint64ptr(2),
},
},
{
2021-02-15 05:28:09 +03:00
name: "AnonymousHeadUint64PtrNilOmitEmpty",
data: struct {
structUint64PtrOmitEmpty
B *uint64 `json:"b,omitempty"`
}{
structUint64PtrOmitEmpty: structUint64PtrOmitEmpty{A: nil},
B: uint64ptr(2),
},
},
{
2021-02-15 05:28:09 +03:00
name: "AnonymousHeadUint64PtrNilString",
data: struct {
structUint64PtrString
B *uint64 `json:"b,string"`
}{
structUint64PtrString: structUint64PtrString{A: nil},
B: uint64ptr(2),
},
},
// PtrAnonymousHeadUint64Ptr
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:28:09 +03:00
name: "PtrAnonymousHeadUint64Ptr",
2021-01-16 16:16:26 +03:00
data: struct {
*structUint64Ptr
B *uint64 `json:"b"`
}{
structUint64Ptr: &structUint64Ptr{A: uint64ptr(1)},
B: uint64ptr(2),
},
},
{
2021-02-15 05:28:09 +03:00
name: "PtrAnonymousHeadUint64PtrOmitEmpty",
data: struct {
*structUint64PtrOmitEmpty
B *uint64 `json:"b,omitempty"`
}{
structUint64PtrOmitEmpty: &structUint64PtrOmitEmpty{A: uint64ptr(1)},
B: uint64ptr(2),
},
},
{
2021-02-15 05:28:09 +03:00
name: "PtrAnonymousHeadUint64PtrString",
data: struct {
*structUint64PtrString
B *uint64 `json:"b,string"`
}{
structUint64PtrString: &structUint64PtrString{A: uint64ptr(1)},
B: uint64ptr(2),
},
},
// NilPtrAnonymousHeadUint64Ptr
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:28:09 +03:00
name: "NilPtrAnonymousHeadUint64Ptr",
2021-01-16 16:16:26 +03:00
data: struct {
*structUint64Ptr
B *uint64 `json:"b"`
}{
structUint64Ptr: nil,
B: uint64ptr(2),
},
},
{
2021-02-15 05:28:09 +03:00
name: "NilPtrAnonymousHeadUint64PtrOmitEmpty",
data: struct {
*structUint64PtrOmitEmpty
B *uint64 `json:"b,omitempty"`
}{
structUint64PtrOmitEmpty: nil,
B: uint64ptr(2),
},
},
{
2021-02-15 05:28:09 +03:00
name: "NilPtrAnonymousHeadUint64PtrString",
data: struct {
*structUint64PtrString
B *uint64 `json:"b,string"`
}{
structUint64PtrString: nil,
B: uint64ptr(2),
},
},
// AnonymousHeadUint64Only
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:28:09 +03:00
name: "AnonymousHeadUint64Only",
2021-01-16 16:16:26 +03:00
data: struct {
structUint64
}{
structUint64: structUint64{A: 1},
},
},
{
2021-02-15 05:28:09 +03:00
name: "AnonymousHeadUint64OnlyOmitEmpty",
data: struct {
structUint64OmitEmpty
}{
structUint64OmitEmpty: structUint64OmitEmpty{A: 1},
},
},
{
2021-02-15 05:28:09 +03:00
name: "AnonymousHeadUint64OnlyString",
data: struct {
structUint64String
}{
structUint64String: structUint64String{A: 1},
},
},
// PtrAnonymousHeadUint64Only
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:28:09 +03:00
name: "PtrAnonymousHeadUint64Only",
2021-01-16 16:16:26 +03:00
data: struct {
*structUint64
}{
structUint64: &structUint64{A: 1},
},
},
{
2021-02-15 05:28:09 +03:00
name: "PtrAnonymousHeadUint64OnlyOmitEmpty",
data: struct {
*structUint64OmitEmpty
}{
structUint64OmitEmpty: &structUint64OmitEmpty{A: 1},
},
},
{
2021-02-15 05:28:09 +03:00
name: "PtrAnonymousHeadUint64OnlyString",
data: struct {
*structUint64String
}{
structUint64String: &structUint64String{A: 1},
},
},
// NilPtrAnonymousHeadUint64Only
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:28:09 +03:00
name: "NilPtrAnonymousHeadUint64Only",
2021-01-16 16:16:26 +03:00
data: struct {
*structUint64
}{
structUint64: nil,
},
},
{
2021-02-15 05:28:09 +03:00
name: "NilPtrAnonymousHeadUint64OnlyOmitEmpty",
data: struct {
*structUint64OmitEmpty
}{
structUint64OmitEmpty: nil,
},
},
{
2021-02-15 05:28:09 +03:00
name: "NilPtrAnonymousHeadUint64OnlyString",
data: struct {
*structUint64String
}{
structUint64String: nil,
},
},
// AnonymousHeadUint64PtrOnly
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:28:09 +03:00
name: "AnonymousHeadUint64PtrOnly",
2021-01-16 16:16:26 +03:00
data: struct {
structUint64Ptr
}{
structUint64Ptr: structUint64Ptr{A: uint64ptr(1)},
},
},
{
2021-02-15 05:28:09 +03:00
name: "AnonymousHeadUint64PtrOnlyOmitEmpty",
data: struct {
structUint64PtrOmitEmpty
}{
structUint64PtrOmitEmpty: structUint64PtrOmitEmpty{A: uint64ptr(1)},
},
},
{
2021-02-15 05:28:09 +03:00
name: "AnonymousHeadUint64PtrOnlyString",
data: struct {
structUint64PtrString
}{
structUint64PtrString: structUint64PtrString{A: uint64ptr(1)},
},
},
// AnonymousHeadUint64PtrNilOnly
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:28:09 +03:00
name: "AnonymousHeadUint64PtrNilOnly",
2021-01-16 16:16:26 +03:00
data: struct {
structUint64Ptr
}{
structUint64Ptr: structUint64Ptr{A: nil},
},
},
{
2021-02-15 05:28:09 +03:00
name: "AnonymousHeadUint64PtrNilOnlyOmitEmpty",
data: struct {
structUint64PtrOmitEmpty
}{
structUint64PtrOmitEmpty: structUint64PtrOmitEmpty{A: nil},
},
},
{
2021-02-15 05:28:09 +03:00
name: "AnonymousHeadUint64PtrNilOnlyString",
data: struct {
structUint64PtrString
}{
structUint64PtrString: structUint64PtrString{A: nil},
},
},
// PtrAnonymousHeadUint64PtrOnly
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:28:09 +03:00
name: "PtrAnonymousHeadUint64PtrOnly",
2021-01-16 16:16:26 +03:00
data: struct {
*structUint64Ptr
}{
structUint64Ptr: &structUint64Ptr{A: uint64ptr(1)},
},
},
{
2021-02-15 05:28:09 +03:00
name: "PtrAnonymousHeadUint64PtrOnlyOmitEmpty",
data: struct {
*structUint64PtrOmitEmpty
}{
structUint64PtrOmitEmpty: &structUint64PtrOmitEmpty{A: uint64ptr(1)},
},
},
{
2021-02-15 05:28:09 +03:00
name: "PtrAnonymousHeadUint64PtrOnlyString",
data: struct {
*structUint64PtrString
}{
structUint64PtrString: &structUint64PtrString{A: uint64ptr(1)},
},
},
// NilPtrAnonymousHeadUint64PtrOnly
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:28:09 +03:00
name: "NilPtrAnonymousHeadUint64PtrOnly",
2021-01-16 16:16:26 +03:00
data: struct {
*structUint64Ptr
}{
structUint64Ptr: nil,
},
},
{
2021-02-15 05:28:09 +03:00
name: "NilPtrAnonymousHeadUint64PtrOnlyOmitEmpty",
data: struct {
*structUint64PtrOmitEmpty
}{
structUint64PtrOmitEmpty: nil,
},
},
{
2021-02-15 05:28:09 +03:00
name: "NilPtrAnonymousHeadUint64PtrOnlyString",
data: struct {
*structUint64PtrString
}{
structUint64PtrString: 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:28:09 +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
}
}
}
}