2021-01-16 16:16:26 +03:00
|
|
|
package json_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"bytes"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/goccy/go-json"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestCoverFloat64(t *testing.T) {
|
|
|
|
type structFloat64 struct {
|
|
|
|
A float64 `json:"a"`
|
|
|
|
}
|
2021-01-19 14:41:14 +03:00
|
|
|
type structFloat64OmitEmpty struct {
|
|
|
|
A float64 `json:"a,omitempty"`
|
|
|
|
}
|
|
|
|
type structFloat64String struct {
|
|
|
|
A float64 `json:"a,string"`
|
|
|
|
}
|
|
|
|
|
2021-01-16 16:16:26 +03:00
|
|
|
type structFloat64Ptr struct {
|
|
|
|
A *float64 `json:"a"`
|
|
|
|
}
|
2021-01-19 14:41:14 +03:00
|
|
|
type structFloat64PtrOmitEmpty struct {
|
|
|
|
A *float64 `json:"a,omitempty"`
|
|
|
|
}
|
|
|
|
type structFloat64PtrString struct {
|
|
|
|
A *float64 `json:"a,string"`
|
|
|
|
}
|
2021-01-16 16:16:26 +03:00
|
|
|
|
|
|
|
tests := []struct {
|
2021-02-15 05:31:26 +03:00
|
|
|
name string
|
|
|
|
data interface{}
|
2021-01-16 16:16:26 +03:00
|
|
|
}{
|
2021-01-19 14:41:14 +03:00
|
|
|
// HeadFloat64Zero
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "HeadFloat64Zero",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
A float64 `json:"a"`
|
|
|
|
}{},
|
|
|
|
},
|
2021-01-19 14:41:14 +03:00
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "HeadFloat64ZeroOmitEmpty",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
A float64 `json:"a,omitempty"`
|
|
|
|
}{},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "HeadFloat64ZeroString",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
A float64 `json:"a,string"`
|
|
|
|
}{},
|
|
|
|
},
|
|
|
|
|
|
|
|
// HeadFloat64
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "HeadFloat64",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
A float64 `json:"a"`
|
|
|
|
}{A: 1},
|
|
|
|
},
|
2021-01-19 14:41:14 +03:00
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "HeadFloat64OmitEmpty",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
A float64 `json:"a,omitempty"`
|
|
|
|
}{A: 1},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "HeadFloat64String",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
A float64 `json:"a,string"`
|
|
|
|
}{A: 1},
|
|
|
|
},
|
|
|
|
|
|
|
|
// HeadFloat64Ptr
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "HeadFloat64Ptr",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
A *float64 `json:"a"`
|
|
|
|
}{A: float64ptr(1)},
|
|
|
|
},
|
2021-01-19 14:41:14 +03:00
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "HeadFloat64PtrOmitEmpty",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
A *float64 `json:"a,omitempty"`
|
|
|
|
}{A: float64ptr(1)},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "HeadFloat64PtrString",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
A *float64 `json:"a,string"`
|
|
|
|
}{A: float64ptr(1)},
|
|
|
|
},
|
|
|
|
|
|
|
|
// HeadFloat64PtrNil
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "HeadFloat64PtrNil",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
A *float64 `json:"a"`
|
|
|
|
}{A: nil},
|
|
|
|
},
|
2021-01-19 14:41:14 +03:00
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "HeadFloat64PtrNilOmitEmpty",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
A *float64 `json:"a,omitempty"`
|
|
|
|
}{A: nil},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "HeadFloat64PtrNilString",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
A *float64 `json:"a,string"`
|
|
|
|
}{A: nil},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadFloat64Zero
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64Zero",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: &struct {
|
|
|
|
A float64 `json:"a"`
|
|
|
|
}{},
|
|
|
|
},
|
2021-01-19 14:41:14 +03:00
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64ZeroOmitEmpty",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: &struct {
|
|
|
|
A float64 `json:"a,omitempty"`
|
|
|
|
}{},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64ZeroString",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: &struct {
|
|
|
|
A float64 `json:"a,string"`
|
|
|
|
}{},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadFloat64
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: &struct {
|
|
|
|
A float64 `json:"a"`
|
|
|
|
}{A: 1},
|
|
|
|
},
|
2021-01-19 14:41:14 +03:00
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64OmitEmpty",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: &struct {
|
|
|
|
A float64 `json:"a,omitempty"`
|
|
|
|
}{A: 1},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64String",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: &struct {
|
|
|
|
A float64 `json:"a,string"`
|
|
|
|
}{A: 1},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadFloat64Ptr
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64Ptr",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: &struct {
|
|
|
|
A *float64 `json:"a"`
|
|
|
|
}{A: float64ptr(1)},
|
|
|
|
},
|
2021-01-19 14:41:14 +03:00
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64PtrOmitEmpty",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: &struct {
|
|
|
|
A *float64 `json:"a,omitempty"`
|
|
|
|
}{A: float64ptr(1)},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64PtrString",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: &struct {
|
|
|
|
A *float64 `json:"a,string"`
|
|
|
|
}{A: float64ptr(1)},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadFloat64PtrNil
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64PtrNil",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: &struct {
|
|
|
|
A *float64 `json:"a"`
|
|
|
|
}{A: nil},
|
|
|
|
},
|
2021-01-19 14:41:14 +03:00
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64PtrNilOmitEmpty",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: &struct {
|
|
|
|
A *float64 `json:"a,omitempty"`
|
|
|
|
}{A: nil},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64PtrNilString",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: &struct {
|
|
|
|
A *float64 `json:"a,string"`
|
|
|
|
}{A: nil},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadFloat64Nil
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64Nil",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: (*struct {
|
|
|
|
A *float64 `json:"a"`
|
|
|
|
})(nil),
|
|
|
|
},
|
2021-01-19 14:41:14 +03:00
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64NilOmitEmpty",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: (*struct {
|
|
|
|
A *float64 `json:"a,omitempty"`
|
|
|
|
})(nil),
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64NilString",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: (*struct {
|
|
|
|
A *float64 `json:"a,string"`
|
|
|
|
})(nil),
|
|
|
|
},
|
|
|
|
|
|
|
|
// HeadFloat64ZeroMultiFields
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "HeadFloat64ZeroMultiFields",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
A float64 `json:"a"`
|
|
|
|
B float64 `json:"b"`
|
2021-02-15 05:31:26 +03:00
|
|
|
C float64 `json:"c"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}{},
|
|
|
|
},
|
2021-01-19 14:41:14 +03:00
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "HeadFloat64ZeroMultiFieldsOmitEmpty",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
A float64 `json:"a,omitempty"`
|
|
|
|
B float64 `json:"b,omitempty"`
|
2021-02-15 05:31:26 +03:00
|
|
|
C float64 `json:"c,omitempty"`
|
2021-01-19 14:41:14 +03:00
|
|
|
}{},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "HeadFloat64ZeroMultiFields",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
A float64 `json:"a,string"`
|
|
|
|
B float64 `json:"b,string"`
|
2021-02-15 05:31:26 +03:00
|
|
|
C float64 `json:"c,string"`
|
2021-01-19 14:41:14 +03:00
|
|
|
}{},
|
|
|
|
},
|
|
|
|
|
|
|
|
// HeadFloat64MultiFields
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "HeadFloat64MultiFields",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
A float64 `json:"a"`
|
|
|
|
B float64 `json:"b"`
|
2021-02-15 05:31:26 +03:00
|
|
|
C float64 `json:"c"`
|
|
|
|
}{A: 1, B: 2, C: 3},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "HeadFloat64MultiFieldsOmitEmpty",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
2021-01-19 14:41:14 +03:00
|
|
|
A float64 `json:"a,omitempty"`
|
|
|
|
B float64 `json:"b,omitempty"`
|
2021-02-15 05:31:26 +03:00
|
|
|
C float64 `json:"c,omitempty"`
|
|
|
|
}{A: 1, B: 2, C: 3},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "HeadFloat64MultiFieldsString",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
2021-01-19 14:41:14 +03:00
|
|
|
A float64 `json:"a,string"`
|
|
|
|
B float64 `json:"b,string"`
|
2021-02-15 05:31:26 +03:00
|
|
|
C float64 `json:"c,string"`
|
|
|
|
}{A: 1, B: 2, C: 3},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
2021-01-19 14:41:14 +03:00
|
|
|
|
|
|
|
// HeadFloat64PtrMultiFields
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "HeadFloat64PtrMultiFields",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
A *float64 `json:"a"`
|
|
|
|
B *float64 `json:"b"`
|
2021-02-15 05:31:26 +03:00
|
|
|
C *float64 `json:"c"`
|
|
|
|
}{A: float64ptr(1), B: float64ptr(2), C: float64ptr(3)},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "HeadFloat64PtrMultiFieldsOmitEmpty",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
A *float64 `json:"a,omitempty"`
|
|
|
|
B *float64 `json:"b,omitempty"`
|
2021-02-15 05:31:26 +03:00
|
|
|
C *float64 `json:"c,omitempty"`
|
|
|
|
}{A: float64ptr(1), B: float64ptr(2), C: float64ptr(3)},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "HeadFloat64PtrMultiFieldsString",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
A *float64 `json:"a,string"`
|
|
|
|
B *float64 `json:"b,string"`
|
2021-02-15 05:31:26 +03:00
|
|
|
C *float64 `json:"c,string"`
|
|
|
|
}{A: float64ptr(1), B: float64ptr(2), C: float64ptr(3)},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
2021-01-19 14:41:14 +03:00
|
|
|
|
|
|
|
// HeadFloat64PtrNilMultiFields
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "HeadFloat64PtrNilMultiFields",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
2021-01-16 16:16:26 +03:00
|
|
|
A *float64 `json:"a"`
|
|
|
|
B *float64 `json:"b"`
|
2021-02-15 05:31:26 +03:00
|
|
|
C *float64 `json:"c"`
|
|
|
|
}{A: nil, B: nil, C: nil},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "HeadFloat64PtrNilMultiFieldsOmitEmpty",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
A *float64 `json:"a,omitempty"`
|
|
|
|
B *float64 `json:"b,omitempty"`
|
2021-02-15 05:31:26 +03:00
|
|
|
C *float64 `json:"c,omitempty"`
|
|
|
|
}{A: nil, B: nil, C: nil},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "HeadFloat64PtrNilMultiFieldsString",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
A *float64 `json:"a,string"`
|
|
|
|
B *float64 `json:"b,string"`
|
2021-02-15 05:31:26 +03:00
|
|
|
C *float64 `json:"c,string"`
|
|
|
|
}{A: nil, B: nil, C: nil},
|
2021-01-19 14:41:14 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadFloat64ZeroMultiFields
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64ZeroMultiFields",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: &struct {
|
|
|
|
A float64 `json:"a"`
|
|
|
|
B float64 `json:"b"`
|
|
|
|
}{},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64ZeroMultiFieldsOmitEmpty",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: &struct {
|
|
|
|
A float64 `json:"a,omitempty"`
|
|
|
|
B float64 `json:"b,omitempty"`
|
|
|
|
}{},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64ZeroMultiFieldsString",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: &struct {
|
|
|
|
A float64 `json:"a,string"`
|
|
|
|
B float64 `json:"b,string"`
|
|
|
|
}{},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadFloat64MultiFields
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64MultiFields",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: &struct {
|
|
|
|
A float64 `json:"a"`
|
|
|
|
B float64 `json:"b"`
|
|
|
|
}{A: 1, B: 2},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64MultiFieldsOmitEmpty",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: &struct {
|
|
|
|
A float64 `json:"a,omitempty"`
|
|
|
|
B float64 `json:"b,omitempty"`
|
|
|
|
}{A: 1, B: 2},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64MultiFieldsString",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: &struct {
|
|
|
|
A float64 `json:"a,string"`
|
|
|
|
B float64 `json:"b,string"`
|
|
|
|
}{A: 1, B: 2},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadFloat64PtrMultiFields
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64PtrMultiFields",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: &struct {
|
|
|
|
A *float64 `json:"a"`
|
|
|
|
B *float64 `json:"b"`
|
|
|
|
}{A: float64ptr(1), B: float64ptr(2)},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64PtrMultiFieldsOmitEmpty",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: &struct {
|
|
|
|
A *float64 `json:"a,omitempty"`
|
|
|
|
B *float64 `json:"b,omitempty"`
|
|
|
|
}{A: float64ptr(1), B: float64ptr(2)},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64PtrMultiFieldsString",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: &struct {
|
|
|
|
A *float64 `json:"a,string"`
|
|
|
|
B *float64 `json:"b,string"`
|
|
|
|
}{A: float64ptr(1), B: float64ptr(2)},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadFloat64PtrNilMultiFields
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64PtrNilMultiFields",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: &struct {
|
|
|
|
A *float64 `json:"a"`
|
|
|
|
B *float64 `json:"b"`
|
|
|
|
}{A: nil, B: nil},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64PtrNilMultiFieldsOmitEmpty",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: &struct {
|
|
|
|
A *float64 `json:"a,omitempty"`
|
|
|
|
B *float64 `json:"b,omitempty"`
|
|
|
|
}{A: nil, B: nil},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64PtrNilMultiFieldsString",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: &struct {
|
|
|
|
A *float64 `json:"a,string"`
|
|
|
|
B *float64 `json:"b,string"`
|
|
|
|
}{A: nil, B: nil},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadFloat64NilMultiFields
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64NilMultiFields",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: (*struct {
|
|
|
|
A *float64 `json:"a"`
|
|
|
|
B *float64 `json:"b"`
|
|
|
|
})(nil),
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64NilMultiFieldsOmitEmpty",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: (*struct {
|
|
|
|
A *float64 `json:"a,omitempty"`
|
|
|
|
B *float64 `json:"b,omitempty"`
|
|
|
|
})(nil),
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64NilMultiFieldsString",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: (*struct {
|
|
|
|
A *float64 `json:"a,string"`
|
|
|
|
B *float64 `json:"b,string"`
|
|
|
|
})(nil),
|
|
|
|
},
|
|
|
|
|
|
|
|
// HeadFloat64ZeroNotRoot
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "HeadFloat64ZeroNotRoot",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A float64 `json:"a"`
|
|
|
|
}
|
|
|
|
}{},
|
|
|
|
},
|
2021-01-19 14:41:14 +03:00
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "HeadFloat64ZeroNotRootOmitEmpty",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A float64 `json:"a,omitempty"`
|
|
|
|
}
|
|
|
|
}{},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "HeadFloat64ZeroNotRootString",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A float64 `json:"a,string"`
|
|
|
|
}
|
|
|
|
}{},
|
|
|
|
},
|
|
|
|
|
|
|
|
// HeadFloat64NotRoot
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "HeadFloat64NotRoot",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A float64 `json:"a"`
|
|
|
|
}
|
|
|
|
}{A: struct {
|
|
|
|
A float64 `json:"a"`
|
|
|
|
}{A: 1}},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "HeadFloat64NotRootOmitEmpty",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
2021-01-19 14:41:14 +03:00
|
|
|
A float64 `json:"a,omitempty"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
|
|
|
}{A: struct {
|
2021-01-19 14:41:14 +03:00
|
|
|
A float64 `json:"a,omitempty"`
|
|
|
|
}{A: 1}},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "HeadFloat64NotRootString",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
2021-01-19 14:41:14 +03:00
|
|
|
A float64 `json:"a,string"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
2021-01-19 14:41:14 +03:00
|
|
|
}{A: struct {
|
|
|
|
A float64 `json:"a,string"`
|
|
|
|
}{A: 1}},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
2021-01-19 14:41:14 +03:00
|
|
|
|
|
|
|
// HeadFloat64PtrNotRoot
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "HeadFloat64PtrNotRoot",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
2021-01-19 14:41:14 +03:00
|
|
|
A struct {
|
|
|
|
A *float64 `json:"a"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
2021-01-19 14:41:14 +03:00
|
|
|
}{A: struct {
|
|
|
|
A *float64 `json:"a"`
|
|
|
|
}{float64ptr(1)}},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "HeadFloat64PtrNotRootOmitEmpty",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
2021-01-19 14:41:14 +03:00
|
|
|
A struct {
|
|
|
|
A *float64 `json:"a,omitempty"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
2021-01-19 14:41:14 +03:00
|
|
|
}{A: struct {
|
|
|
|
A *float64 `json:"a,omitempty"`
|
|
|
|
}{float64ptr(1)}},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "HeadFloat64PtrNotRootString",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
2021-01-19 14:41:14 +03:00
|
|
|
A struct {
|
|
|
|
A *float64 `json:"a,string"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
2021-01-19 14:41:14 +03:00
|
|
|
}{A: struct {
|
|
|
|
A *float64 `json:"a,string"`
|
|
|
|
}{float64ptr(1)}},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
2021-01-19 14:41:14 +03:00
|
|
|
|
|
|
|
// HeadFloat64PtrNilNotRoot
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "HeadFloat64PtrNilNotRoot",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A *float64 `json:"a"`
|
|
|
|
}
|
|
|
|
}{},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "HeadFloat64PtrNilNotRootOmitEmpty",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A *float64 `json:"a,omitempty"`
|
|
|
|
}
|
|
|
|
}{},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "HeadFloat64PtrNilNotRootString",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A *float64 `json:"a,string"`
|
|
|
|
}
|
|
|
|
}{},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadFloat64ZeroNotRoot
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64ZeroNotRoot",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
A *struct {
|
|
|
|
A float64 `json:"a"`
|
|
|
|
}
|
|
|
|
}{A: new(struct {
|
|
|
|
A float64 `json:"a"`
|
|
|
|
})},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64ZeroNotRootOmitEmpty",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
A *struct {
|
|
|
|
A float64 `json:"a,omitempty"`
|
|
|
|
}
|
|
|
|
}{A: new(struct {
|
|
|
|
A float64 `json:"a,omitempty"`
|
|
|
|
})},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64ZeroNotRootString",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
A *struct {
|
|
|
|
A float64 `json:"a,string"`
|
|
|
|
}
|
|
|
|
}{A: new(struct {
|
|
|
|
A float64 `json:"a,string"`
|
|
|
|
})},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadFloat64NotRoot
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64NotRoot",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
A *struct {
|
|
|
|
A float64 `json:"a"`
|
|
|
|
}
|
|
|
|
}{A: &(struct {
|
|
|
|
A float64 `json:"a"`
|
|
|
|
}{A: 1})},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64NotRootOmitEmpty",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
A *struct {
|
|
|
|
A float64 `json:"a,omitempty"`
|
|
|
|
}
|
|
|
|
}{A: &(struct {
|
|
|
|
A float64 `json:"a,omitempty"`
|
|
|
|
}{A: 1})},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64NotRootString",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
A *struct {
|
|
|
|
A float64 `json:"a,string"`
|
|
|
|
}
|
|
|
|
}{A: &(struct {
|
|
|
|
A float64 `json:"a,string"`
|
|
|
|
}{A: 1})},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadFloat64PtrNotRoot
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64PtrNotRoot",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
A *struct {
|
|
|
|
A *float64 `json:"a"`
|
|
|
|
}
|
|
|
|
}{A: &(struct {
|
|
|
|
A *float64 `json:"a"`
|
|
|
|
}{A: float64ptr(1)})},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64PtrNotRootOmitEmpty",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
A *struct {
|
|
|
|
A *float64 `json:"a,omitempty"`
|
|
|
|
}
|
|
|
|
}{A: &(struct {
|
|
|
|
A *float64 `json:"a,omitempty"`
|
|
|
|
}{A: float64ptr(1)})},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64PtrNotRootString",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
A *struct {
|
|
|
|
A *float64 `json:"a,string"`
|
|
|
|
}
|
|
|
|
}{A: &(struct {
|
|
|
|
A *float64 `json:"a,string"`
|
|
|
|
}{A: float64ptr(1)})},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadFloat64PtrNilNotRoot
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64PtrNilNotRoot",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
A *struct {
|
|
|
|
A *float64 `json:"a"`
|
|
|
|
}
|
|
|
|
}{A: &(struct {
|
|
|
|
A *float64 `json:"a"`
|
|
|
|
}{A: nil})},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64PtrNilNotRootOmitEmpty",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
A *struct {
|
|
|
|
A *float64 `json:"a,omitempty"`
|
|
|
|
}
|
|
|
|
}{A: &(struct {
|
|
|
|
A *float64 `json:"a,omitempty"`
|
|
|
|
}{A: nil})},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64PtrNilNotRootString",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
A *struct {
|
|
|
|
A *float64 `json:"a,string"`
|
|
|
|
}
|
|
|
|
}{A: &(struct {
|
|
|
|
A *float64 `json:"a,string"`
|
|
|
|
}{A: nil})},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadFloat64NilNotRoot
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64NilNotRoot",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
A *struct {
|
|
|
|
A *float64 `json:"a"`
|
|
|
|
}
|
|
|
|
}{A: nil},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64NilNotRootOmitEmpty",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
A *struct {
|
|
|
|
A *float64 `json:"a,omitempty"`
|
|
|
|
} `json:",omitempty"`
|
|
|
|
}{A: nil},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64NilNotRootString",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
A *struct {
|
|
|
|
A *float64 `json:"a,string"`
|
|
|
|
} `json:",string"`
|
|
|
|
}{A: nil},
|
|
|
|
},
|
|
|
|
|
|
|
|
// HeadFloat64ZeroMultiFieldsNotRoot
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "HeadFloat64ZeroMultiFieldsNotRoot",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A float64 `json:"a"`
|
|
|
|
}
|
|
|
|
B struct {
|
|
|
|
B float64 `json:"b"`
|
|
|
|
}
|
|
|
|
}{},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "HeadFloat64ZeroMultiFieldsNotRootOmitEmpty",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A float64 `json:"a,omitempty"`
|
|
|
|
}
|
|
|
|
B struct {
|
|
|
|
B float64 `json:"b,omitempty"`
|
|
|
|
}
|
|
|
|
}{},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "HeadFloat64ZeroMultiFieldsNotRootString",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A float64 `json:"a,string"`
|
|
|
|
}
|
|
|
|
B struct {
|
|
|
|
B float64 `json:"b,string"`
|
|
|
|
}
|
|
|
|
}{},
|
|
|
|
},
|
|
|
|
|
|
|
|
// HeadFloat64MultiFieldsNotRoot
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "HeadFloat64MultiFieldsNotRoot",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A float64 `json:"a"`
|
|
|
|
}
|
|
|
|
B struct {
|
|
|
|
B float64 `json:"b"`
|
|
|
|
}
|
|
|
|
}{A: struct {
|
|
|
|
A float64 `json:"a"`
|
|
|
|
}{A: 1}, B: struct {
|
|
|
|
B float64 `json:"b"`
|
|
|
|
}{B: 2}},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "HeadFloat64MultiFieldsNotRootOmitEmpty",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A float64 `json:"a,omitempty"`
|
|
|
|
}
|
|
|
|
B struct {
|
|
|
|
B float64 `json:"b,omitempty"`
|
|
|
|
}
|
|
|
|
}{A: struct {
|
|
|
|
A float64 `json:"a,omitempty"`
|
|
|
|
}{A: 1}, B: struct {
|
|
|
|
B float64 `json:"b,omitempty"`
|
|
|
|
}{B: 2}},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "HeadFloat64MultiFieldsNotRootString",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A float64 `json:"a,string"`
|
|
|
|
}
|
|
|
|
B struct {
|
|
|
|
B float64 `json:"b,string"`
|
|
|
|
}
|
|
|
|
}{A: struct {
|
|
|
|
A float64 `json:"a,string"`
|
|
|
|
}{A: 1}, B: struct {
|
|
|
|
B float64 `json:"b,string"`
|
|
|
|
}{B: 2}},
|
|
|
|
},
|
|
|
|
|
|
|
|
// HeadFloat64PtrMultiFieldsNotRoot
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "HeadFloat64PtrMultiFieldsNotRoot",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A *float64 `json:"a"`
|
|
|
|
}
|
|
|
|
B struct {
|
|
|
|
B *float64 `json:"b"`
|
|
|
|
}
|
|
|
|
}{A: struct {
|
|
|
|
A *float64 `json:"a"`
|
|
|
|
}{A: float64ptr(1)}, B: struct {
|
|
|
|
B *float64 `json:"b"`
|
|
|
|
}{B: float64ptr(2)}},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "HeadFloat64PtrMultiFieldsNotRootOmitEmpty",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A *float64 `json:"a,omitempty"`
|
|
|
|
}
|
|
|
|
B struct {
|
|
|
|
B *float64 `json:"b,omitempty"`
|
|
|
|
}
|
|
|
|
}{A: struct {
|
|
|
|
A *float64 `json:"a,omitempty"`
|
|
|
|
}{A: float64ptr(1)}, B: struct {
|
|
|
|
B *float64 `json:"b,omitempty"`
|
|
|
|
}{B: float64ptr(2)}},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "HeadFloat64PtrMultiFieldsNotRootString",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A *float64 `json:"a,string"`
|
|
|
|
}
|
|
|
|
B struct {
|
|
|
|
B *float64 `json:"b,string"`
|
|
|
|
}
|
|
|
|
}{A: struct {
|
|
|
|
A *float64 `json:"a,string"`
|
|
|
|
}{A: float64ptr(1)}, B: struct {
|
|
|
|
B *float64 `json:"b,string"`
|
|
|
|
}{B: float64ptr(2)}},
|
|
|
|
},
|
|
|
|
|
|
|
|
// HeadFloat64PtrNilMultiFieldsNotRoot
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "HeadFloat64PtrNilMultiFieldsNotRoot",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A *float64 `json:"a"`
|
|
|
|
}
|
|
|
|
B struct {
|
|
|
|
B *float64 `json:"b"`
|
|
|
|
}
|
|
|
|
}{A: struct {
|
|
|
|
A *float64 `json:"a"`
|
|
|
|
}{A: nil}, B: struct {
|
|
|
|
B *float64 `json:"b"`
|
|
|
|
}{B: nil}},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "HeadFloat64PtrNilMultiFieldsNotRootOmitEmpty",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A *float64 `json:"a,omitempty"`
|
|
|
|
}
|
|
|
|
B struct {
|
|
|
|
B *float64 `json:"b,omitempty"`
|
|
|
|
}
|
|
|
|
}{A: struct {
|
|
|
|
A *float64 `json:"a,omitempty"`
|
|
|
|
}{A: nil}, B: struct {
|
|
|
|
B *float64 `json:"b,omitempty"`
|
|
|
|
}{B: nil}},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "HeadFloat64PtrNilMultiFieldsNotRootString",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
A struct {
|
|
|
|
A *float64 `json:"a,string"`
|
|
|
|
}
|
|
|
|
B struct {
|
|
|
|
B *float64 `json:"b,string"`
|
|
|
|
}
|
|
|
|
}{A: struct {
|
|
|
|
A *float64 `json:"a,string"`
|
|
|
|
}{A: nil}, B: struct {
|
|
|
|
B *float64 `json:"b,string"`
|
|
|
|
}{B: nil}},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadFloat64ZeroMultiFieldsNotRoot
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64ZeroMultiFieldsNotRoot",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: &struct {
|
|
|
|
A struct {
|
|
|
|
A float64 `json:"a"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
2021-01-19 14:41:14 +03:00
|
|
|
B struct {
|
|
|
|
B float64 `json:"b"`
|
|
|
|
}
|
|
|
|
}{},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64ZeroMultiFieldsNotRootOmitEmpty",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: &struct {
|
|
|
|
A struct {
|
|
|
|
A float64 `json:"a,omitempty"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
2021-01-19 14:41:14 +03:00
|
|
|
B struct {
|
|
|
|
B float64 `json:"b,omitempty"`
|
|
|
|
}
|
|
|
|
}{},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64ZeroMultiFieldsNotRootString",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: &struct {
|
2021-01-16 16:16:26 +03:00
|
|
|
A struct {
|
2021-01-19 14:41:14 +03:00
|
|
|
A float64 `json:"a,string"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
|
|
|
B struct {
|
2021-01-19 14:41:14 +03:00
|
|
|
B float64 `json:"b,string"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
|
|
|
}{},
|
|
|
|
},
|
2021-01-19 14:41:14 +03:00
|
|
|
|
|
|
|
// PtrHeadFloat64MultiFieldsNotRoot
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64MultiFieldsNotRoot",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: &struct {
|
2021-01-16 16:16:26 +03:00
|
|
|
A struct {
|
|
|
|
A float64 `json:"a"`
|
|
|
|
}
|
|
|
|
B struct {
|
|
|
|
B float64 `json:"b"`
|
|
|
|
}
|
|
|
|
}{A: struct {
|
|
|
|
A float64 `json:"a"`
|
|
|
|
}{A: 1}, B: struct {
|
|
|
|
B float64 `json:"b"`
|
|
|
|
}{B: 2}},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64MultiFieldsNotRootOmitEmpty",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: &struct {
|
2021-01-16 16:16:26 +03:00
|
|
|
A struct {
|
2021-01-19 14:41:14 +03:00
|
|
|
A float64 `json:"a,omitempty"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
|
|
|
B struct {
|
2021-01-19 14:41:14 +03:00
|
|
|
B float64 `json:"b,omitempty"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
|
|
|
}{A: struct {
|
2021-01-19 14:41:14 +03:00
|
|
|
A float64 `json:"a,omitempty"`
|
|
|
|
}{A: 1}, B: struct {
|
|
|
|
B float64 `json:"b,omitempty"`
|
|
|
|
}{B: 2}},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64MultiFieldsNotRootString",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: &struct {
|
2021-01-16 16:16:26 +03:00
|
|
|
A struct {
|
2021-01-19 14:41:14 +03:00
|
|
|
A float64 `json:"a,string"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
|
|
|
B struct {
|
2021-01-19 14:41:14 +03:00
|
|
|
B float64 `json:"b,string"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
|
|
|
}{A: struct {
|
2021-01-19 14:41:14 +03:00
|
|
|
A float64 `json:"a,string"`
|
|
|
|
}{A: 1}, B: struct {
|
|
|
|
B float64 `json:"b,string"`
|
|
|
|
}{B: 2}},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
2021-01-19 14:41:14 +03:00
|
|
|
|
|
|
|
// PtrHeadFloat64PtrMultiFieldsNotRoot
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64PtrMultiFieldsNotRoot",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: &struct {
|
2021-01-19 14:41:14 +03:00
|
|
|
A *struct {
|
|
|
|
A *float64 `json:"a"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
2021-01-19 14:41:14 +03:00
|
|
|
B *struct {
|
|
|
|
B *float64 `json:"b"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
2021-01-19 14:41:14 +03:00
|
|
|
}{A: &(struct {
|
|
|
|
A *float64 `json:"a"`
|
|
|
|
}{A: float64ptr(1)}), B: &(struct {
|
|
|
|
B *float64 `json:"b"`
|
|
|
|
}{B: float64ptr(2)})},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64PtrMultiFieldsNotRootOmitEmpty",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: &struct {
|
2021-01-19 14:41:14 +03:00
|
|
|
A *struct {
|
|
|
|
A *float64 `json:"a,omitempty"`
|
|
|
|
}
|
|
|
|
B *struct {
|
|
|
|
B *float64 `json:"b,omitempty"`
|
|
|
|
}
|
|
|
|
}{A: &(struct {
|
|
|
|
A *float64 `json:"a,omitempty"`
|
|
|
|
}{A: float64ptr(1)}), B: &(struct {
|
|
|
|
B *float64 `json:"b,omitempty"`
|
|
|
|
}{B: float64ptr(2)})},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64PtrMultiFieldsNotRootString",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: &struct {
|
|
|
|
A *struct {
|
|
|
|
A *float64 `json:"a,string"`
|
|
|
|
}
|
|
|
|
B *struct {
|
|
|
|
B *float64 `json:"b,string"`
|
|
|
|
}
|
|
|
|
}{A: &(struct {
|
|
|
|
A *float64 `json:"a,string"`
|
|
|
|
}{A: float64ptr(1)}), B: &(struct {
|
|
|
|
B *float64 `json:"b,string"`
|
|
|
|
}{B: float64ptr(2)})},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadFloat64PtrNilMultiFieldsNotRoot
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64PtrNilMultiFieldsNotRoot",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: &struct {
|
|
|
|
A *struct {
|
|
|
|
A *float64 `json:"a"`
|
|
|
|
}
|
|
|
|
B *struct {
|
|
|
|
B *float64 `json:"b"`
|
|
|
|
}
|
|
|
|
}{A: nil, B: nil},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64PtrNilMultiFieldsNotRootOmitEmpty",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: &struct {
|
|
|
|
A *struct {
|
|
|
|
A *float64 `json:"a,omitempty"`
|
|
|
|
} `json:",omitempty"`
|
|
|
|
B *struct {
|
|
|
|
B *float64 `json:"b,omitempty"`
|
|
|
|
} `json:",omitempty"`
|
|
|
|
}{A: nil, B: nil},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64PtrNilMultiFieldsNotRootString",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: &struct {
|
|
|
|
A *struct {
|
|
|
|
A *float64 `json:"a,string"`
|
|
|
|
} `json:",string"`
|
|
|
|
B *struct {
|
|
|
|
B *float64 `json:"b,string"`
|
|
|
|
} `json:",string"`
|
|
|
|
}{A: nil, B: nil},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadFloat64NilMultiFieldsNotRoot
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64NilMultiFieldsNotRoot",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: (*struct {
|
|
|
|
A *struct {
|
|
|
|
A *float64 `json:"a"`
|
|
|
|
}
|
|
|
|
B *struct {
|
|
|
|
B *float64 `json:"b"`
|
|
|
|
}
|
|
|
|
})(nil),
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64NilMultiFieldsNotRootOmitEmpty",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: (*struct {
|
|
|
|
A *struct {
|
|
|
|
A *float64 `json:"a,omitempty"`
|
|
|
|
}
|
|
|
|
B *struct {
|
|
|
|
B *float64 `json:"b,omitempty"`
|
|
|
|
}
|
|
|
|
})(nil),
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64NilMultiFieldsNotRootString",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: (*struct {
|
|
|
|
A *struct {
|
|
|
|
A *float64 `json:"a,string"`
|
|
|
|
}
|
|
|
|
B *struct {
|
|
|
|
B *float64 `json:"b,string"`
|
|
|
|
}
|
|
|
|
})(nil),
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadFloat64DoubleMultiFieldsNotRoot
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64DoubleMultiFieldsNotRoot",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: &struct {
|
|
|
|
A *struct {
|
2021-01-16 16:16:26 +03:00
|
|
|
A float64 `json:"a"`
|
2021-01-19 14:41:14 +03:00
|
|
|
B float64 `json:"b"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
2021-01-19 14:41:14 +03:00
|
|
|
B *struct {
|
|
|
|
A float64 `json:"a"`
|
2021-01-16 16:16:26 +03:00
|
|
|
B float64 `json:"b"`
|
|
|
|
}
|
2021-01-19 14:41:14 +03:00
|
|
|
}{A: &(struct {
|
2021-01-16 16:16:26 +03:00
|
|
|
A float64 `json:"a"`
|
|
|
|
B float64 `json:"b"`
|
2021-01-19 14:41:14 +03:00
|
|
|
}{A: 1, B: 2}), B: &(struct {
|
|
|
|
A float64 `json:"a"`
|
|
|
|
B float64 `json:"b"`
|
|
|
|
}{A: 3, B: 4})},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64DoubleMultiFieldsNotRootOmitEmpty",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: &struct {
|
|
|
|
A *struct {
|
|
|
|
A float64 `json:"a,omitempty"`
|
|
|
|
B float64 `json:"b,omitempty"`
|
|
|
|
}
|
|
|
|
B *struct {
|
|
|
|
A float64 `json:"a,omitempty"`
|
|
|
|
B float64 `json:"b,omitempty"`
|
|
|
|
}
|
|
|
|
}{A: &(struct {
|
|
|
|
A float64 `json:"a,omitempty"`
|
|
|
|
B float64 `json:"b,omitempty"`
|
|
|
|
}{A: 1, B: 2}), B: &(struct {
|
|
|
|
A float64 `json:"a,omitempty"`
|
|
|
|
B float64 `json:"b,omitempty"`
|
|
|
|
}{A: 3, B: 4})},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64DoubleMultiFieldsNotRootString",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: &struct {
|
|
|
|
A *struct {
|
2021-01-19 14:41:14 +03:00
|
|
|
A float64 `json:"a,string"`
|
|
|
|
B float64 `json:"b,string"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
|
|
|
B *struct {
|
2021-01-19 14:41:14 +03:00
|
|
|
A float64 `json:"a,string"`
|
|
|
|
B float64 `json:"b,string"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
|
|
|
}{A: &(struct {
|
2021-01-19 14:41:14 +03:00
|
|
|
A float64 `json:"a,string"`
|
|
|
|
B float64 `json:"b,string"`
|
|
|
|
}{A: 1, B: 2}), B: &(struct {
|
|
|
|
A float64 `json:"a,string"`
|
|
|
|
B float64 `json:"b,string"`
|
|
|
|
}{A: 3, B: 4})},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
2021-01-19 14:41:14 +03:00
|
|
|
|
|
|
|
// PtrHeadFloat64NilDoubleMultiFieldsNotRoot
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64NilDoubleMultiFieldsNotRoot",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: &struct {
|
|
|
|
A *struct {
|
2021-01-19 14:41:14 +03:00
|
|
|
A float64 `json:"a"`
|
|
|
|
B float64 `json:"b"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
|
|
|
B *struct {
|
2021-01-19 14:41:14 +03:00
|
|
|
A float64 `json:"a"`
|
|
|
|
B float64 `json:"b"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
|
|
|
}{A: nil, B: nil},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64NilDoubleMultiFieldsNotRootOmitEmpty",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: &struct {
|
2021-01-16 16:16:26 +03:00
|
|
|
A *struct {
|
2021-01-19 14:41:14 +03:00
|
|
|
A float64 `json:"a,omitempty"`
|
|
|
|
B float64 `json:"b,omitempty"`
|
|
|
|
} `json:",omitempty"`
|
2021-01-16 16:16:26 +03:00
|
|
|
B *struct {
|
2021-01-19 14:41:14 +03:00
|
|
|
A float64 `json:"a,omitempty"`
|
|
|
|
B float64 `json:"b,omitempty"`
|
|
|
|
} `json:",omitempty"`
|
|
|
|
}{A: nil, B: nil},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64NilDoubleMultiFieldsNotRootString",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: &struct {
|
|
|
|
A *struct {
|
2021-01-19 14:41:14 +03:00
|
|
|
A float64 `json:"a,string"`
|
|
|
|
B float64 `json:"b,string"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
|
|
|
B *struct {
|
2021-01-19 14:41:14 +03:00
|
|
|
A float64 `json:"a,string"`
|
|
|
|
B float64 `json:"b,string"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
2021-01-19 14:41:14 +03:00
|
|
|
}{A: nil, B: nil},
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
2021-01-19 14:41:14 +03:00
|
|
|
|
|
|
|
// PtrHeadFloat64NilDoubleMultiFieldsNotRoot
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64NilDoubleMultiFieldsNotRoot",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: (*struct {
|
2021-01-16 16:16:26 +03:00
|
|
|
A *struct {
|
|
|
|
A float64 `json:"a"`
|
|
|
|
B float64 `json:"b"`
|
|
|
|
}
|
|
|
|
B *struct {
|
|
|
|
A float64 `json:"a"`
|
|
|
|
B float64 `json:"b"`
|
|
|
|
}
|
2021-01-19 14:41:14 +03:00
|
|
|
})(nil),
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64NilDoubleMultiFieldsNotRootOmitEmpty",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: (*struct {
|
|
|
|
A *struct {
|
2021-01-19 14:41:14 +03:00
|
|
|
A float64 `json:"a,omitempty"`
|
|
|
|
B float64 `json:"b,omitempty"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
|
|
|
B *struct {
|
2021-01-19 14:41:14 +03:00
|
|
|
A float64 `json:"a,omitempty"`
|
|
|
|
B float64 `json:"b,omitempty"`
|
|
|
|
}
|
|
|
|
})(nil),
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64NilDoubleMultiFieldsNotRootString",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: (*struct {
|
|
|
|
A *struct {
|
|
|
|
A float64 `json:"a,string"`
|
|
|
|
B float64 `json:"b,string"`
|
|
|
|
}
|
|
|
|
B *struct {
|
|
|
|
A float64 `json:"a,string"`
|
|
|
|
B float64 `json:"b,string"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
|
|
|
})(nil),
|
|
|
|
},
|
2021-01-19 14:41:14 +03:00
|
|
|
|
|
|
|
// PtrHeadFloat64PtrDoubleMultiFieldsNotRoot
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64PtrDoubleMultiFieldsNotRoot",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: &struct {
|
|
|
|
A *struct {
|
|
|
|
A *float64 `json:"a"`
|
|
|
|
B *float64 `json:"b"`
|
|
|
|
}
|
|
|
|
B *struct {
|
|
|
|
A *float64 `json:"a"`
|
|
|
|
B *float64 `json:"b"`
|
|
|
|
}
|
|
|
|
}{A: &(struct {
|
|
|
|
A *float64 `json:"a"`
|
|
|
|
B *float64 `json:"b"`
|
|
|
|
}{A: float64ptr(1), B: float64ptr(2)}), B: &(struct {
|
|
|
|
A *float64 `json:"a"`
|
|
|
|
B *float64 `json:"b"`
|
|
|
|
}{A: float64ptr(3), B: float64ptr(4)})},
|
|
|
|
},
|
2021-01-19 14:41:14 +03:00
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64PtrDoubleMultiFieldsNotRootOmitEmpty",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: &struct {
|
|
|
|
A *struct {
|
|
|
|
A *float64 `json:"a,omitempty"`
|
|
|
|
B *float64 `json:"b,omitempty"`
|
|
|
|
}
|
|
|
|
B *struct {
|
|
|
|
A *float64 `json:"a,omitempty"`
|
|
|
|
B *float64 `json:"b,omitempty"`
|
|
|
|
}
|
|
|
|
}{A: &(struct {
|
|
|
|
A *float64 `json:"a,omitempty"`
|
|
|
|
B *float64 `json:"b,omitempty"`
|
|
|
|
}{A: float64ptr(1), B: float64ptr(2)}), B: &(struct {
|
|
|
|
A *float64 `json:"a,omitempty"`
|
|
|
|
B *float64 `json:"b,omitempty"`
|
|
|
|
}{A: float64ptr(3), B: float64ptr(4)})},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64PtrDoubleMultiFieldsNotRootString",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: &struct {
|
|
|
|
A *struct {
|
|
|
|
A *float64 `json:"a,string"`
|
|
|
|
B *float64 `json:"b,string"`
|
|
|
|
}
|
|
|
|
B *struct {
|
|
|
|
A *float64 `json:"a,string"`
|
|
|
|
B *float64 `json:"b,string"`
|
|
|
|
}
|
|
|
|
}{A: &(struct {
|
|
|
|
A *float64 `json:"a,string"`
|
|
|
|
B *float64 `json:"b,string"`
|
|
|
|
}{A: float64ptr(1), B: float64ptr(2)}), B: &(struct {
|
|
|
|
A *float64 `json:"a,string"`
|
|
|
|
B *float64 `json:"b,string"`
|
|
|
|
}{A: float64ptr(3), B: float64ptr(4)})},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadFloat64PtrNilDoubleMultiFieldsNotRoot
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64PtrNilDoubleMultiFieldsNotRoot",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: &struct {
|
|
|
|
A *struct {
|
|
|
|
A *float64 `json:"a"`
|
|
|
|
B *float64 `json:"b"`
|
|
|
|
}
|
|
|
|
B *struct {
|
|
|
|
A *float64 `json:"a"`
|
|
|
|
B *float64 `json:"b"`
|
|
|
|
}
|
|
|
|
}{A: nil, B: nil},
|
|
|
|
},
|
2021-01-19 14:41:14 +03:00
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64PtrNilDoubleMultiFieldsNotRootOmitEmpty",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: &struct {
|
|
|
|
A *struct {
|
|
|
|
A *float64 `json:"a,omitempty"`
|
|
|
|
B *float64 `json:"b,omitempty"`
|
|
|
|
} `json:",omitempty"`
|
|
|
|
B *struct {
|
|
|
|
A *float64 `json:"a,omitempty"`
|
|
|
|
B *float64 `json:"b,omitempty"`
|
|
|
|
} `json:",omitempty"`
|
|
|
|
}{A: nil, B: nil},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64PtrNilDoubleMultiFieldsNotRootString",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: &struct {
|
|
|
|
A *struct {
|
|
|
|
A *float64 `json:"a,string"`
|
|
|
|
B *float64 `json:"b,string"`
|
|
|
|
}
|
|
|
|
B *struct {
|
|
|
|
A *float64 `json:"a,string"`
|
|
|
|
B *float64 `json:"b,string"`
|
|
|
|
}
|
|
|
|
}{A: nil, B: nil},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrHeadFloat64PtrNilDoubleMultiFieldsNotRoot
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64PtrNilDoubleMultiFieldsNotRoot",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: (*struct {
|
|
|
|
A *struct {
|
|
|
|
A *float64 `json:"a"`
|
|
|
|
B *float64 `json:"b"`
|
|
|
|
}
|
|
|
|
B *struct {
|
|
|
|
A *float64 `json:"a"`
|
|
|
|
B *float64 `json:"b"`
|
|
|
|
}
|
|
|
|
})(nil),
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64PtrNilDoubleMultiFieldsNotRootOmitEmpty",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: (*struct {
|
|
|
|
A *struct {
|
|
|
|
A *float64 `json:"a,omitempty"`
|
|
|
|
B *float64 `json:"b,omitempty"`
|
|
|
|
}
|
|
|
|
B *struct {
|
|
|
|
A *float64 `json:"a,omitempty"`
|
|
|
|
B *float64 `json:"b,omitempty"`
|
|
|
|
}
|
|
|
|
})(nil),
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrHeadFloat64PtrNilDoubleMultiFieldsNotRootString",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: (*struct {
|
|
|
|
A *struct {
|
|
|
|
A *float64 `json:"a,string"`
|
|
|
|
B *float64 `json:"b,string"`
|
|
|
|
}
|
|
|
|
B *struct {
|
|
|
|
A *float64 `json:"a,string"`
|
|
|
|
B *float64 `json:"b,string"`
|
|
|
|
}
|
|
|
|
})(nil),
|
|
|
|
},
|
|
|
|
|
|
|
|
// AnonymousHeadFloat64
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "AnonymousHeadFloat64",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
structFloat64
|
|
|
|
B float64 `json:"b"`
|
|
|
|
}{
|
|
|
|
structFloat64: structFloat64{A: 1},
|
|
|
|
B: 2,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "AnonymousHeadFloat64OmitEmpty",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
structFloat64OmitEmpty
|
|
|
|
B float64 `json:"b,omitempty"`
|
|
|
|
}{
|
|
|
|
structFloat64OmitEmpty: structFloat64OmitEmpty{A: 1},
|
|
|
|
B: 2,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "AnonymousHeadFloat64String",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
structFloat64String
|
|
|
|
B float64 `json:"b,string"`
|
|
|
|
}{
|
|
|
|
structFloat64String: structFloat64String{A: 1},
|
|
|
|
B: 2,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrAnonymousHeadFloat64
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrAnonymousHeadFloat64",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
*structFloat64
|
|
|
|
B float64 `json:"b"`
|
|
|
|
}{
|
|
|
|
structFloat64: &structFloat64{A: 1},
|
|
|
|
B: 2,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrAnonymousHeadFloat64OmitEmpty",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
*structFloat64OmitEmpty
|
|
|
|
B float64 `json:"b,omitempty"`
|
|
|
|
}{
|
|
|
|
structFloat64OmitEmpty: &structFloat64OmitEmpty{A: 1},
|
|
|
|
B: 2,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrAnonymousHeadFloat64String",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
*structFloat64String
|
|
|
|
B float64 `json:"b,string"`
|
|
|
|
}{
|
|
|
|
structFloat64String: &structFloat64String{A: 1},
|
|
|
|
B: 2,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// NilPtrAnonymousHeadFloat64
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "NilPtrAnonymousHeadFloat64",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
2021-01-19 14:41:14 +03:00
|
|
|
*structFloat64
|
2021-01-16 16:16:26 +03:00
|
|
|
B float64 `json:"b"`
|
|
|
|
}{
|
2021-01-19 14:41:14 +03:00
|
|
|
structFloat64: nil,
|
2021-01-16 16:16:26 +03:00
|
|
|
B: 2,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "NilPtrAnonymousHeadFloat64OmitEmpty",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
2021-01-19 14:41:14 +03:00
|
|
|
*structFloat64OmitEmpty
|
|
|
|
B float64 `json:"b,omitempty"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}{
|
2021-01-19 14:41:14 +03:00
|
|
|
structFloat64OmitEmpty: nil,
|
|
|
|
B: 2,
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "NilPtrAnonymousHeadFloat64String",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
2021-01-19 14:41:14 +03:00
|
|
|
*structFloat64String
|
|
|
|
B float64 `json:"b,string"`
|
2021-01-16 16:16:26 +03:00
|
|
|
}{
|
2021-01-19 14:41:14 +03:00
|
|
|
structFloat64String: nil,
|
|
|
|
B: 2,
|
2021-01-16 16:16:26 +03:00
|
|
|
},
|
|
|
|
},
|
2021-01-19 14:41:14 +03:00
|
|
|
|
|
|
|
// AnonymousHeadFloat64Ptr
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "AnonymousHeadFloat64Ptr",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
structFloat64Ptr
|
|
|
|
B *float64 `json:"b"`
|
|
|
|
}{
|
|
|
|
structFloat64Ptr: structFloat64Ptr{A: float64ptr(1)},
|
|
|
|
B: float64ptr(2),
|
|
|
|
},
|
|
|
|
},
|
2021-01-19 14:41:14 +03:00
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "AnonymousHeadFloat64PtrOmitEmpty",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
structFloat64PtrOmitEmpty
|
|
|
|
B *float64 `json:"b,omitempty"`
|
|
|
|
}{
|
|
|
|
structFloat64PtrOmitEmpty: structFloat64PtrOmitEmpty{A: float64ptr(1)},
|
|
|
|
B: float64ptr(2),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "AnonymousHeadFloat64PtrString",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
structFloat64PtrString
|
|
|
|
B *float64 `json:"b,string"`
|
|
|
|
}{
|
|
|
|
structFloat64PtrString: structFloat64PtrString{A: float64ptr(1)},
|
|
|
|
B: float64ptr(2),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// AnonymousHeadFloat64PtrNil
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "AnonymousHeadFloat64PtrNil",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
structFloat64Ptr
|
|
|
|
B *float64 `json:"b"`
|
|
|
|
}{
|
|
|
|
structFloat64Ptr: structFloat64Ptr{A: nil},
|
|
|
|
B: float64ptr(2),
|
|
|
|
},
|
|
|
|
},
|
2021-01-19 14:41:14 +03:00
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "AnonymousHeadFloat64PtrNilOmitEmpty",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
structFloat64PtrOmitEmpty
|
|
|
|
B *float64 `json:"b,omitempty"`
|
|
|
|
}{
|
|
|
|
structFloat64PtrOmitEmpty: structFloat64PtrOmitEmpty{A: nil},
|
|
|
|
B: float64ptr(2),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "AnonymousHeadFloat64PtrNilString",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
structFloat64PtrString
|
|
|
|
B *float64 `json:"b,string"`
|
|
|
|
}{
|
|
|
|
structFloat64PtrString: structFloat64PtrString{A: nil},
|
|
|
|
B: float64ptr(2),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrAnonymousHeadFloat64Ptr
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrAnonymousHeadFloat64Ptr",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
*structFloat64Ptr
|
|
|
|
B *float64 `json:"b"`
|
|
|
|
}{
|
|
|
|
structFloat64Ptr: &structFloat64Ptr{A: float64ptr(1)},
|
|
|
|
B: float64ptr(2),
|
|
|
|
},
|
|
|
|
},
|
2021-01-19 14:41:14 +03:00
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrAnonymousHeadFloat64PtrOmitEmpty",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
*structFloat64PtrOmitEmpty
|
|
|
|
B *float64 `json:"b,omitempty"`
|
|
|
|
}{
|
|
|
|
structFloat64PtrOmitEmpty: &structFloat64PtrOmitEmpty{A: float64ptr(1)},
|
|
|
|
B: float64ptr(2),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrAnonymousHeadFloat64PtrString",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
*structFloat64PtrString
|
|
|
|
B *float64 `json:"b,string"`
|
|
|
|
}{
|
|
|
|
structFloat64PtrString: &structFloat64PtrString{A: float64ptr(1)},
|
|
|
|
B: float64ptr(2),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// NilPtrAnonymousHeadFloat64Ptr
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "NilPtrAnonymousHeadFloat64Ptr",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
*structFloat64Ptr
|
|
|
|
B *float64 `json:"b"`
|
|
|
|
}{
|
|
|
|
structFloat64Ptr: nil,
|
|
|
|
B: float64ptr(2),
|
|
|
|
},
|
|
|
|
},
|
2021-01-19 14:41:14 +03:00
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "NilPtrAnonymousHeadFloat64PtrOmitEmpty",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
*structFloat64PtrOmitEmpty
|
|
|
|
B *float64 `json:"b,omitempty"`
|
|
|
|
}{
|
|
|
|
structFloat64PtrOmitEmpty: nil,
|
|
|
|
B: float64ptr(2),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "NilPtrAnonymousHeadFloat64PtrString",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
*structFloat64PtrString
|
|
|
|
B *float64 `json:"b,string"`
|
|
|
|
}{
|
|
|
|
structFloat64PtrString: nil,
|
|
|
|
B: float64ptr(2),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// AnonymousHeadFloat64Only
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "AnonymousHeadFloat64Only",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
structFloat64
|
|
|
|
}{
|
|
|
|
structFloat64: structFloat64{A: 1},
|
|
|
|
},
|
|
|
|
},
|
2021-01-19 14:41:14 +03:00
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "AnonymousHeadFloat64OnlyOmitEmpty",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
structFloat64OmitEmpty
|
|
|
|
}{
|
|
|
|
structFloat64OmitEmpty: structFloat64OmitEmpty{A: 1},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "AnonymousHeadFloat64OnlyString",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
structFloat64String
|
|
|
|
}{
|
|
|
|
structFloat64String: structFloat64String{A: 1},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrAnonymousHeadFloat64Only
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrAnonymousHeadFloat64Only",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
*structFloat64
|
|
|
|
}{
|
|
|
|
structFloat64: &structFloat64{A: 1},
|
|
|
|
},
|
|
|
|
},
|
2021-01-19 14:41:14 +03:00
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrAnonymousHeadFloat64OnlyOmitEmpty",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
*structFloat64OmitEmpty
|
|
|
|
}{
|
|
|
|
structFloat64OmitEmpty: &structFloat64OmitEmpty{A: 1},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrAnonymousHeadFloat64OnlyString",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
*structFloat64String
|
|
|
|
}{
|
|
|
|
structFloat64String: &structFloat64String{A: 1},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// NilPtrAnonymousHeadFloat64Only
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "NilPtrAnonymousHeadFloat64Only",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
*structFloat64
|
|
|
|
}{
|
|
|
|
structFloat64: nil,
|
|
|
|
},
|
|
|
|
},
|
2021-01-19 14:41:14 +03:00
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "NilPtrAnonymousHeadFloat64OnlyOmitEmpty",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
*structFloat64OmitEmpty
|
|
|
|
}{
|
|
|
|
structFloat64OmitEmpty: nil,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "NilPtrAnonymousHeadFloat64OnlyString",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
*structFloat64String
|
|
|
|
}{
|
|
|
|
structFloat64String: nil,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// AnonymousHeadFloat64PtrOnly
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "AnonymousHeadFloat64PtrOnly",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
structFloat64Ptr
|
|
|
|
}{
|
|
|
|
structFloat64Ptr: structFloat64Ptr{A: float64ptr(1)},
|
|
|
|
},
|
|
|
|
},
|
2021-01-19 14:41:14 +03:00
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "AnonymousHeadFloat64PtrOnlyOmitEmpty",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
structFloat64PtrOmitEmpty
|
|
|
|
}{
|
|
|
|
structFloat64PtrOmitEmpty: structFloat64PtrOmitEmpty{A: float64ptr(1)},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "AnonymousHeadFloat64PtrOnlyString",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
structFloat64PtrString
|
|
|
|
}{
|
|
|
|
structFloat64PtrString: structFloat64PtrString{A: float64ptr(1)},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// AnonymousHeadFloat64PtrNilOnly
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "AnonymousHeadFloat64PtrNilOnly",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
structFloat64Ptr
|
|
|
|
}{
|
|
|
|
structFloat64Ptr: structFloat64Ptr{A: nil},
|
|
|
|
},
|
|
|
|
},
|
2021-01-19 14:41:14 +03:00
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "AnonymousHeadFloat64PtrNilOnlyOmitEmpty",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
structFloat64PtrOmitEmpty
|
|
|
|
}{
|
|
|
|
structFloat64PtrOmitEmpty: structFloat64PtrOmitEmpty{A: nil},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "AnonymousHeadFloat64PtrNilOnlyString",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
structFloat64PtrString
|
|
|
|
}{
|
|
|
|
structFloat64PtrString: structFloat64PtrString{A: nil},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// PtrAnonymousHeadFloat64PtrOnly
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrAnonymousHeadFloat64PtrOnly",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
*structFloat64Ptr
|
|
|
|
}{
|
|
|
|
structFloat64Ptr: &structFloat64Ptr{A: float64ptr(1)},
|
|
|
|
},
|
|
|
|
},
|
2021-01-19 14:41:14 +03:00
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrAnonymousHeadFloat64PtrOnlyOmitEmpty",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
*structFloat64PtrOmitEmpty
|
|
|
|
}{
|
|
|
|
structFloat64PtrOmitEmpty: &structFloat64PtrOmitEmpty{A: float64ptr(1)},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "PtrAnonymousHeadFloat64PtrOnlyString",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
*structFloat64PtrString
|
|
|
|
}{
|
|
|
|
structFloat64PtrString: &structFloat64PtrString{A: float64ptr(1)},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// NilPtrAnonymousHeadFloat64PtrOnly
|
2021-01-16 16:16:26 +03:00
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "NilPtrAnonymousHeadFloat64PtrOnly",
|
2021-01-16 16:16:26 +03:00
|
|
|
data: struct {
|
|
|
|
*structFloat64Ptr
|
|
|
|
}{
|
|
|
|
structFloat64Ptr: nil,
|
|
|
|
},
|
|
|
|
},
|
2021-01-19 14:41:14 +03:00
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "NilPtrAnonymousHeadFloat64PtrOnlyOmitEmpty",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
*structFloat64PtrOmitEmpty
|
|
|
|
}{
|
|
|
|
structFloat64PtrOmitEmpty: nil,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2021-02-15 05:31:26 +03:00
|
|
|
name: "NilPtrAnonymousHeadFloat64PtrOnlyString",
|
2021-01-19 14:41:14 +03:00
|
|
|
data: struct {
|
|
|
|
*structFloat64PtrString
|
|
|
|
}{
|
|
|
|
structFloat64PtrString: 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:31:26 +03:00
|
|
|
t.Fatalf("%s(htmlEscape:%T): %+v: %s", test.name, htmlEscape, test.data, err)
|
2021-01-16 16:16:26 +03:00
|
|
|
}
|
2021-01-19 14:41:14 +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
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|