mirror of https://github.com/goccy/go-json.git
Add test case for float64 type
This commit is contained in:
parent
3fa9900acb
commit
440e24181b
|
@ -17,6 +17,9 @@ func TestCoverFloat64(t *testing.T) {
|
|||
type structFloat64String struct {
|
||||
A float64 `json:"a,string"`
|
||||
}
|
||||
type structFloat64StringOmitEmpty struct {
|
||||
A float64 `json:"a,string,omitempty"`
|
||||
}
|
||||
|
||||
type structFloat64Ptr struct {
|
||||
A *float64 `json:"a"`
|
||||
|
@ -27,6 +30,9 @@ func TestCoverFloat64(t *testing.T) {
|
|||
type structFloat64PtrString struct {
|
||||
A *float64 `json:"a,string"`
|
||||
}
|
||||
type structFloat64PtrStringOmitEmpty struct {
|
||||
A *float64 `json:"a,string,omitempty"`
|
||||
}
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
|
@ -72,6 +78,12 @@ func TestCoverFloat64(t *testing.T) {
|
|||
A float64 `json:"a,string"`
|
||||
}{},
|
||||
},
|
||||
{
|
||||
name: "HeadFloat64ZeroStringOmitEmpty",
|
||||
data: struct {
|
||||
A float64 `json:"a,string,omitempty"`
|
||||
}{},
|
||||
},
|
||||
|
||||
// HeadFloat64
|
||||
{
|
||||
|
@ -92,6 +104,12 @@ func TestCoverFloat64(t *testing.T) {
|
|||
A float64 `json:"a,string"`
|
||||
}{A: 1},
|
||||
},
|
||||
{
|
||||
name: "HeadFloat64StringOmitEmpty",
|
||||
data: struct {
|
||||
A float64 `json:"a,string,omitempty"`
|
||||
}{A: 1},
|
||||
},
|
||||
|
||||
// HeadFloat64Ptr
|
||||
{
|
||||
|
@ -112,6 +130,12 @@ func TestCoverFloat64(t *testing.T) {
|
|||
A *float64 `json:"a,string"`
|
||||
}{A: float64ptr(1)},
|
||||
},
|
||||
{
|
||||
name: "HeadFloat64PtrStringOmitEmpty",
|
||||
data: struct {
|
||||
A *float64 `json:"a,string,omitempty"`
|
||||
}{A: float64ptr(1)},
|
||||
},
|
||||
|
||||
// HeadFloat64PtrNil
|
||||
{
|
||||
|
@ -132,6 +156,12 @@ func TestCoverFloat64(t *testing.T) {
|
|||
A *float64 `json:"a,string"`
|
||||
}{A: nil},
|
||||
},
|
||||
{
|
||||
name: "HeadFloat64PtrNilStringOmitEmpty",
|
||||
data: struct {
|
||||
A *float64 `json:"a,string,omitempty"`
|
||||
}{A: nil},
|
||||
},
|
||||
|
||||
// PtrHeadFloat64Zero
|
||||
{
|
||||
|
@ -152,6 +182,12 @@ func TestCoverFloat64(t *testing.T) {
|
|||
A float64 `json:"a,string"`
|
||||
}{},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadFloat64ZeroStringOmitEmpty",
|
||||
data: &struct {
|
||||
A float64 `json:"a,string,omitempty"`
|
||||
}{},
|
||||
},
|
||||
|
||||
// PtrHeadFloat64
|
||||
{
|
||||
|
@ -172,6 +208,12 @@ func TestCoverFloat64(t *testing.T) {
|
|||
A float64 `json:"a,string"`
|
||||
}{A: 1},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadFloat64StringOmitEmpty",
|
||||
data: &struct {
|
||||
A float64 `json:"a,string,omitempty"`
|
||||
}{A: 1},
|
||||
},
|
||||
|
||||
// PtrHeadFloat64Ptr
|
||||
{
|
||||
|
@ -192,6 +234,12 @@ func TestCoverFloat64(t *testing.T) {
|
|||
A *float64 `json:"a,string"`
|
||||
}{A: float64ptr(1)},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadFloat64PtrStringOmitEmpty",
|
||||
data: &struct {
|
||||
A *float64 `json:"a,string,omitempty"`
|
||||
}{A: float64ptr(1)},
|
||||
},
|
||||
|
||||
// PtrHeadFloat64PtrNil
|
||||
{
|
||||
|
@ -212,6 +260,12 @@ func TestCoverFloat64(t *testing.T) {
|
|||
A *float64 `json:"a,string"`
|
||||
}{A: nil},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadFloat64PtrNilStringOmitEmpty",
|
||||
data: &struct {
|
||||
A *float64 `json:"a,string,omitempty"`
|
||||
}{A: nil},
|
||||
},
|
||||
|
||||
// PtrHeadFloat64Nil
|
||||
{
|
||||
|
@ -232,6 +286,12 @@ func TestCoverFloat64(t *testing.T) {
|
|||
A *float64 `json:"a,string"`
|
||||
})(nil),
|
||||
},
|
||||
{
|
||||
name: "PtrHeadFloat64NilStringOmitEmpty",
|
||||
data: (*struct {
|
||||
A *float64 `json:"a,string,omitempty"`
|
||||
})(nil),
|
||||
},
|
||||
|
||||
// HeadFloat64ZeroMultiFields
|
||||
{
|
||||
|
@ -251,13 +311,21 @@ func TestCoverFloat64(t *testing.T) {
|
|||
}{},
|
||||
},
|
||||
{
|
||||
name: "HeadFloat64ZeroMultiFields",
|
||||
name: "HeadFloat64ZeroMultiFieldsString",
|
||||
data: struct {
|
||||
A float64 `json:"a,string"`
|
||||
B float64 `json:"b,string"`
|
||||
C float64 `json:"c,string"`
|
||||
}{},
|
||||
},
|
||||
{
|
||||
name: "HeadFloat64ZeroMultiFieldsStringOmitEmpty",
|
||||
data: struct {
|
||||
A float64 `json:"a,string,omitempty"`
|
||||
B float64 `json:"b,string,omitempty"`
|
||||
C float64 `json:"c,string,omitempty"`
|
||||
}{},
|
||||
},
|
||||
|
||||
// HeadFloat64MultiFields
|
||||
{
|
||||
|
@ -284,6 +352,14 @@ func TestCoverFloat64(t *testing.T) {
|
|||
C float64 `json:"c,string"`
|
||||
}{A: 1, B: 2, C: 3},
|
||||
},
|
||||
{
|
||||
name: "HeadFloat64MultiFieldsStringOmitEmpty",
|
||||
data: struct {
|
||||
A float64 `json:"a,string,omitempty"`
|
||||
B float64 `json:"b,string,omitempty"`
|
||||
C float64 `json:"c,string,omitempty"`
|
||||
}{A: 1, B: 2, C: 3},
|
||||
},
|
||||
|
||||
// HeadFloat64PtrMultiFields
|
||||
{
|
||||
|
@ -310,6 +386,14 @@ func TestCoverFloat64(t *testing.T) {
|
|||
C *float64 `json:"c,string"`
|
||||
}{A: float64ptr(1), B: float64ptr(2), C: float64ptr(3)},
|
||||
},
|
||||
{
|
||||
name: "HeadFloat64PtrMultiFieldsStringOmitEmpty",
|
||||
data: struct {
|
||||
A *float64 `json:"a,string,omitempty"`
|
||||
B *float64 `json:"b,string,omitempty"`
|
||||
C *float64 `json:"c,string,omitempty"`
|
||||
}{A: float64ptr(1), B: float64ptr(2), C: float64ptr(3)},
|
||||
},
|
||||
|
||||
// HeadFloat64PtrNilMultiFields
|
||||
{
|
||||
|
@ -336,6 +420,14 @@ func TestCoverFloat64(t *testing.T) {
|
|||
C *float64 `json:"c,string"`
|
||||
}{A: nil, B: nil, C: nil},
|
||||
},
|
||||
{
|
||||
name: "HeadFloat64PtrNilMultiFieldsStringOmitEmpty",
|
||||
data: struct {
|
||||
A *float64 `json:"a,string,omitempty"`
|
||||
B *float64 `json:"b,string,omitempty"`
|
||||
C *float64 `json:"c,string,omitempty"`
|
||||
}{A: nil, B: nil, C: nil},
|
||||
},
|
||||
|
||||
// PtrHeadFloat64ZeroMultiFields
|
||||
{
|
||||
|
@ -359,6 +451,13 @@ func TestCoverFloat64(t *testing.T) {
|
|||
B float64 `json:"b,string"`
|
||||
}{},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadFloat64ZeroMultiFieldsStringOmitEmpty",
|
||||
data: &struct {
|
||||
A float64 `json:"a,string,omitempty"`
|
||||
B float64 `json:"b,string,omitempty"`
|
||||
}{},
|
||||
},
|
||||
|
||||
// PtrHeadFloat64MultiFields
|
||||
{
|
||||
|
@ -382,6 +481,13 @@ func TestCoverFloat64(t *testing.T) {
|
|||
B float64 `json:"b,string"`
|
||||
}{A: 1, B: 2},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadFloat64MultiFieldsStringOmitEmpty",
|
||||
data: &struct {
|
||||
A float64 `json:"a,string,omitempty"`
|
||||
B float64 `json:"b,string,omitempty"`
|
||||
}{A: 1, B: 2},
|
||||
},
|
||||
|
||||
// PtrHeadFloat64PtrMultiFields
|
||||
{
|
||||
|
@ -405,6 +511,13 @@ func TestCoverFloat64(t *testing.T) {
|
|||
B *float64 `json:"b,string"`
|
||||
}{A: float64ptr(1), B: float64ptr(2)},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadFloat64PtrMultiFieldsStringOmitEmpty",
|
||||
data: &struct {
|
||||
A *float64 `json:"a,string,omitempty"`
|
||||
B *float64 `json:"b,string,omitempty"`
|
||||
}{A: float64ptr(1), B: float64ptr(2)},
|
||||
},
|
||||
|
||||
// PtrHeadFloat64PtrNilMultiFields
|
||||
{
|
||||
|
@ -428,6 +541,13 @@ func TestCoverFloat64(t *testing.T) {
|
|||
B *float64 `json:"b,string"`
|
||||
}{A: nil, B: nil},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadFloat64PtrNilMultiFieldsStringOmitEmpty",
|
||||
data: &struct {
|
||||
A *float64 `json:"a,string,omitempty"`
|
||||
B *float64 `json:"b,string,omitempty"`
|
||||
}{A: nil, B: nil},
|
||||
},
|
||||
|
||||
// PtrHeadFloat64NilMultiFields
|
||||
{
|
||||
|
@ -451,6 +571,13 @@ func TestCoverFloat64(t *testing.T) {
|
|||
B *float64 `json:"b,string"`
|
||||
})(nil),
|
||||
},
|
||||
{
|
||||
name: "PtrHeadFloat64NilMultiFieldsStringOmitEmpty",
|
||||
data: (*struct {
|
||||
A *float64 `json:"a,string,omitempty"`
|
||||
B *float64 `json:"b,string,omitempty"`
|
||||
})(nil),
|
||||
},
|
||||
|
||||
// HeadFloat64ZeroNotRoot
|
||||
{
|
||||
|
@ -477,6 +604,14 @@ func TestCoverFloat64(t *testing.T) {
|
|||
}
|
||||
}{},
|
||||
},
|
||||
{
|
||||
name: "HeadFloat64ZeroNotRootStringOmitEmpty",
|
||||
data: struct {
|
||||
A struct {
|
||||
A float64 `json:"a,string,omitempty"`
|
||||
}
|
||||
}{},
|
||||
},
|
||||
|
||||
// HeadFloat64NotRoot
|
||||
{
|
||||
|
@ -509,6 +644,16 @@ func TestCoverFloat64(t *testing.T) {
|
|||
A float64 `json:"a,string"`
|
||||
}{A: 1}},
|
||||
},
|
||||
{
|
||||
name: "HeadFloat64NotRootStringOmitEmpty",
|
||||
data: struct {
|
||||
A struct {
|
||||
A float64 `json:"a,string,omitempty"`
|
||||
}
|
||||
}{A: struct {
|
||||
A float64 `json:"a,string,omitempty"`
|
||||
}{A: 1}},
|
||||
},
|
||||
|
||||
// HeadFloat64PtrNotRoot
|
||||
{
|
||||
|
@ -541,6 +686,16 @@ func TestCoverFloat64(t *testing.T) {
|
|||
A *float64 `json:"a,string"`
|
||||
}{float64ptr(1)}},
|
||||
},
|
||||
{
|
||||
name: "HeadFloat64PtrNotRootStringOmitEmpty",
|
||||
data: struct {
|
||||
A struct {
|
||||
A *float64 `json:"a,string,omitempty"`
|
||||
}
|
||||
}{A: struct {
|
||||
A *float64 `json:"a,string,omitempty"`
|
||||
}{float64ptr(1)}},
|
||||
},
|
||||
|
||||
// HeadFloat64PtrNilNotRoot
|
||||
{
|
||||
|
@ -567,6 +722,14 @@ func TestCoverFloat64(t *testing.T) {
|
|||
}
|
||||
}{},
|
||||
},
|
||||
{
|
||||
name: "HeadFloat64PtrNilNotRootStringOmitEmpty",
|
||||
data: struct {
|
||||
A struct {
|
||||
A *float64 `json:"a,string,omitempty"`
|
||||
}
|
||||
}{},
|
||||
},
|
||||
|
||||
// PtrHeadFloat64ZeroNotRoot
|
||||
{
|
||||
|
@ -599,6 +762,16 @@ func TestCoverFloat64(t *testing.T) {
|
|||
A float64 `json:"a,string"`
|
||||
})},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadFloat64ZeroNotRootStringOmitEmpty",
|
||||
data: struct {
|
||||
A *struct {
|
||||
A float64 `json:"a,string,omitempty"`
|
||||
}
|
||||
}{A: new(struct {
|
||||
A float64 `json:"a,string,omitempty"`
|
||||
})},
|
||||
},
|
||||
|
||||
// PtrHeadFloat64NotRoot
|
||||
{
|
||||
|
@ -631,6 +804,16 @@ func TestCoverFloat64(t *testing.T) {
|
|||
A float64 `json:"a,string"`
|
||||
}{A: 1})},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadFloat64NotRootStringOmitEmpty",
|
||||
data: struct {
|
||||
A *struct {
|
||||
A float64 `json:"a,string,omitempty"`
|
||||
}
|
||||
}{A: &(struct {
|
||||
A float64 `json:"a,string,omitempty"`
|
||||
}{A: 1})},
|
||||
},
|
||||
|
||||
// PtrHeadFloat64PtrNotRoot
|
||||
{
|
||||
|
@ -663,6 +846,16 @@ func TestCoverFloat64(t *testing.T) {
|
|||
A *float64 `json:"a,string"`
|
||||
}{A: float64ptr(1)})},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadFloat64PtrNotRootStringOmitEmpty",
|
||||
data: struct {
|
||||
A *struct {
|
||||
A *float64 `json:"a,string,omitempty"`
|
||||
}
|
||||
}{A: &(struct {
|
||||
A *float64 `json:"a,string,omitempty"`
|
||||
}{A: float64ptr(1)})},
|
||||
},
|
||||
|
||||
// PtrHeadFloat64PtrNilNotRoot
|
||||
{
|
||||
|
@ -695,6 +888,16 @@ func TestCoverFloat64(t *testing.T) {
|
|||
A *float64 `json:"a,string"`
|
||||
}{A: nil})},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadFloat64PtrNilNotRootStringOmitEmpty",
|
||||
data: struct {
|
||||
A *struct {
|
||||
A *float64 `json:"a,string,omitempty"`
|
||||
}
|
||||
}{A: &(struct {
|
||||
A *float64 `json:"a,string,omitempty"`
|
||||
}{A: nil})},
|
||||
},
|
||||
|
||||
// PtrHeadFloat64NilNotRoot
|
||||
{
|
||||
|
@ -721,6 +924,14 @@ func TestCoverFloat64(t *testing.T) {
|
|||
} `json:",string"`
|
||||
}{A: nil},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadFloat64NilNotRootStringOmitEmpty",
|
||||
data: struct {
|
||||
A *struct {
|
||||
A *float64 `json:"a,string,omitempty"`
|
||||
} `json:",string,omitempty"`
|
||||
}{A: nil},
|
||||
},
|
||||
|
||||
// HeadFloat64ZeroMultiFieldsNotRoot
|
||||
{
|
||||
|
@ -756,6 +967,17 @@ func TestCoverFloat64(t *testing.T) {
|
|||
}
|
||||
}{},
|
||||
},
|
||||
{
|
||||
name: "HeadFloat64ZeroMultiFieldsNotRootStringOmitEmpty",
|
||||
data: struct {
|
||||
A struct {
|
||||
A float64 `json:"a,string,omitempty"`
|
||||
}
|
||||
B struct {
|
||||
B float64 `json:"b,string,omitempty"`
|
||||
}
|
||||
}{},
|
||||
},
|
||||
|
||||
// HeadFloat64MultiFieldsNotRoot
|
||||
{
|
||||
|
@ -803,6 +1025,21 @@ func TestCoverFloat64(t *testing.T) {
|
|||
B float64 `json:"b,string"`
|
||||
}{B: 2}},
|
||||
},
|
||||
{
|
||||
name: "HeadFloat64MultiFieldsNotRootStringOmitEmpty",
|
||||
data: struct {
|
||||
A struct {
|
||||
A float64 `json:"a,string,omitempty"`
|
||||
}
|
||||
B struct {
|
||||
B float64 `json:"b,string,omitempty"`
|
||||
}
|
||||
}{A: struct {
|
||||
A float64 `json:"a,string,omitempty"`
|
||||
}{A: 1}, B: struct {
|
||||
B float64 `json:"b,string,omitempty"`
|
||||
}{B: 2}},
|
||||
},
|
||||
|
||||
// HeadFloat64PtrMultiFieldsNotRoot
|
||||
{
|
||||
|
@ -850,6 +1087,21 @@ func TestCoverFloat64(t *testing.T) {
|
|||
B *float64 `json:"b,string"`
|
||||
}{B: float64ptr(2)}},
|
||||
},
|
||||
{
|
||||
name: "HeadFloat64PtrMultiFieldsNotRootStringOmitEmpty",
|
||||
data: struct {
|
||||
A struct {
|
||||
A *float64 `json:"a,string,omitempty"`
|
||||
}
|
||||
B struct {
|
||||
B *float64 `json:"b,string,omitempty"`
|
||||
}
|
||||
}{A: struct {
|
||||
A *float64 `json:"a,string,omitempty"`
|
||||
}{A: float64ptr(1)}, B: struct {
|
||||
B *float64 `json:"b,string,omitempty"`
|
||||
}{B: float64ptr(2)}},
|
||||
},
|
||||
|
||||
// HeadFloat64PtrNilMultiFieldsNotRoot
|
||||
{
|
||||
|
@ -897,6 +1149,21 @@ func TestCoverFloat64(t *testing.T) {
|
|||
B *float64 `json:"b,string"`
|
||||
}{B: nil}},
|
||||
},
|
||||
{
|
||||
name: "HeadFloat64PtrNilMultiFieldsNotRootStringOmitEmpty",
|
||||
data: struct {
|
||||
A struct {
|
||||
A *float64 `json:"a,string,omitempty"`
|
||||
}
|
||||
B struct {
|
||||
B *float64 `json:"b,string,omitempty"`
|
||||
}
|
||||
}{A: struct {
|
||||
A *float64 `json:"a,string,omitempty"`
|
||||
}{A: nil}, B: struct {
|
||||
B *float64 `json:"b,string,omitempty"`
|
||||
}{B: nil}},
|
||||
},
|
||||
|
||||
// PtrHeadFloat64ZeroMultiFieldsNotRoot
|
||||
{
|
||||
|
@ -932,6 +1199,17 @@ func TestCoverFloat64(t *testing.T) {
|
|||
}
|
||||
}{},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadFloat64ZeroMultiFieldsNotRootStringOmitEmpty",
|
||||
data: &struct {
|
||||
A struct {
|
||||
A float64 `json:"a,string,omitempty"`
|
||||
}
|
||||
B struct {
|
||||
B float64 `json:"b,string,omitempty"`
|
||||
}
|
||||
}{},
|
||||
},
|
||||
|
||||
// PtrHeadFloat64MultiFieldsNotRoot
|
||||
{
|
||||
|
@ -979,6 +1257,21 @@ func TestCoverFloat64(t *testing.T) {
|
|||
B float64 `json:"b,string"`
|
||||
}{B: 2}},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadFloat64MultiFieldsNotRootStringOmitEmpty",
|
||||
data: &struct {
|
||||
A struct {
|
||||
A float64 `json:"a,string,omitempty"`
|
||||
}
|
||||
B struct {
|
||||
B float64 `json:"b,string,omitempty"`
|
||||
}
|
||||
}{A: struct {
|
||||
A float64 `json:"a,string,omitempty"`
|
||||
}{A: 1}, B: struct {
|
||||
B float64 `json:"b,string,omitempty"`
|
||||
}{B: 2}},
|
||||
},
|
||||
|
||||
// PtrHeadFloat64PtrMultiFieldsNotRoot
|
||||
{
|
||||
|
@ -1026,6 +1319,21 @@ func TestCoverFloat64(t *testing.T) {
|
|||
B *float64 `json:"b,string"`
|
||||
}{B: float64ptr(2)})},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadFloat64PtrMultiFieldsNotRootStringOmitEmpty",
|
||||
data: &struct {
|
||||
A *struct {
|
||||
A *float64 `json:"a,string,omitempty"`
|
||||
}
|
||||
B *struct {
|
||||
B *float64 `json:"b,string,omitempty"`
|
||||
}
|
||||
}{A: &(struct {
|
||||
A *float64 `json:"a,string,omitempty"`
|
||||
}{A: float64ptr(1)}), B: &(struct {
|
||||
B *float64 `json:"b,string,omitempty"`
|
||||
}{B: float64ptr(2)})},
|
||||
},
|
||||
|
||||
// PtrHeadFloat64PtrNilMultiFieldsNotRoot
|
||||
{
|
||||
|
@ -1061,6 +1369,17 @@ func TestCoverFloat64(t *testing.T) {
|
|||
} `json:",string"`
|
||||
}{A: nil, B: nil},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadFloat64PtrNilMultiFieldsNotRootStringOmitEmpty",
|
||||
data: &struct {
|
||||
A *struct {
|
||||
A *float64 `json:"a,string,omitempty"`
|
||||
} `json:",string,omitempty"`
|
||||
B *struct {
|
||||
B *float64 `json:"b,string,omitempty"`
|
||||
} `json:",string,omitempty"`
|
||||
}{A: nil, B: nil},
|
||||
},
|
||||
|
||||
// PtrHeadFloat64NilMultiFieldsNotRoot
|
||||
{
|
||||
|
@ -1096,6 +1415,17 @@ func TestCoverFloat64(t *testing.T) {
|
|||
}
|
||||
})(nil),
|
||||
},
|
||||
{
|
||||
name: "PtrHeadFloat64NilMultiFieldsNotRootStringOmitEmpty",
|
||||
data: (*struct {
|
||||
A *struct {
|
||||
A *float64 `json:"a,string,omitempty"`
|
||||
}
|
||||
B *struct {
|
||||
B *float64 `json:"b,string,omitempty"`
|
||||
}
|
||||
})(nil),
|
||||
},
|
||||
|
||||
// PtrHeadFloat64DoubleMultiFieldsNotRoot
|
||||
{
|
||||
|
@ -1155,6 +1485,25 @@ func TestCoverFloat64(t *testing.T) {
|
|||
B float64 `json:"b,string"`
|
||||
}{A: 3, B: 4})},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadFloat64DoubleMultiFieldsNotRootStringOmitEmpty",
|
||||
data: &struct {
|
||||
A *struct {
|
||||
A float64 `json:"a,string,omitempty"`
|
||||
B float64 `json:"b,string,omitempty"`
|
||||
}
|
||||
B *struct {
|
||||
A float64 `json:"a,string,omitempty"`
|
||||
B float64 `json:"b,string,omitempty"`
|
||||
}
|
||||
}{A: &(struct {
|
||||
A float64 `json:"a,string,omitempty"`
|
||||
B float64 `json:"b,string,omitempty"`
|
||||
}{A: 1, B: 2}), B: &(struct {
|
||||
A float64 `json:"a,string,omitempty"`
|
||||
B float64 `json:"b,string,omitempty"`
|
||||
}{A: 3, B: 4})},
|
||||
},
|
||||
|
||||
// PtrHeadFloat64NilDoubleMultiFieldsNotRoot
|
||||
{
|
||||
|
@ -1196,6 +1545,19 @@ func TestCoverFloat64(t *testing.T) {
|
|||
}
|
||||
}{A: nil, B: nil},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadFloat64NilDoubleMultiFieldsNotRootStringOmitEmpty",
|
||||
data: &struct {
|
||||
A *struct {
|
||||
A float64 `json:"a,string,omitempty"`
|
||||
B float64 `json:"b,string,omitempty"`
|
||||
}
|
||||
B *struct {
|
||||
A float64 `json:"a,string,omitempty"`
|
||||
B float64 `json:"b,string,omitempty"`
|
||||
}
|
||||
}{A: nil, B: nil},
|
||||
},
|
||||
|
||||
// PtrHeadFloat64NilDoubleMultiFieldsNotRoot
|
||||
{
|
||||
|
@ -1237,6 +1599,19 @@ func TestCoverFloat64(t *testing.T) {
|
|||
}
|
||||
})(nil),
|
||||
},
|
||||
{
|
||||
name: "PtrHeadFloat64NilDoubleMultiFieldsNotRootStringOmitEmpty",
|
||||
data: (*struct {
|
||||
A *struct {
|
||||
A float64 `json:"a,string,omitempty"`
|
||||
B float64 `json:"b,string,omitempty"`
|
||||
}
|
||||
B *struct {
|
||||
A float64 `json:"a,string,omitempty"`
|
||||
B float64 `json:"b,string,omitempty"`
|
||||
}
|
||||
})(nil),
|
||||
},
|
||||
|
||||
// PtrHeadFloat64PtrDoubleMultiFieldsNotRoot
|
||||
{
|
||||
|
@ -1296,6 +1671,25 @@ func TestCoverFloat64(t *testing.T) {
|
|||
B *float64 `json:"b,string"`
|
||||
}{A: float64ptr(3), B: float64ptr(4)})},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadFloat64PtrDoubleMultiFieldsNotRootStringOmitEmpty",
|
||||
data: &struct {
|
||||
A *struct {
|
||||
A *float64 `json:"a,string,omitempty"`
|
||||
B *float64 `json:"b,string,omitempty"`
|
||||
}
|
||||
B *struct {
|
||||
A *float64 `json:"a,string,omitempty"`
|
||||
B *float64 `json:"b,string,omitempty"`
|
||||
}
|
||||
}{A: &(struct {
|
||||
A *float64 `json:"a,string,omitempty"`
|
||||
B *float64 `json:"b,string,omitempty"`
|
||||
}{A: float64ptr(1), B: float64ptr(2)}), B: &(struct {
|
||||
A *float64 `json:"a,string,omitempty"`
|
||||
B *float64 `json:"b,string,omitempty"`
|
||||
}{A: float64ptr(3), B: float64ptr(4)})},
|
||||
},
|
||||
|
||||
// PtrHeadFloat64PtrNilDoubleMultiFieldsNotRoot
|
||||
{
|
||||
|
@ -1337,6 +1731,19 @@ func TestCoverFloat64(t *testing.T) {
|
|||
}
|
||||
}{A: nil, B: nil},
|
||||
},
|
||||
{
|
||||
name: "PtrHeadFloat64PtrNilDoubleMultiFieldsNotRootStringOmitEmpty",
|
||||
data: &struct {
|
||||
A *struct {
|
||||
A *float64 `json:"a,string,omitempty"`
|
||||
B *float64 `json:"b,string,omitempty"`
|
||||
}
|
||||
B *struct {
|
||||
A *float64 `json:"a,string,omitempty"`
|
||||
B *float64 `json:"b,string,omitempty"`
|
||||
}
|
||||
}{A: nil, B: nil},
|
||||
},
|
||||
|
||||
// PtrHeadFloat64PtrNilDoubleMultiFieldsNotRoot
|
||||
{
|
||||
|
@ -1378,6 +1785,19 @@ func TestCoverFloat64(t *testing.T) {
|
|||
}
|
||||
})(nil),
|
||||
},
|
||||
{
|
||||
name: "PtrHeadFloat64PtrNilDoubleMultiFieldsNotRootStringOmitEmpty",
|
||||
data: (*struct {
|
||||
A *struct {
|
||||
A *float64 `json:"a,string,omitempty"`
|
||||
B *float64 `json:"b,string,omitempty"`
|
||||
}
|
||||
B *struct {
|
||||
A *float64 `json:"a,string,omitempty"`
|
||||
B *float64 `json:"b,string,omitempty"`
|
||||
}
|
||||
})(nil),
|
||||
},
|
||||
|
||||
// AnonymousHeadFloat64
|
||||
{
|
||||
|
@ -1410,6 +1830,16 @@ func TestCoverFloat64(t *testing.T) {
|
|||
B: 2,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "AnonymousHeadFloat64StringOmitEmpty",
|
||||
data: struct {
|
||||
structFloat64StringOmitEmpty
|
||||
B float64 `json:"b,string,omitempty"`
|
||||
}{
|
||||
structFloat64StringOmitEmpty: structFloat64StringOmitEmpty{A: 1},
|
||||
B: 2,
|
||||
},
|
||||
},
|
||||
|
||||
// PtrAnonymousHeadFloat64
|
||||
{
|
||||
|
@ -1442,6 +1872,16 @@ func TestCoverFloat64(t *testing.T) {
|
|||
B: 2,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "PtrAnonymousHeadFloat64StringOmitEmpty",
|
||||
data: struct {
|
||||
*structFloat64StringOmitEmpty
|
||||
B float64 `json:"b,string,omitempty"`
|
||||
}{
|
||||
structFloat64StringOmitEmpty: &structFloat64StringOmitEmpty{A: 1},
|
||||
B: 2,
|
||||
},
|
||||
},
|
||||
|
||||
// NilPtrAnonymousHeadFloat64
|
||||
{
|
||||
|
@ -1474,6 +1914,16 @@ func TestCoverFloat64(t *testing.T) {
|
|||
B: 2,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "NilPtrAnonymousHeadFloat64StringOmitEmpty",
|
||||
data: struct {
|
||||
*structFloat64StringOmitEmpty
|
||||
B float64 `json:"b,string,omitempty"`
|
||||
}{
|
||||
structFloat64StringOmitEmpty: nil,
|
||||
B: 2,
|
||||
},
|
||||
},
|
||||
|
||||
// AnonymousHeadFloat64Ptr
|
||||
{
|
||||
|
@ -1506,6 +1956,16 @@ func TestCoverFloat64(t *testing.T) {
|
|||
B: float64ptr(2),
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "AnonymousHeadFloat64PtrStringOmitEmpty",
|
||||
data: struct {
|
||||
structFloat64PtrStringOmitEmpty
|
||||
B *float64 `json:"b,string,omitempty"`
|
||||
}{
|
||||
structFloat64PtrStringOmitEmpty: structFloat64PtrStringOmitEmpty{A: float64ptr(1)},
|
||||
B: float64ptr(2),
|
||||
},
|
||||
},
|
||||
|
||||
// AnonymousHeadFloat64PtrNil
|
||||
{
|
||||
|
@ -1538,6 +1998,16 @@ func TestCoverFloat64(t *testing.T) {
|
|||
B: float64ptr(2),
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "AnonymousHeadFloat64PtrNilStringOmitEmpty",
|
||||
data: struct {
|
||||
structFloat64PtrStringOmitEmpty
|
||||
B *float64 `json:"b,string,omitempty"`
|
||||
}{
|
||||
structFloat64PtrStringOmitEmpty: structFloat64PtrStringOmitEmpty{A: nil},
|
||||
B: float64ptr(2),
|
||||
},
|
||||
},
|
||||
|
||||
// PtrAnonymousHeadFloat64Ptr
|
||||
{
|
||||
|
@ -1570,6 +2040,16 @@ func TestCoverFloat64(t *testing.T) {
|
|||
B: float64ptr(2),
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "PtrAnonymousHeadFloat64PtrStringOmitEmpty",
|
||||
data: struct {
|
||||
*structFloat64PtrStringOmitEmpty
|
||||
B *float64 `json:"b,string,omitempty"`
|
||||
}{
|
||||
structFloat64PtrStringOmitEmpty: &structFloat64PtrStringOmitEmpty{A: float64ptr(1)},
|
||||
B: float64ptr(2),
|
||||
},
|
||||
},
|
||||
|
||||
// NilPtrAnonymousHeadFloat64Ptr
|
||||
{
|
||||
|
@ -1602,6 +2082,16 @@ func TestCoverFloat64(t *testing.T) {
|
|||
B: float64ptr(2),
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "NilPtrAnonymousHeadFloat64PtrStringOmitEmpty",
|
||||
data: struct {
|
||||
*structFloat64PtrStringOmitEmpty
|
||||
B *float64 `json:"b,string,omitempty"`
|
||||
}{
|
||||
structFloat64PtrStringOmitEmpty: nil,
|
||||
B: float64ptr(2),
|
||||
},
|
||||
},
|
||||
|
||||
// AnonymousHeadFloat64Only
|
||||
{
|
||||
|
@ -1628,6 +2118,14 @@ func TestCoverFloat64(t *testing.T) {
|
|||
structFloat64String: structFloat64String{A: 1},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "AnonymousHeadFloat64OnlyStringOmitEmpty",
|
||||
data: struct {
|
||||
structFloat64StringOmitEmpty
|
||||
}{
|
||||
structFloat64StringOmitEmpty: structFloat64StringOmitEmpty{A: 1},
|
||||
},
|
||||
},
|
||||
|
||||
// PtrAnonymousHeadFloat64Only
|
||||
{
|
||||
|
@ -1654,6 +2152,14 @@ func TestCoverFloat64(t *testing.T) {
|
|||
structFloat64String: &structFloat64String{A: 1},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "PtrAnonymousHeadFloat64OnlyStringOmitEmpty",
|
||||
data: struct {
|
||||
*structFloat64StringOmitEmpty
|
||||
}{
|
||||
structFloat64StringOmitEmpty: &structFloat64StringOmitEmpty{A: 1},
|
||||
},
|
||||
},
|
||||
|
||||
// NilPtrAnonymousHeadFloat64Only
|
||||
{
|
||||
|
@ -1680,6 +2186,14 @@ func TestCoverFloat64(t *testing.T) {
|
|||
structFloat64String: nil,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "NilPtrAnonymousHeadFloat64OnlyStringOmitEmpty",
|
||||
data: struct {
|
||||
*structFloat64StringOmitEmpty
|
||||
}{
|
||||
structFloat64StringOmitEmpty: nil,
|
||||
},
|
||||
},
|
||||
|
||||
// AnonymousHeadFloat64PtrOnly
|
||||
{
|
||||
|
@ -1706,6 +2220,14 @@ func TestCoverFloat64(t *testing.T) {
|
|||
structFloat64PtrString: structFloat64PtrString{A: float64ptr(1)},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "AnonymousHeadFloat64PtrOnlyStringOmitEmpty",
|
||||
data: struct {
|
||||
structFloat64PtrStringOmitEmpty
|
||||
}{
|
||||
structFloat64PtrStringOmitEmpty: structFloat64PtrStringOmitEmpty{A: float64ptr(1)},
|
||||
},
|
||||
},
|
||||
|
||||
// AnonymousHeadFloat64PtrNilOnly
|
||||
{
|
||||
|
@ -1732,6 +2254,14 @@ func TestCoverFloat64(t *testing.T) {
|
|||
structFloat64PtrString: structFloat64PtrString{A: nil},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "AnonymousHeadFloat64PtrNilOnlyStringOmitEmpty",
|
||||
data: struct {
|
||||
structFloat64PtrStringOmitEmpty
|
||||
}{
|
||||
structFloat64PtrStringOmitEmpty: structFloat64PtrStringOmitEmpty{A: nil},
|
||||
},
|
||||
},
|
||||
|
||||
// PtrAnonymousHeadFloat64PtrOnly
|
||||
{
|
||||
|
@ -1758,6 +2288,14 @@ func TestCoverFloat64(t *testing.T) {
|
|||
structFloat64PtrString: &structFloat64PtrString{A: float64ptr(1)},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "PtrAnonymousHeadFloat64PtrOnlyStringOmitEmpty",
|
||||
data: struct {
|
||||
*structFloat64PtrStringOmitEmpty
|
||||
}{
|
||||
structFloat64PtrStringOmitEmpty: &structFloat64PtrStringOmitEmpty{A: float64ptr(1)},
|
||||
},
|
||||
},
|
||||
|
||||
// NilPtrAnonymousHeadFloat64PtrOnly
|
||||
{
|
||||
|
@ -1784,6 +2322,14 @@ func TestCoverFloat64(t *testing.T) {
|
|||
structFloat64PtrString: nil,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "NilPtrAnonymousHeadFloat64PtrOnlyStringOmitEmpty",
|
||||
data: struct {
|
||||
*structFloat64PtrStringOmitEmpty
|
||||
}{
|
||||
structFloat64PtrStringOmitEmpty: nil,
|
||||
},
|
||||
},
|
||||
}
|
||||
for _, test := range tests {
|
||||
for _, indent := range []bool{true, false} {
|
||||
|
|
Loading…
Reference in New Issue