go-json/cover_float32_test.go

1787 lines
36 KiB
Go
Raw Normal View History

2021-01-16 16:16:26 +03:00
package json_test
import (
"bytes"
"testing"
"github.com/goccy/go-json"
)
func TestCoverFloat32(t *testing.T) {
type structFloat32 struct {
A float32 `json:"a"`
}
type structFloat32OmitEmpty struct {
A float32 `json:"a,omitempty"`
}
type structFloat32String struct {
A float32 `json:"a,string"`
}
2021-01-16 16:16:26 +03:00
type structFloat32Ptr struct {
A *float32 `json:"a"`
}
type structFloat32PtrOmitEmpty struct {
A *float32 `json:"a,omitempty"`
}
type structFloat32PtrString struct {
A *float32 `json:"a,string"`
}
2021-01-16 16:16:26 +03:00
tests := []struct {
2021-02-15 05:29:42 +03:00
name string
data interface{}
2021-01-16 16:16:26 +03:00
}{
// HeadFloat32Zero
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:29:42 +03:00
name: "HeadFloat32Zero",
2021-01-16 16:16:26 +03:00
data: struct {
A float32 `json:"a"`
}{},
},
{
2021-02-15 05:29:42 +03:00
name: "HeadFloat32ZeroOmitEmpty",
data: struct {
A float32 `json:"a,omitempty"`
}{},
},
{
2021-02-15 05:29:42 +03:00
name: "HeadFloat32ZeroString",
data: struct {
A float32 `json:"a,string"`
}{},
},
// HeadFloat32
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:29:42 +03:00
name: "HeadFloat32",
2021-01-16 16:16:26 +03:00
data: struct {
A float32 `json:"a"`
}{A: 1},
},
{
2021-02-15 05:29:42 +03:00
name: "HeadFloat32OmitEmpty",
data: struct {
A float32 `json:"a,omitempty"`
}{A: 1},
},
{
2021-02-15 05:29:42 +03:00
name: "HeadFloat32String",
data: struct {
A float32 `json:"a,string"`
}{A: 1},
},
// HeadFloat32Ptr
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:29:42 +03:00
name: "HeadFloat32Ptr",
2021-01-16 16:16:26 +03:00
data: struct {
A *float32 `json:"a"`
}{A: float32ptr(1)},
},
{
2021-02-15 05:29:42 +03:00
name: "HeadFloat32PtrOmitEmpty",
data: struct {
A *float32 `json:"a,omitempty"`
}{A: float32ptr(1)},
},
{
2021-02-15 05:29:42 +03:00
name: "HeadFloat32PtrString",
data: struct {
A *float32 `json:"a,string"`
}{A: float32ptr(1)},
},
// HeadFloat32PtrNil
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:29:42 +03:00
name: "HeadFloat32PtrNil",
2021-01-16 16:16:26 +03:00
data: struct {
A *float32 `json:"a"`
}{A: nil},
},
{
2021-02-15 05:29:42 +03:00
name: "HeadFloat32PtrNilOmitEmpty",
data: struct {
A *float32 `json:"a,omitempty"`
}{A: nil},
},
{
2021-02-15 05:29:42 +03:00
name: "HeadFloat32PtrNilString",
data: struct {
A *float32 `json:"a,string"`
}{A: nil},
},
// PtrHeadFloat32Zero
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32Zero",
2021-01-16 16:16:26 +03:00
data: &struct {
A float32 `json:"a"`
}{},
},
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32ZeroOmitEmpty",
data: &struct {
A float32 `json:"a,omitempty"`
}{},
},
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32ZeroString",
data: &struct {
A float32 `json:"a,string"`
}{},
},
// PtrHeadFloat32
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32",
2021-01-16 16:16:26 +03:00
data: &struct {
A float32 `json:"a"`
}{A: 1},
},
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32OmitEmpty",
data: &struct {
A float32 `json:"a,omitempty"`
}{A: 1},
},
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32String",
data: &struct {
A float32 `json:"a,string"`
}{A: 1},
},
// PtrHeadFloat32Ptr
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32Ptr",
2021-01-16 16:16:26 +03:00
data: &struct {
A *float32 `json:"a"`
}{A: float32ptr(1)},
},
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32PtrOmitEmpty",
data: &struct {
A *float32 `json:"a,omitempty"`
}{A: float32ptr(1)},
},
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32PtrString",
data: &struct {
A *float32 `json:"a,string"`
}{A: float32ptr(1)},
},
// PtrHeadFloat32PtrNil
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32PtrNil",
2021-01-16 16:16:26 +03:00
data: &struct {
A *float32 `json:"a"`
}{A: nil},
},
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32PtrNilOmitEmpty",
data: &struct {
A *float32 `json:"a,omitempty"`
}{A: nil},
},
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32PtrNilString",
data: &struct {
A *float32 `json:"a,string"`
}{A: nil},
},
// PtrHeadFloat32Nil
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32Nil",
2021-01-16 16:16:26 +03:00
data: (*struct {
A *float32 `json:"a"`
})(nil),
},
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32NilOmitEmpty",
data: (*struct {
A *float32 `json:"a,omitempty"`
})(nil),
},
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32NilString",
data: (*struct {
A *float32 `json:"a,string"`
})(nil),
},
// HeadFloat32ZeroMultiFields
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:29:42 +03:00
name: "HeadFloat32ZeroMultiFields",
2021-01-16 16:16:26 +03:00
data: struct {
A float32 `json:"a"`
B float32 `json:"b"`
2021-02-15 05:29:42 +03:00
C float32 `json:"c"`
2021-01-16 16:16:26 +03:00
}{},
},
{
2021-02-15 05:29:42 +03:00
name: "HeadFloat32ZeroMultiFieldsOmitEmpty",
data: struct {
A float32 `json:"a,omitempty"`
B float32 `json:"b,omitempty"`
2021-02-15 05:29:42 +03:00
C float32 `json:"c,omitempty"`
}{},
},
{
2021-02-15 05:29:42 +03:00
name: "HeadFloat32ZeroMultiFields",
data: struct {
A float32 `json:"a,string"`
B float32 `json:"b,string"`
2021-02-15 05:29:42 +03:00
C float32 `json:"c,string"`
}{},
},
// HeadFloat32MultiFields
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:29:42 +03:00
name: "HeadFloat32MultiFields",
2021-01-16 16:16:26 +03:00
data: struct {
A float32 `json:"a"`
B float32 `json:"b"`
2021-02-15 05:29:42 +03:00
C float32 `json:"c"`
}{A: 1, B: 2, C: 3},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:29:42 +03:00
name: "HeadFloat32MultiFieldsOmitEmpty",
2021-01-16 16:16:26 +03:00
data: struct {
A float32 `json:"a,omitempty"`
B float32 `json:"b,omitempty"`
2021-02-15 05:29:42 +03:00
C float32 `json:"c,omitempty"`
}{A: 1, B: 2, C: 3},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:29:42 +03:00
name: "HeadFloat32MultiFieldsString",
2021-01-16 16:16:26 +03:00
data: struct {
A float32 `json:"a,string"`
B float32 `json:"b,string"`
2021-02-15 05:29:42 +03:00
C float32 `json:"c,string"`
}{A: 1, B: 2, C: 3},
2021-01-16 16:16:26 +03:00
},
// HeadFloat32PtrMultiFields
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:29:42 +03:00
name: "HeadFloat32PtrMultiFields",
data: struct {
A *float32 `json:"a"`
B *float32 `json:"b"`
2021-02-15 05:29:42 +03:00
C *float32 `json:"c"`
}{A: float32ptr(1), B: float32ptr(2), C: float32ptr(3)},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:29:42 +03:00
name: "HeadFloat32PtrMultiFieldsOmitEmpty",
data: struct {
A *float32 `json:"a,omitempty"`
B *float32 `json:"b,omitempty"`
2021-02-15 05:29:42 +03:00
C *float32 `json:"c,omitempty"`
}{A: float32ptr(1), B: float32ptr(2), C: float32ptr(3)},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:29:42 +03:00
name: "HeadFloat32PtrMultiFieldsString",
data: struct {
A *float32 `json:"a,string"`
B *float32 `json:"b,string"`
2021-02-15 05:29:42 +03:00
C *float32 `json:"c,string"`
}{A: float32ptr(1), B: float32ptr(2), C: float32ptr(3)},
2021-01-16 16:16:26 +03:00
},
// HeadFloat32PtrNilMultiFields
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:29:42 +03:00
name: "HeadFloat32PtrNilMultiFields",
data: struct {
2021-01-16 16:16:26 +03:00
A *float32 `json:"a"`
B *float32 `json:"b"`
2021-02-15 05:29:42 +03:00
C *float32 `json:"c"`
}{A: nil, B: nil, C: nil},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:29:42 +03:00
name: "HeadFloat32PtrNilMultiFieldsOmitEmpty",
data: struct {
A *float32 `json:"a,omitempty"`
B *float32 `json:"b,omitempty"`
2021-02-15 05:29:42 +03:00
C *float32 `json:"c,omitempty"`
}{A: nil, B: nil, C: nil},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:29:42 +03:00
name: "HeadFloat32PtrNilMultiFieldsString",
data: struct {
A *float32 `json:"a,string"`
B *float32 `json:"b,string"`
2021-02-15 05:29:42 +03:00
C *float32 `json:"c,string"`
}{A: nil, B: nil, C: nil},
},
// PtrHeadFloat32ZeroMultiFields
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32ZeroMultiFields",
data: &struct {
A float32 `json:"a"`
B float32 `json:"b"`
}{},
},
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32ZeroMultiFieldsOmitEmpty",
data: &struct {
A float32 `json:"a,omitempty"`
B float32 `json:"b,omitempty"`
}{},
},
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32ZeroMultiFieldsString",
data: &struct {
A float32 `json:"a,string"`
B float32 `json:"b,string"`
}{},
},
// PtrHeadFloat32MultiFields
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32MultiFields",
data: &struct {
A float32 `json:"a"`
B float32 `json:"b"`
}{A: 1, B: 2},
},
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32MultiFieldsOmitEmpty",
data: &struct {
A float32 `json:"a,omitempty"`
B float32 `json:"b,omitempty"`
}{A: 1, B: 2},
},
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32MultiFieldsString",
data: &struct {
A float32 `json:"a,string"`
B float32 `json:"b,string"`
}{A: 1, B: 2},
},
// PtrHeadFloat32PtrMultiFields
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32PtrMultiFields",
data: &struct {
A *float32 `json:"a"`
B *float32 `json:"b"`
}{A: float32ptr(1), B: float32ptr(2)},
},
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32PtrMultiFieldsOmitEmpty",
data: &struct {
A *float32 `json:"a,omitempty"`
B *float32 `json:"b,omitempty"`
}{A: float32ptr(1), B: float32ptr(2)},
},
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32PtrMultiFieldsString",
data: &struct {
A *float32 `json:"a,string"`
B *float32 `json:"b,string"`
}{A: float32ptr(1), B: float32ptr(2)},
},
// PtrHeadFloat32PtrNilMultiFields
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32PtrNilMultiFields",
data: &struct {
A *float32 `json:"a"`
B *float32 `json:"b"`
}{A: nil, B: nil},
},
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32PtrNilMultiFieldsOmitEmpty",
data: &struct {
A *float32 `json:"a,omitempty"`
B *float32 `json:"b,omitempty"`
}{A: nil, B: nil},
},
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32PtrNilMultiFieldsString",
data: &struct {
A *float32 `json:"a,string"`
B *float32 `json:"b,string"`
}{A: nil, B: nil},
},
// PtrHeadFloat32NilMultiFields
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32NilMultiFields",
data: (*struct {
A *float32 `json:"a"`
B *float32 `json:"b"`
})(nil),
},
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32NilMultiFieldsOmitEmpty",
data: (*struct {
A *float32 `json:"a,omitempty"`
B *float32 `json:"b,omitempty"`
})(nil),
},
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32NilMultiFieldsString",
data: (*struct {
A *float32 `json:"a,string"`
B *float32 `json:"b,string"`
})(nil),
},
// HeadFloat32ZeroNotRoot
{
2021-02-15 05:29:42 +03:00
name: "HeadFloat32ZeroNotRoot",
2021-01-16 16:16:26 +03:00
data: struct {
A struct {
A float32 `json:"a"`
}
}{},
},
{
2021-02-15 05:29:42 +03:00
name: "HeadFloat32ZeroNotRootOmitEmpty",
data: struct {
A struct {
A float32 `json:"a,omitempty"`
}
}{},
},
{
2021-02-15 05:29:42 +03:00
name: "HeadFloat32ZeroNotRootString",
data: struct {
A struct {
A float32 `json:"a,string"`
}
}{},
},
// HeadFloat32NotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:29:42 +03:00
name: "HeadFloat32NotRoot",
2021-01-16 16:16:26 +03:00
data: struct {
A struct {
A float32 `json:"a"`
}
}{A: struct {
A float32 `json:"a"`
}{A: 1}},
},
{
2021-02-15 05:29:42 +03:00
name: "HeadFloat32NotRootOmitEmpty",
2021-01-16 16:16:26 +03:00
data: struct {
A struct {
A float32 `json:"a,omitempty"`
2021-01-16 16:16:26 +03:00
}
}{A: struct {
A float32 `json:"a,omitempty"`
}{A: 1}},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:29:42 +03:00
name: "HeadFloat32NotRootString",
2021-01-16 16:16:26 +03:00
data: struct {
A struct {
A float32 `json:"a,string"`
2021-01-16 16:16:26 +03:00
}
}{A: struct {
A float32 `json:"a,string"`
}{A: 1}},
2021-01-16 16:16:26 +03:00
},
// HeadFloat32PtrNotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:29:42 +03:00
name: "HeadFloat32PtrNotRoot",
2021-01-16 16:16:26 +03:00
data: struct {
A struct {
A *float32 `json:"a"`
2021-01-16 16:16:26 +03:00
}
}{A: struct {
A *float32 `json:"a"`
}{float32ptr(1)}},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:29:42 +03:00
name: "HeadFloat32PtrNotRootOmitEmpty",
2021-01-16 16:16:26 +03:00
data: struct {
A struct {
A *float32 `json:"a,omitempty"`
2021-01-16 16:16:26 +03:00
}
}{A: struct {
A *float32 `json:"a,omitempty"`
}{float32ptr(1)}},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:29:42 +03:00
name: "HeadFloat32PtrNotRootString",
2021-01-16 16:16:26 +03:00
data: struct {
A struct {
A *float32 `json:"a,string"`
2021-01-16 16:16:26 +03:00
}
}{A: struct {
A *float32 `json:"a,string"`
}{float32ptr(1)}},
2021-01-16 16:16:26 +03:00
},
// HeadFloat32PtrNilNotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:29:42 +03:00
name: "HeadFloat32PtrNilNotRoot",
data: struct {
A struct {
A *float32 `json:"a"`
}
}{},
},
{
2021-02-15 05:29:42 +03:00
name: "HeadFloat32PtrNilNotRootOmitEmpty",
data: struct {
A struct {
A *float32 `json:"a,omitempty"`
}
}{},
},
{
2021-02-15 05:29:42 +03:00
name: "HeadFloat32PtrNilNotRootString",
data: struct {
A struct {
A *float32 `json:"a,string"`
}
}{},
},
// PtrHeadFloat32ZeroNotRoot
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32ZeroNotRoot",
data: struct {
A *struct {
A float32 `json:"a"`
}
}{A: new(struct {
A float32 `json:"a"`
})},
},
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32ZeroNotRootOmitEmpty",
data: struct {
A *struct {
A float32 `json:"a,omitempty"`
}
}{A: new(struct {
A float32 `json:"a,omitempty"`
})},
},
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32ZeroNotRootString",
data: struct {
A *struct {
A float32 `json:"a,string"`
}
}{A: new(struct {
A float32 `json:"a,string"`
})},
},
// PtrHeadFloat32NotRoot
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32NotRoot",
data: struct {
A *struct {
A float32 `json:"a"`
}
}{A: &(struct {
A float32 `json:"a"`
}{A: 1})},
},
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32NotRootOmitEmpty",
data: struct {
A *struct {
A float32 `json:"a,omitempty"`
}
}{A: &(struct {
A float32 `json:"a,omitempty"`
}{A: 1})},
},
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32NotRootString",
data: struct {
A *struct {
A float32 `json:"a,string"`
}
}{A: &(struct {
A float32 `json:"a,string"`
}{A: 1})},
},
// PtrHeadFloat32PtrNotRoot
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32PtrNotRoot",
data: struct {
A *struct {
A *float32 `json:"a"`
}
}{A: &(struct {
A *float32 `json:"a"`
}{A: float32ptr(1)})},
},
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32PtrNotRootOmitEmpty",
data: struct {
A *struct {
A *float32 `json:"a,omitempty"`
}
}{A: &(struct {
A *float32 `json:"a,omitempty"`
}{A: float32ptr(1)})},
},
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32PtrNotRootString",
data: struct {
A *struct {
A *float32 `json:"a,string"`
}
}{A: &(struct {
A *float32 `json:"a,string"`
}{A: float32ptr(1)})},
},
// PtrHeadFloat32PtrNilNotRoot
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32PtrNilNotRoot",
data: struct {
A *struct {
A *float32 `json:"a"`
}
}{A: &(struct {
A *float32 `json:"a"`
}{A: nil})},
},
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32PtrNilNotRootOmitEmpty",
data: struct {
A *struct {
A *float32 `json:"a,omitempty"`
}
}{A: &(struct {
A *float32 `json:"a,omitempty"`
}{A: nil})},
},
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32PtrNilNotRootString",
data: struct {
A *struct {
A *float32 `json:"a,string"`
}
}{A: &(struct {
A *float32 `json:"a,string"`
}{A: nil})},
},
// PtrHeadFloat32NilNotRoot
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32NilNotRoot",
data: struct {
A *struct {
A *float32 `json:"a"`
}
}{A: nil},
},
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32NilNotRootOmitEmpty",
data: struct {
A *struct {
A *float32 `json:"a,omitempty"`
} `json:",omitempty"`
}{A: nil},
},
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32NilNotRootString",
data: struct {
A *struct {
A *float32 `json:"a,string"`
} `json:",string"`
}{A: nil},
},
// HeadFloat32ZeroMultiFieldsNotRoot
{
2021-02-15 05:29:42 +03:00
name: "HeadFloat32ZeroMultiFieldsNotRoot",
data: struct {
A struct {
A float32 `json:"a"`
}
B struct {
B float32 `json:"b"`
}
}{},
},
{
2021-02-15 05:29:42 +03:00
name: "HeadFloat32ZeroMultiFieldsNotRootOmitEmpty",
data: struct {
A struct {
A float32 `json:"a,omitempty"`
}
B struct {
B float32 `json:"b,omitempty"`
}
}{},
},
{
2021-02-15 05:29:42 +03:00
name: "HeadFloat32ZeroMultiFieldsNotRootString",
data: struct {
A struct {
A float32 `json:"a,string"`
}
B struct {
B float32 `json:"b,string"`
}
}{},
},
// HeadFloat32MultiFieldsNotRoot
{
2021-02-15 05:29:42 +03:00
name: "HeadFloat32MultiFieldsNotRoot",
data: struct {
A struct {
A float32 `json:"a"`
}
B struct {
B float32 `json:"b"`
}
}{A: struct {
A float32 `json:"a"`
}{A: 1}, B: struct {
B float32 `json:"b"`
}{B: 2}},
},
{
2021-02-15 05:29:42 +03:00
name: "HeadFloat32MultiFieldsNotRootOmitEmpty",
data: struct {
A struct {
A float32 `json:"a,omitempty"`
}
B struct {
B float32 `json:"b,omitempty"`
}
}{A: struct {
A float32 `json:"a,omitempty"`
}{A: 1}, B: struct {
B float32 `json:"b,omitempty"`
}{B: 2}},
},
{
2021-02-15 05:29:42 +03:00
name: "HeadFloat32MultiFieldsNotRootString",
data: struct {
A struct {
A float32 `json:"a,string"`
}
B struct {
B float32 `json:"b,string"`
}
}{A: struct {
A float32 `json:"a,string"`
}{A: 1}, B: struct {
B float32 `json:"b,string"`
}{B: 2}},
},
// HeadFloat32PtrMultiFieldsNotRoot
{
2021-02-15 05:29:42 +03:00
name: "HeadFloat32PtrMultiFieldsNotRoot",
data: struct {
A struct {
A *float32 `json:"a"`
}
B struct {
B *float32 `json:"b"`
}
}{A: struct {
A *float32 `json:"a"`
}{A: float32ptr(1)}, B: struct {
B *float32 `json:"b"`
}{B: float32ptr(2)}},
},
{
2021-02-15 05:29:42 +03:00
name: "HeadFloat32PtrMultiFieldsNotRootOmitEmpty",
data: struct {
A struct {
A *float32 `json:"a,omitempty"`
}
B struct {
B *float32 `json:"b,omitempty"`
}
}{A: struct {
A *float32 `json:"a,omitempty"`
}{A: float32ptr(1)}, B: struct {
B *float32 `json:"b,omitempty"`
}{B: float32ptr(2)}},
},
{
2021-02-15 05:29:42 +03:00
name: "HeadFloat32PtrMultiFieldsNotRootString",
data: struct {
A struct {
A *float32 `json:"a,string"`
}
B struct {
B *float32 `json:"b,string"`
}
}{A: struct {
A *float32 `json:"a,string"`
}{A: float32ptr(1)}, B: struct {
B *float32 `json:"b,string"`
}{B: float32ptr(2)}},
},
// HeadFloat32PtrNilMultiFieldsNotRoot
{
2021-02-15 05:29:42 +03:00
name: "HeadFloat32PtrNilMultiFieldsNotRoot",
data: struct {
A struct {
A *float32 `json:"a"`
}
B struct {
B *float32 `json:"b"`
}
}{A: struct {
A *float32 `json:"a"`
}{A: nil}, B: struct {
B *float32 `json:"b"`
}{B: nil}},
},
{
2021-02-15 05:29:42 +03:00
name: "HeadFloat32PtrNilMultiFieldsNotRootOmitEmpty",
data: struct {
A struct {
A *float32 `json:"a,omitempty"`
}
B struct {
B *float32 `json:"b,omitempty"`
}
}{A: struct {
A *float32 `json:"a,omitempty"`
}{A: nil}, B: struct {
B *float32 `json:"b,omitempty"`
}{B: nil}},
},
{
2021-02-15 05:29:42 +03:00
name: "HeadFloat32PtrNilMultiFieldsNotRootString",
data: struct {
A struct {
A *float32 `json:"a,string"`
}
B struct {
B *float32 `json:"b,string"`
}
}{A: struct {
A *float32 `json:"a,string"`
}{A: nil}, B: struct {
B *float32 `json:"b,string"`
}{B: nil}},
},
// PtrHeadFloat32ZeroMultiFieldsNotRoot
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32ZeroMultiFieldsNotRoot",
data: &struct {
A struct {
A float32 `json:"a"`
2021-01-16 16:16:26 +03:00
}
B struct {
B float32 `json:"b"`
}
}{},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32ZeroMultiFieldsNotRootOmitEmpty",
data: &struct {
A struct {
A float32 `json:"a,omitempty"`
2021-01-16 16:16:26 +03:00
}
B struct {
B float32 `json:"b,omitempty"`
}
}{},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32ZeroMultiFieldsNotRootString",
data: &struct {
2021-01-16 16:16:26 +03:00
A struct {
A float32 `json:"a,string"`
2021-01-16 16:16:26 +03:00
}
B struct {
B float32 `json:"b,string"`
2021-01-16 16:16:26 +03:00
}
}{},
},
// PtrHeadFloat32MultiFieldsNotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32MultiFieldsNotRoot",
data: &struct {
2021-01-16 16:16:26 +03:00
A struct {
A float32 `json:"a"`
}
B struct {
B float32 `json:"b"`
}
}{A: struct {
A float32 `json:"a"`
}{A: 1}, B: struct {
B float32 `json:"b"`
}{B: 2}},
},
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32MultiFieldsNotRootOmitEmpty",
data: &struct {
2021-01-16 16:16:26 +03:00
A struct {
A float32 `json:"a,omitempty"`
2021-01-16 16:16:26 +03:00
}
B struct {
B float32 `json:"b,omitempty"`
2021-01-16 16:16:26 +03:00
}
}{A: struct {
A float32 `json:"a,omitempty"`
}{A: 1}, B: struct {
B float32 `json:"b,omitempty"`
}{B: 2}},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32MultiFieldsNotRootString",
data: &struct {
2021-01-16 16:16:26 +03:00
A struct {
A float32 `json:"a,string"`
2021-01-16 16:16:26 +03:00
}
B struct {
B float32 `json:"b,string"`
2021-01-16 16:16:26 +03:00
}
}{A: struct {
A float32 `json:"a,string"`
}{A: 1}, B: struct {
B float32 `json:"b,string"`
}{B: 2}},
2021-01-16 16:16:26 +03:00
},
// PtrHeadFloat32PtrMultiFieldsNotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32PtrMultiFieldsNotRoot",
2021-01-16 16:16:26 +03:00
data: &struct {
A *struct {
A *float32 `json:"a"`
2021-01-16 16:16:26 +03:00
}
B *struct {
B *float32 `json:"b"`
2021-01-16 16:16:26 +03:00
}
}{A: &(struct {
A *float32 `json:"a"`
}{A: float32ptr(1)}), B: &(struct {
B *float32 `json:"b"`
}{B: float32ptr(2)})},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32PtrMultiFieldsNotRootOmitEmpty",
2021-01-16 16:16:26 +03:00
data: &struct {
A *struct {
A *float32 `json:"a,omitempty"`
}
B *struct {
B *float32 `json:"b,omitempty"`
}
}{A: &(struct {
A *float32 `json:"a,omitempty"`
}{A: float32ptr(1)}), B: &(struct {
B *float32 `json:"b,omitempty"`
}{B: float32ptr(2)})},
},
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32PtrMultiFieldsNotRootString",
data: &struct {
A *struct {
A *float32 `json:"a,string"`
}
B *struct {
B *float32 `json:"b,string"`
}
}{A: &(struct {
A *float32 `json:"a,string"`
}{A: float32ptr(1)}), B: &(struct {
B *float32 `json:"b,string"`
}{B: float32ptr(2)})},
},
// PtrHeadFloat32PtrNilMultiFieldsNotRoot
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32PtrNilMultiFieldsNotRoot",
data: &struct {
A *struct {
A *float32 `json:"a"`
}
B *struct {
B *float32 `json:"b"`
}
}{A: nil, B: nil},
},
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32PtrNilMultiFieldsNotRootOmitEmpty",
data: &struct {
A *struct {
A *float32 `json:"a,omitempty"`
} `json:",omitempty"`
B *struct {
B *float32 `json:"b,omitempty"`
} `json:",omitempty"`
}{A: nil, B: nil},
},
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32PtrNilMultiFieldsNotRootString",
data: &struct {
A *struct {
A *float32 `json:"a,string"`
} `json:",string"`
B *struct {
B *float32 `json:"b,string"`
} `json:",string"`
}{A: nil, B: nil},
},
// PtrHeadFloat32NilMultiFieldsNotRoot
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32NilMultiFieldsNotRoot",
data: (*struct {
A *struct {
A *float32 `json:"a"`
}
B *struct {
B *float32 `json:"b"`
}
})(nil),
},
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32NilMultiFieldsNotRootOmitEmpty",
data: (*struct {
A *struct {
A *float32 `json:"a,omitempty"`
}
B *struct {
B *float32 `json:"b,omitempty"`
}
})(nil),
},
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32NilMultiFieldsNotRootString",
data: (*struct {
A *struct {
A *float32 `json:"a,string"`
}
B *struct {
B *float32 `json:"b,string"`
}
})(nil),
},
// PtrHeadFloat32DoubleMultiFieldsNotRoot
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32DoubleMultiFieldsNotRoot",
data: &struct {
A *struct {
2021-01-16 16:16:26 +03:00
A float32 `json:"a"`
B float32 `json:"b"`
2021-01-16 16:16:26 +03:00
}
B *struct {
A float32 `json:"a"`
2021-01-16 16:16:26 +03:00
B float32 `json:"b"`
}
}{A: &(struct {
2021-01-16 16:16:26 +03:00
A float32 `json:"a"`
B float32 `json:"b"`
}{A: 1, B: 2}), B: &(struct {
A float32 `json:"a"`
B float32 `json:"b"`
}{A: 3, B: 4})},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32DoubleMultiFieldsNotRootOmitEmpty",
data: &struct {
A *struct {
A float32 `json:"a,omitempty"`
B float32 `json:"b,omitempty"`
}
B *struct {
A float32 `json:"a,omitempty"`
B float32 `json:"b,omitempty"`
}
}{A: &(struct {
A float32 `json:"a,omitempty"`
B float32 `json:"b,omitempty"`
}{A: 1, B: 2}), B: &(struct {
A float32 `json:"a,omitempty"`
B float32 `json:"b,omitempty"`
}{A: 3, B: 4})},
},
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32DoubleMultiFieldsNotRootString",
2021-01-16 16:16:26 +03:00
data: &struct {
A *struct {
A float32 `json:"a,string"`
B float32 `json:"b,string"`
2021-01-16 16:16:26 +03:00
}
B *struct {
A float32 `json:"a,string"`
B float32 `json:"b,string"`
2021-01-16 16:16:26 +03:00
}
}{A: &(struct {
A float32 `json:"a,string"`
B float32 `json:"b,string"`
}{A: 1, B: 2}), B: &(struct {
A float32 `json:"a,string"`
B float32 `json:"b,string"`
}{A: 3, B: 4})},
2021-01-16 16:16:26 +03:00
},
// PtrHeadFloat32NilDoubleMultiFieldsNotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32NilDoubleMultiFieldsNotRoot",
2021-01-16 16:16:26 +03:00
data: &struct {
A *struct {
A float32 `json:"a"`
B float32 `json:"b"`
2021-01-16 16:16:26 +03:00
}
B *struct {
A float32 `json:"a"`
B float32 `json:"b"`
2021-01-16 16:16:26 +03:00
}
}{A: nil, B: nil},
},
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32NilDoubleMultiFieldsNotRootOmitEmpty",
data: &struct {
2021-01-16 16:16:26 +03:00
A *struct {
A float32 `json:"a,omitempty"`
B float32 `json:"b,omitempty"`
} `json:",omitempty"`
2021-01-16 16:16:26 +03:00
B *struct {
A float32 `json:"a,omitempty"`
B float32 `json:"b,omitempty"`
} `json:",omitempty"`
}{A: nil, B: nil},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32NilDoubleMultiFieldsNotRootString",
2021-01-16 16:16:26 +03:00
data: &struct {
A *struct {
A float32 `json:"a,string"`
B float32 `json:"b,string"`
2021-01-16 16:16:26 +03:00
}
B *struct {
A float32 `json:"a,string"`
B float32 `json:"b,string"`
2021-01-16 16:16:26 +03:00
}
}{A: nil, B: nil},
2021-01-16 16:16:26 +03:00
},
// PtrHeadFloat32NilDoubleMultiFieldsNotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32NilDoubleMultiFieldsNotRoot",
data: (*struct {
2021-01-16 16:16:26 +03:00
A *struct {
A float32 `json:"a"`
B float32 `json:"b"`
}
B *struct {
A float32 `json:"a"`
B float32 `json:"b"`
}
})(nil),
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32NilDoubleMultiFieldsNotRootOmitEmpty",
2021-01-16 16:16:26 +03:00
data: (*struct {
A *struct {
A float32 `json:"a,omitempty"`
B float32 `json:"b,omitempty"`
2021-01-16 16:16:26 +03:00
}
B *struct {
A float32 `json:"a,omitempty"`
B float32 `json:"b,omitempty"`
}
})(nil),
},
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32NilDoubleMultiFieldsNotRootString",
data: (*struct {
A *struct {
A float32 `json:"a,string"`
B float32 `json:"b,string"`
}
B *struct {
A float32 `json:"a,string"`
B float32 `json:"b,string"`
2021-01-16 16:16:26 +03:00
}
})(nil),
},
// PtrHeadFloat32PtrDoubleMultiFieldsNotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32PtrDoubleMultiFieldsNotRoot",
2021-01-16 16:16:26 +03:00
data: &struct {
A *struct {
A *float32 `json:"a"`
B *float32 `json:"b"`
}
B *struct {
A *float32 `json:"a"`
B *float32 `json:"b"`
}
}{A: &(struct {
A *float32 `json:"a"`
B *float32 `json:"b"`
}{A: float32ptr(1), B: float32ptr(2)}), B: &(struct {
A *float32 `json:"a"`
B *float32 `json:"b"`
}{A: float32ptr(3), B: float32ptr(4)})},
},
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32PtrDoubleMultiFieldsNotRootOmitEmpty",
data: &struct {
A *struct {
A *float32 `json:"a,omitempty"`
B *float32 `json:"b,omitempty"`
}
B *struct {
A *float32 `json:"a,omitempty"`
B *float32 `json:"b,omitempty"`
}
}{A: &(struct {
A *float32 `json:"a,omitempty"`
B *float32 `json:"b,omitempty"`
}{A: float32ptr(1), B: float32ptr(2)}), B: &(struct {
A *float32 `json:"a,omitempty"`
B *float32 `json:"b,omitempty"`
}{A: float32ptr(3), B: float32ptr(4)})},
},
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32PtrDoubleMultiFieldsNotRootString",
data: &struct {
A *struct {
A *float32 `json:"a,string"`
B *float32 `json:"b,string"`
}
B *struct {
A *float32 `json:"a,string"`
B *float32 `json:"b,string"`
}
}{A: &(struct {
A *float32 `json:"a,string"`
B *float32 `json:"b,string"`
}{A: float32ptr(1), B: float32ptr(2)}), B: &(struct {
A *float32 `json:"a,string"`
B *float32 `json:"b,string"`
}{A: float32ptr(3), B: float32ptr(4)})},
},
// PtrHeadFloat32PtrNilDoubleMultiFieldsNotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32PtrNilDoubleMultiFieldsNotRoot",
2021-01-16 16:16:26 +03:00
data: &struct {
A *struct {
A *float32 `json:"a"`
B *float32 `json:"b"`
}
B *struct {
A *float32 `json:"a"`
B *float32 `json:"b"`
}
}{A: nil, B: nil},
},
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32PtrNilDoubleMultiFieldsNotRootOmitEmpty",
data: &struct {
A *struct {
A *float32 `json:"a,omitempty"`
B *float32 `json:"b,omitempty"`
} `json:",omitempty"`
B *struct {
A *float32 `json:"a,omitempty"`
B *float32 `json:"b,omitempty"`
} `json:",omitempty"`
}{A: nil, B: nil},
},
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32PtrNilDoubleMultiFieldsNotRootString",
data: &struct {
A *struct {
A *float32 `json:"a,string"`
B *float32 `json:"b,string"`
}
B *struct {
A *float32 `json:"a,string"`
B *float32 `json:"b,string"`
}
}{A: nil, B: nil},
},
// PtrHeadFloat32PtrNilDoubleMultiFieldsNotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32PtrNilDoubleMultiFieldsNotRoot",
2021-01-16 16:16:26 +03:00
data: (*struct {
A *struct {
A *float32 `json:"a"`
B *float32 `json:"b"`
}
B *struct {
A *float32 `json:"a"`
B *float32 `json:"b"`
}
})(nil),
},
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32PtrNilDoubleMultiFieldsNotRootOmitEmpty",
data: (*struct {
A *struct {
A *float32 `json:"a,omitempty"`
B *float32 `json:"b,omitempty"`
}
B *struct {
A *float32 `json:"a,omitempty"`
B *float32 `json:"b,omitempty"`
}
})(nil),
},
{
2021-02-15 05:29:42 +03:00
name: "PtrHeadFloat32PtrNilDoubleMultiFieldsNotRootString",
data: (*struct {
A *struct {
A *float32 `json:"a,string"`
B *float32 `json:"b,string"`
}
B *struct {
A *float32 `json:"a,string"`
B *float32 `json:"b,string"`
}
})(nil),
},
// AnonymousHeadFloat32
{
2021-02-15 05:29:42 +03:00
name: "AnonymousHeadFloat32",
data: struct {
structFloat32
B float32 `json:"b"`
}{
structFloat32: structFloat32{A: 1},
B: 2,
},
},
{
2021-02-15 05:29:42 +03:00
name: "AnonymousHeadFloat32OmitEmpty",
data: struct {
structFloat32OmitEmpty
B float32 `json:"b,omitempty"`
}{
structFloat32OmitEmpty: structFloat32OmitEmpty{A: 1},
B: 2,
},
},
{
2021-02-15 05:29:42 +03:00
name: "AnonymousHeadFloat32String",
data: struct {
structFloat32String
B float32 `json:"b,string"`
}{
structFloat32String: structFloat32String{A: 1},
B: 2,
},
},
// PtrAnonymousHeadFloat32
{
2021-02-15 05:29:42 +03:00
name: "PtrAnonymousHeadFloat32",
data: struct {
*structFloat32
B float32 `json:"b"`
}{
structFloat32: &structFloat32{A: 1},
B: 2,
},
},
{
2021-02-15 05:29:42 +03:00
name: "PtrAnonymousHeadFloat32OmitEmpty",
data: struct {
*structFloat32OmitEmpty
B float32 `json:"b,omitempty"`
}{
structFloat32OmitEmpty: &structFloat32OmitEmpty{A: 1},
B: 2,
},
},
{
2021-02-15 05:29:42 +03:00
name: "PtrAnonymousHeadFloat32String",
data: struct {
*structFloat32String
B float32 `json:"b,string"`
}{
structFloat32String: &structFloat32String{A: 1},
B: 2,
},
},
// NilPtrAnonymousHeadFloat32
{
2021-02-15 05:29:42 +03:00
name: "NilPtrAnonymousHeadFloat32",
2021-01-16 16:16:26 +03:00
data: struct {
*structFloat32
2021-01-16 16:16:26 +03:00
B float32 `json:"b"`
}{
structFloat32: nil,
2021-01-16 16:16:26 +03:00
B: 2,
},
},
{
2021-02-15 05:29:42 +03:00
name: "NilPtrAnonymousHeadFloat32OmitEmpty",
2021-01-16 16:16:26 +03:00
data: struct {
*structFloat32OmitEmpty
B float32 `json:"b,omitempty"`
2021-01-16 16:16:26 +03:00
}{
structFloat32OmitEmpty: nil,
B: 2,
2021-01-16 16:16:26 +03:00
},
},
{
2021-02-15 05:29:42 +03:00
name: "NilPtrAnonymousHeadFloat32String",
2021-01-16 16:16:26 +03:00
data: struct {
*structFloat32String
B float32 `json:"b,string"`
2021-01-16 16:16:26 +03:00
}{
structFloat32String: nil,
B: 2,
2021-01-16 16:16:26 +03:00
},
},
// AnonymousHeadFloat32Ptr
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:29:42 +03:00
name: "AnonymousHeadFloat32Ptr",
2021-01-16 16:16:26 +03:00
data: struct {
structFloat32Ptr
B *float32 `json:"b"`
}{
structFloat32Ptr: structFloat32Ptr{A: float32ptr(1)},
B: float32ptr(2),
},
},
{
2021-02-15 05:29:42 +03:00
name: "AnonymousHeadFloat32PtrOmitEmpty",
data: struct {
structFloat32PtrOmitEmpty
B *float32 `json:"b,omitempty"`
}{
structFloat32PtrOmitEmpty: structFloat32PtrOmitEmpty{A: float32ptr(1)},
B: float32ptr(2),
},
},
{
2021-02-15 05:29:42 +03:00
name: "AnonymousHeadFloat32PtrString",
data: struct {
structFloat32PtrString
B *float32 `json:"b,string"`
}{
structFloat32PtrString: structFloat32PtrString{A: float32ptr(1)},
B: float32ptr(2),
},
},
// AnonymousHeadFloat32PtrNil
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:29:42 +03:00
name: "AnonymousHeadFloat32PtrNil",
2021-01-16 16:16:26 +03:00
data: struct {
structFloat32Ptr
B *float32 `json:"b"`
}{
structFloat32Ptr: structFloat32Ptr{A: nil},
B: float32ptr(2),
},
},
{
2021-02-15 05:29:42 +03:00
name: "AnonymousHeadFloat32PtrNilOmitEmpty",
data: struct {
structFloat32PtrOmitEmpty
B *float32 `json:"b,omitempty"`
}{
structFloat32PtrOmitEmpty: structFloat32PtrOmitEmpty{A: nil},
B: float32ptr(2),
},
},
{
2021-02-15 05:29:42 +03:00
name: "AnonymousHeadFloat32PtrNilString",
data: struct {
structFloat32PtrString
B *float32 `json:"b,string"`
}{
structFloat32PtrString: structFloat32PtrString{A: nil},
B: float32ptr(2),
},
},
// PtrAnonymousHeadFloat32Ptr
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:29:42 +03:00
name: "PtrAnonymousHeadFloat32Ptr",
2021-01-16 16:16:26 +03:00
data: struct {
*structFloat32Ptr
B *float32 `json:"b"`
}{
structFloat32Ptr: &structFloat32Ptr{A: float32ptr(1)},
B: float32ptr(2),
},
},
{
2021-02-15 05:29:42 +03:00
name: "PtrAnonymousHeadFloat32PtrOmitEmpty",
data: struct {
*structFloat32PtrOmitEmpty
B *float32 `json:"b,omitempty"`
}{
structFloat32PtrOmitEmpty: &structFloat32PtrOmitEmpty{A: float32ptr(1)},
B: float32ptr(2),
},
},
{
2021-02-15 05:29:42 +03:00
name: "PtrAnonymousHeadFloat32PtrString",
data: struct {
*structFloat32PtrString
B *float32 `json:"b,string"`
}{
structFloat32PtrString: &structFloat32PtrString{A: float32ptr(1)},
B: float32ptr(2),
},
},
// NilPtrAnonymousHeadFloat32Ptr
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:29:42 +03:00
name: "NilPtrAnonymousHeadFloat32Ptr",
2021-01-16 16:16:26 +03:00
data: struct {
*structFloat32Ptr
B *float32 `json:"b"`
}{
structFloat32Ptr: nil,
B: float32ptr(2),
},
},
{
2021-02-15 05:29:42 +03:00
name: "NilPtrAnonymousHeadFloat32PtrOmitEmpty",
data: struct {
*structFloat32PtrOmitEmpty
B *float32 `json:"b,omitempty"`
}{
structFloat32PtrOmitEmpty: nil,
B: float32ptr(2),
},
},
{
2021-02-15 05:29:42 +03:00
name: "NilPtrAnonymousHeadFloat32PtrString",
data: struct {
*structFloat32PtrString
B *float32 `json:"b,string"`
}{
structFloat32PtrString: nil,
B: float32ptr(2),
},
},
// AnonymousHeadFloat32Only
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:29:42 +03:00
name: "AnonymousHeadFloat32Only",
2021-01-16 16:16:26 +03:00
data: struct {
structFloat32
}{
structFloat32: structFloat32{A: 1},
},
},
{
2021-02-15 05:29:42 +03:00
name: "AnonymousHeadFloat32OnlyOmitEmpty",
data: struct {
structFloat32OmitEmpty
}{
structFloat32OmitEmpty: structFloat32OmitEmpty{A: 1},
},
},
{
2021-02-15 05:29:42 +03:00
name: "AnonymousHeadFloat32OnlyString",
data: struct {
structFloat32String
}{
structFloat32String: structFloat32String{A: 1},
},
},
// PtrAnonymousHeadFloat32Only
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:29:42 +03:00
name: "PtrAnonymousHeadFloat32Only",
2021-01-16 16:16:26 +03:00
data: struct {
*structFloat32
}{
structFloat32: &structFloat32{A: 1},
},
},
{
2021-02-15 05:29:42 +03:00
name: "PtrAnonymousHeadFloat32OnlyOmitEmpty",
data: struct {
*structFloat32OmitEmpty
}{
structFloat32OmitEmpty: &structFloat32OmitEmpty{A: 1},
},
},
{
2021-02-15 05:29:42 +03:00
name: "PtrAnonymousHeadFloat32OnlyString",
data: struct {
*structFloat32String
}{
structFloat32String: &structFloat32String{A: 1},
},
},
// NilPtrAnonymousHeadFloat32Only
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:29:42 +03:00
name: "NilPtrAnonymousHeadFloat32Only",
2021-01-16 16:16:26 +03:00
data: struct {
*structFloat32
}{
structFloat32: nil,
},
},
{
2021-02-15 05:29:42 +03:00
name: "NilPtrAnonymousHeadFloat32OnlyOmitEmpty",
data: struct {
*structFloat32OmitEmpty
}{
structFloat32OmitEmpty: nil,
},
},
{
2021-02-15 05:29:42 +03:00
name: "NilPtrAnonymousHeadFloat32OnlyString",
data: struct {
*structFloat32String
}{
structFloat32String: nil,
},
},
// AnonymousHeadFloat32PtrOnly
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:29:42 +03:00
name: "AnonymousHeadFloat32PtrOnly",
2021-01-16 16:16:26 +03:00
data: struct {
structFloat32Ptr
}{
structFloat32Ptr: structFloat32Ptr{A: float32ptr(1)},
},
},
{
2021-02-15 05:29:42 +03:00
name: "AnonymousHeadFloat32PtrOnlyOmitEmpty",
data: struct {
structFloat32PtrOmitEmpty
}{
structFloat32PtrOmitEmpty: structFloat32PtrOmitEmpty{A: float32ptr(1)},
},
},
{
2021-02-15 05:29:42 +03:00
name: "AnonymousHeadFloat32PtrOnlyString",
data: struct {
structFloat32PtrString
}{
structFloat32PtrString: structFloat32PtrString{A: float32ptr(1)},
},
},
// AnonymousHeadFloat32PtrNilOnly
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:29:42 +03:00
name: "AnonymousHeadFloat32PtrNilOnly",
2021-01-16 16:16:26 +03:00
data: struct {
structFloat32Ptr
}{
structFloat32Ptr: structFloat32Ptr{A: nil},
},
},
{
2021-02-15 05:29:42 +03:00
name: "AnonymousHeadFloat32PtrNilOnlyOmitEmpty",
data: struct {
structFloat32PtrOmitEmpty
}{
structFloat32PtrOmitEmpty: structFloat32PtrOmitEmpty{A: nil},
},
},
{
2021-02-15 05:29:42 +03:00
name: "AnonymousHeadFloat32PtrNilOnlyString",
data: struct {
structFloat32PtrString
}{
structFloat32PtrString: structFloat32PtrString{A: nil},
},
},
// PtrAnonymousHeadFloat32PtrOnly
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:29:42 +03:00
name: "PtrAnonymousHeadFloat32PtrOnly",
2021-01-16 16:16:26 +03:00
data: struct {
*structFloat32Ptr
}{
structFloat32Ptr: &structFloat32Ptr{A: float32ptr(1)},
},
},
{
2021-02-15 05:29:42 +03:00
name: "PtrAnonymousHeadFloat32PtrOnlyOmitEmpty",
data: struct {
*structFloat32PtrOmitEmpty
}{
structFloat32PtrOmitEmpty: &structFloat32PtrOmitEmpty{A: float32ptr(1)},
},
},
{
2021-02-15 05:29:42 +03:00
name: "PtrAnonymousHeadFloat32PtrOnlyString",
data: struct {
*structFloat32PtrString
}{
structFloat32PtrString: &structFloat32PtrString{A: float32ptr(1)},
},
},
// NilPtrAnonymousHeadFloat32PtrOnly
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:29:42 +03:00
name: "NilPtrAnonymousHeadFloat32PtrOnly",
2021-01-16 16:16:26 +03:00
data: struct {
*structFloat32Ptr
}{
structFloat32Ptr: nil,
},
},
{
2021-02-15 05:29:42 +03:00
name: "NilPtrAnonymousHeadFloat32PtrOnlyOmitEmpty",
data: struct {
*structFloat32PtrOmitEmpty
}{
structFloat32PtrOmitEmpty: nil,
},
},
{
2021-02-15 05:29:42 +03:00
name: "NilPtrAnonymousHeadFloat32PtrOnlyString",
data: struct {
*structFloat32PtrString
}{
structFloat32PtrString: 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:29:42 +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
}
}
}
}