go-json/cover_uint_test.go

1787 lines
34 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 TestCoverUint(t *testing.T) {
type structUint struct {
A uint `json:"a"`
}
type structUintOmitEmpty struct {
A uint `json:"a,omitempty"`
}
type structUintString struct {
A uint `json:"a,string"`
}
2021-01-16 16:16:26 +03:00
type structUintPtr struct {
A *uint `json:"a"`
}
type structUintPtrOmitEmpty struct {
A *uint `json:"a,omitempty"`
}
type structUintPtrString struct {
A *uint `json:"a,string"`
}
2021-01-16 16:16:26 +03:00
tests := []struct {
2021-02-15 05:24:35 +03:00
name string
data interface{}
2021-01-16 16:16:26 +03:00
}{
// HeadUintZero
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:24:35 +03:00
name: "HeadUintZero",
2021-01-16 16:16:26 +03:00
data: struct {
A uint `json:"a"`
}{},
},
{
2021-02-15 05:24:35 +03:00
name: "HeadUintZeroOmitEmpty",
data: struct {
A uint `json:"a,omitempty"`
}{},
},
{
2021-02-15 05:24:35 +03:00
name: "HeadUintZeroString",
data: struct {
A uint `json:"a,string"`
}{},
},
// HeadUint
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:24:35 +03:00
name: "HeadUint",
2021-01-16 16:16:26 +03:00
data: struct {
A uint `json:"a"`
}{A: 1},
},
{
2021-02-15 05:24:35 +03:00
name: "HeadUintOmitEmpty",
data: struct {
A uint `json:"a,omitempty"`
}{A: 1},
},
{
2021-02-15 05:24:35 +03:00
name: "HeadUintString",
data: struct {
A uint `json:"a,string"`
}{A: 1},
},
// HeadUintPtr
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:24:35 +03:00
name: "HeadUintPtr",
2021-01-16 16:16:26 +03:00
data: struct {
A *uint `json:"a"`
}{A: uptr(1)},
},
{
2021-02-15 05:24:35 +03:00
name: "HeadUintPtrOmitEmpty",
data: struct {
A *uint `json:"a,omitempty"`
}{A: uptr(1)},
},
{
2021-02-15 05:24:35 +03:00
name: "HeadUintPtrString",
data: struct {
A *uint `json:"a,string"`
}{A: uptr(1)},
},
// HeadUintPtrNil
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:24:35 +03:00
name: "HeadUintPtrNil",
2021-01-16 16:16:26 +03:00
data: struct {
A *uint `json:"a"`
}{A: nil},
},
{
2021-02-15 05:24:35 +03:00
name: "HeadUintPtrNilOmitEmpty",
data: struct {
A *uint `json:"a,omitempty"`
}{A: nil},
},
{
2021-02-15 05:24:35 +03:00
name: "HeadUintPtrNilString",
data: struct {
A *uint `json:"a,string"`
}{A: nil},
},
// PtrHeadUintZero
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintZero",
2021-01-16 16:16:26 +03:00
data: &struct {
A uint `json:"a"`
}{},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintZeroOmitEmpty",
data: &struct {
A uint `json:"a,omitempty"`
}{},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintZeroString",
data: &struct {
A uint `json:"a,string"`
}{},
},
// PtrHeadUint
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUint",
2021-01-16 16:16:26 +03:00
data: &struct {
A uint `json:"a"`
}{A: 1},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintOmitEmpty",
data: &struct {
A uint `json:"a,omitempty"`
}{A: 1},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintString",
data: &struct {
A uint `json:"a,string"`
}{A: 1},
},
// PtrHeadUintPtr
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintPtr",
2021-01-16 16:16:26 +03:00
data: &struct {
A *uint `json:"a"`
}{A: uptr(1)},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintPtrOmitEmpty",
data: &struct {
A *uint `json:"a,omitempty"`
}{A: uptr(1)},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintPtrString",
data: &struct {
A *uint `json:"a,string"`
}{A: uptr(1)},
},
// PtrHeadUintPtrNil
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintPtrNil",
2021-01-16 16:16:26 +03:00
data: &struct {
A *uint `json:"a"`
}{A: nil},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintPtrNilOmitEmpty",
data: &struct {
A *uint `json:"a,omitempty"`
}{A: nil},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintPtrNilString",
data: &struct {
A *uint `json:"a,string"`
}{A: nil},
},
// PtrHeadUintNil
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintNil",
2021-01-16 16:16:26 +03:00
data: (*struct {
A *uint `json:"a"`
})(nil),
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintNilOmitEmpty",
data: (*struct {
A *uint `json:"a,omitempty"`
})(nil),
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintNilString",
data: (*struct {
A *uint `json:"a,string"`
})(nil),
},
// HeadUintZeroMultiFields
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:24:35 +03:00
name: "HeadUintZeroMultiFields",
2021-01-16 16:16:26 +03:00
data: struct {
A uint `json:"a"`
B uint `json:"b"`
2021-02-15 05:24:35 +03:00
C uint `json:"c"`
2021-01-16 16:16:26 +03:00
}{},
},
{
2021-02-15 05:24:35 +03:00
name: "HeadUintZeroMultiFieldsOmitEmpty",
data: struct {
A uint `json:"a,omitempty"`
B uint `json:"b,omitempty"`
2021-02-15 05:24:35 +03:00
C uint `json:"c,omitempty"`
}{},
},
{
2021-02-15 05:24:35 +03:00
name: "HeadUintZeroMultiFields",
data: struct {
A uint `json:"a,string"`
B uint `json:"b,string"`
2021-02-15 05:24:35 +03:00
C uint `json:"c,string"`
}{},
},
// HeadUintMultiFields
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:24:35 +03:00
name: "HeadUintMultiFields",
2021-01-16 16:16:26 +03:00
data: struct {
A uint `json:"a"`
B uint `json:"b"`
2021-02-15 05:24:35 +03:00
C uint `json:"c"`
}{A: 1, B: 2, C: 3},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:24:35 +03:00
name: "HeadUintMultiFieldsOmitEmpty",
2021-01-16 16:16:26 +03:00
data: struct {
A uint `json:"a,omitempty"`
B uint `json:"b,omitempty"`
2021-02-15 05:24:35 +03:00
C uint `json:"c,omitempty"`
}{A: 1, B: 2, C: 3},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:24:35 +03:00
name: "HeadUintMultiFieldsString",
2021-01-16 16:16:26 +03:00
data: struct {
A uint `json:"a,string"`
B uint `json:"b,string"`
2021-02-15 05:24:35 +03:00
C uint `json:"c,string"`
}{A: 1, B: 2, C: 3},
2021-01-16 16:16:26 +03:00
},
// HeadUintPtrMultiFields
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:24:35 +03:00
name: "HeadUintPtrMultiFields",
data: struct {
A *uint `json:"a"`
B *uint `json:"b"`
2021-02-15 05:24:35 +03:00
C *uint `json:"c"`
}{A: uptr(1), B: uptr(2), C: uptr(3)},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:24:35 +03:00
name: "HeadUintPtrMultiFieldsOmitEmpty",
data: struct {
A *uint `json:"a,omitempty"`
B *uint `json:"b,omitempty"`
2021-02-15 05:24:35 +03:00
C *uint `json:"c,omitempty"`
}{A: uptr(1), B: uptr(2), C: uptr(3)},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:24:35 +03:00
name: "HeadUintPtrMultiFieldsString",
data: struct {
A *uint `json:"a,string"`
B *uint `json:"b,string"`
2021-02-15 05:24:35 +03:00
C *uint `json:"c,string"`
}{A: uptr(1), B: uptr(2), C: uptr(3)},
2021-01-16 16:16:26 +03:00
},
// HeadUintPtrNilMultiFields
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:24:35 +03:00
name: "HeadUintPtrNilMultiFields",
data: struct {
2021-01-16 16:16:26 +03:00
A *uint `json:"a"`
B *uint `json:"b"`
2021-02-15 05:24:35 +03:00
C *uint `json:"c"`
}{A: nil, B: nil, C: nil},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:24:35 +03:00
name: "HeadUintPtrNilMultiFieldsOmitEmpty",
data: struct {
A *uint `json:"a,omitempty"`
B *uint `json:"b,omitempty"`
2021-02-15 05:24:35 +03:00
C *uint `json:"c,omitempty"`
}{A: nil, B: nil, C: nil},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:24:35 +03:00
name: "HeadUintPtrNilMultiFieldsString",
data: struct {
A *uint `json:"a,string"`
B *uint `json:"b,string"`
2021-02-15 05:24:35 +03:00
C *uint `json:"c,string"`
}{A: nil, B: nil, C: nil},
},
// PtrHeadUintZeroMultiFields
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintZeroMultiFields",
data: &struct {
A uint `json:"a"`
B uint `json:"b"`
}{},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintZeroMultiFieldsOmitEmpty",
data: &struct {
A uint `json:"a,omitempty"`
B uint `json:"b,omitempty"`
}{},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintZeroMultiFieldsString",
data: &struct {
A uint `json:"a,string"`
B uint `json:"b,string"`
}{},
},
// PtrHeadUintMultiFields
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintMultiFields",
data: &struct {
A uint `json:"a"`
B uint `json:"b"`
}{A: 1, B: 2},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintMultiFieldsOmitEmpty",
data: &struct {
A uint `json:"a,omitempty"`
B uint `json:"b,omitempty"`
}{A: 1, B: 2},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintMultiFieldsString",
data: &struct {
A uint `json:"a,string"`
B uint `json:"b,string"`
}{A: 1, B: 2},
},
// PtrHeadUintPtrMultiFields
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintPtrMultiFields",
data: &struct {
A *uint `json:"a"`
B *uint `json:"b"`
}{A: uptr(1), B: uptr(2)},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintPtrMultiFieldsOmitEmpty",
data: &struct {
A *uint `json:"a,omitempty"`
B *uint `json:"b,omitempty"`
}{A: uptr(1), B: uptr(2)},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintPtrMultiFieldsString",
data: &struct {
A *uint `json:"a,string"`
B *uint `json:"b,string"`
}{A: uptr(1), B: uptr(2)},
},
// PtrHeadUintPtrNilMultiFields
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintPtrNilMultiFields",
data: &struct {
A *uint `json:"a"`
B *uint `json:"b"`
}{A: nil, B: nil},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintPtrNilMultiFieldsOmitEmpty",
data: &struct {
A *uint `json:"a,omitempty"`
B *uint `json:"b,omitempty"`
}{A: nil, B: nil},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintPtrNilMultiFieldsString",
data: &struct {
A *uint `json:"a,string"`
B *uint `json:"b,string"`
}{A: nil, B: nil},
},
// PtrHeadUintNilMultiFields
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintNilMultiFields",
data: (*struct {
A *uint `json:"a"`
B *uint `json:"b"`
})(nil),
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintNilMultiFieldsOmitEmpty",
data: (*struct {
A *uint `json:"a,omitempty"`
B *uint `json:"b,omitempty"`
})(nil),
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintNilMultiFieldsString",
data: (*struct {
A *uint `json:"a,string"`
B *uint `json:"b,string"`
})(nil),
},
// HeadUintZeroNotRoot
{
2021-02-15 05:24:35 +03:00
name: "HeadUintZeroNotRoot",
2021-01-16 16:16:26 +03:00
data: struct {
A struct {
A uint `json:"a"`
}
}{},
},
{
2021-02-15 05:24:35 +03:00
name: "HeadUintZeroNotRootOmitEmpty",
data: struct {
A struct {
A uint `json:"a,omitempty"`
}
}{},
},
{
2021-02-15 05:24:35 +03:00
name: "HeadUintZeroNotRootString",
data: struct {
A struct {
A uint `json:"a,string"`
}
}{},
},
// HeadUintNotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:24:35 +03:00
name: "HeadUintNotRoot",
2021-01-16 16:16:26 +03:00
data: struct {
A struct {
A uint `json:"a"`
}
}{A: struct {
A uint `json:"a"`
}{A: 1}},
},
{
2021-02-15 05:24:35 +03:00
name: "HeadUintNotRootOmitEmpty",
2021-01-16 16:16:26 +03:00
data: struct {
A struct {
A uint `json:"a,omitempty"`
2021-01-16 16:16:26 +03:00
}
}{A: struct {
A uint `json:"a,omitempty"`
}{A: 1}},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:24:35 +03:00
name: "HeadUintNotRootString",
2021-01-16 16:16:26 +03:00
data: struct {
A struct {
A uint `json:"a,string"`
2021-01-16 16:16:26 +03:00
}
}{A: struct {
A uint `json:"a,string"`
}{A: 1}},
2021-01-16 16:16:26 +03:00
},
// HeadUintPtrNotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:24:35 +03:00
name: "HeadUintPtrNotRoot",
2021-01-16 16:16:26 +03:00
data: struct {
A struct {
A *uint `json:"a"`
2021-01-16 16:16:26 +03:00
}
}{A: struct {
A *uint `json:"a"`
}{uptr(1)}},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:24:35 +03:00
name: "HeadUintPtrNotRootOmitEmpty",
2021-01-16 16:16:26 +03:00
data: struct {
A struct {
A *uint `json:"a,omitempty"`
2021-01-16 16:16:26 +03:00
}
}{A: struct {
A *uint `json:"a,omitempty"`
}{uptr(1)}},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:24:35 +03:00
name: "HeadUintPtrNotRootString",
2021-01-16 16:16:26 +03:00
data: struct {
A struct {
A *uint `json:"a,string"`
2021-01-16 16:16:26 +03:00
}
}{A: struct {
A *uint `json:"a,string"`
}{uptr(1)}},
2021-01-16 16:16:26 +03:00
},
// HeadUintPtrNilNotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:24:35 +03:00
name: "HeadUintPtrNilNotRoot",
data: struct {
A struct {
A *uint `json:"a"`
}
}{},
},
{
2021-02-15 05:24:35 +03:00
name: "HeadUintPtrNilNotRootOmitEmpty",
data: struct {
A struct {
A *uint `json:"a,omitempty"`
}
}{},
},
{
2021-02-15 05:24:35 +03:00
name: "HeadUintPtrNilNotRootString",
data: struct {
A struct {
A *uint `json:"a,string"`
}
}{},
},
// PtrHeadUintZeroNotRoot
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintZeroNotRoot",
data: struct {
A *struct {
A uint `json:"a"`
}
}{A: new(struct {
A uint `json:"a"`
})},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintZeroNotRootOmitEmpty",
data: struct {
A *struct {
A uint `json:"a,omitempty"`
}
}{A: new(struct {
A uint `json:"a,omitempty"`
})},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintZeroNotRootString",
data: struct {
A *struct {
A uint `json:"a,string"`
}
}{A: new(struct {
A uint `json:"a,string"`
})},
},
// PtrHeadUintNotRoot
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintNotRoot",
data: struct {
A *struct {
A uint `json:"a"`
}
}{A: &(struct {
A uint `json:"a"`
}{A: 1})},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintNotRootOmitEmpty",
data: struct {
A *struct {
A uint `json:"a,omitempty"`
}
}{A: &(struct {
A uint `json:"a,omitempty"`
}{A: 1})},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintNotRootString",
data: struct {
A *struct {
A uint `json:"a,string"`
}
}{A: &(struct {
A uint `json:"a,string"`
}{A: 1})},
},
// PtrHeadUintPtrNotRoot
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintPtrNotRoot",
data: struct {
A *struct {
A *uint `json:"a"`
}
}{A: &(struct {
A *uint `json:"a"`
}{A: uptr(1)})},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintPtrNotRootOmitEmpty",
data: struct {
A *struct {
A *uint `json:"a,omitempty"`
}
}{A: &(struct {
A *uint `json:"a,omitempty"`
}{A: uptr(1)})},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintPtrNotRootString",
data: struct {
A *struct {
A *uint `json:"a,string"`
}
}{A: &(struct {
A *uint `json:"a,string"`
}{A: uptr(1)})},
},
// PtrHeadUintPtrNilNotRoot
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintPtrNilNotRoot",
data: struct {
A *struct {
A *uint `json:"a"`
}
}{A: &(struct {
A *uint `json:"a"`
}{A: nil})},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintPtrNilNotRootOmitEmpty",
data: struct {
A *struct {
A *uint `json:"a,omitempty"`
}
}{A: &(struct {
A *uint `json:"a,omitempty"`
}{A: nil})},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintPtrNilNotRootString",
data: struct {
A *struct {
A *uint `json:"a,string"`
}
}{A: &(struct {
A *uint `json:"a,string"`
}{A: nil})},
},
// PtrHeadUintNilNotRoot
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintNilNotRoot",
data: struct {
A *struct {
A *uint `json:"a"`
}
}{A: nil},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintNilNotRootOmitEmpty",
data: struct {
A *struct {
A *uint `json:"a,omitempty"`
} `json:",omitempty"`
}{A: nil},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintNilNotRootString",
data: struct {
A *struct {
A *uint `json:"a,string"`
} `json:",string"`
}{A: nil},
},
// HeadUintZeroMultiFieldsNotRoot
{
2021-02-15 05:24:35 +03:00
name: "HeadUintZeroMultiFieldsNotRoot",
data: struct {
A struct {
A uint `json:"a"`
}
B struct {
B uint `json:"b"`
}
}{},
},
{
2021-02-15 05:24:35 +03:00
name: "HeadUintZeroMultiFieldsNotRootOmitEmpty",
data: struct {
A struct {
A uint `json:"a,omitempty"`
}
B struct {
B uint `json:"b,omitempty"`
}
}{},
},
{
2021-02-15 05:24:35 +03:00
name: "HeadUintZeroMultiFieldsNotRootString",
data: struct {
A struct {
A uint `json:"a,string"`
}
B struct {
B uint `json:"b,string"`
}
}{},
},
// HeadUintMultiFieldsNotRoot
{
2021-02-15 05:24:35 +03:00
name: "HeadUintMultiFieldsNotRoot",
data: struct {
A struct {
A uint `json:"a"`
}
B struct {
B uint `json:"b"`
}
}{A: struct {
A uint `json:"a"`
}{A: 1}, B: struct {
B uint `json:"b"`
}{B: 2}},
},
{
2021-02-15 05:24:35 +03:00
name: "HeadUintMultiFieldsNotRootOmitEmpty",
data: struct {
A struct {
A uint `json:"a,omitempty"`
}
B struct {
B uint `json:"b,omitempty"`
}
}{A: struct {
A uint `json:"a,omitempty"`
}{A: 1}, B: struct {
B uint `json:"b,omitempty"`
}{B: 2}},
},
{
2021-02-15 05:24:35 +03:00
name: "HeadUintMultiFieldsNotRootString",
data: struct {
A struct {
A uint `json:"a,string"`
}
B struct {
B uint `json:"b,string"`
}
}{A: struct {
A uint `json:"a,string"`
}{A: 1}, B: struct {
B uint `json:"b,string"`
}{B: 2}},
},
// HeadUintPtrMultiFieldsNotRoot
{
2021-02-15 05:24:35 +03:00
name: "HeadUintPtrMultiFieldsNotRoot",
data: struct {
A struct {
A *uint `json:"a"`
}
B struct {
B *uint `json:"b"`
}
}{A: struct {
A *uint `json:"a"`
}{A: uptr(1)}, B: struct {
B *uint `json:"b"`
}{B: uptr(2)}},
},
{
2021-02-15 05:24:35 +03:00
name: "HeadUintPtrMultiFieldsNotRootOmitEmpty",
data: struct {
A struct {
A *uint `json:"a,omitempty"`
}
B struct {
B *uint `json:"b,omitempty"`
}
}{A: struct {
A *uint `json:"a,omitempty"`
}{A: uptr(1)}, B: struct {
B *uint `json:"b,omitempty"`
}{B: uptr(2)}},
},
{
2021-02-15 05:24:35 +03:00
name: "HeadUintPtrMultiFieldsNotRootString",
data: struct {
A struct {
A *uint `json:"a,string"`
}
B struct {
B *uint `json:"b,string"`
}
}{A: struct {
A *uint `json:"a,string"`
}{A: uptr(1)}, B: struct {
B *uint `json:"b,string"`
}{B: uptr(2)}},
},
// HeadUintPtrNilMultiFieldsNotRoot
{
2021-02-15 05:24:35 +03:00
name: "HeadUintPtrNilMultiFieldsNotRoot",
data: struct {
A struct {
A *uint `json:"a"`
}
B struct {
B *uint `json:"b"`
}
}{A: struct {
A *uint `json:"a"`
}{A: nil}, B: struct {
B *uint `json:"b"`
}{B: nil}},
},
{
2021-02-15 05:24:35 +03:00
name: "HeadUintPtrNilMultiFieldsNotRootOmitEmpty",
data: struct {
A struct {
A *uint `json:"a,omitempty"`
}
B struct {
B *uint `json:"b,omitempty"`
}
}{A: struct {
A *uint `json:"a,omitempty"`
}{A: nil}, B: struct {
B *uint `json:"b,omitempty"`
}{B: nil}},
},
{
2021-02-15 05:24:35 +03:00
name: "HeadUintPtrNilMultiFieldsNotRootString",
data: struct {
A struct {
A *uint `json:"a,string"`
}
B struct {
B *uint `json:"b,string"`
}
}{A: struct {
A *uint `json:"a,string"`
}{A: nil}, B: struct {
B *uint `json:"b,string"`
}{B: nil}},
},
// PtrHeadUintZeroMultiFieldsNotRoot
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintZeroMultiFieldsNotRoot",
data: &struct {
A struct {
A uint `json:"a"`
2021-01-16 16:16:26 +03:00
}
B struct {
B uint `json:"b"`
}
}{},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintZeroMultiFieldsNotRootOmitEmpty",
data: &struct {
A struct {
A uint `json:"a,omitempty"`
2021-01-16 16:16:26 +03:00
}
B struct {
B uint `json:"b,omitempty"`
}
}{},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintZeroMultiFieldsNotRootString",
data: &struct {
2021-01-16 16:16:26 +03:00
A struct {
A uint `json:"a,string"`
2021-01-16 16:16:26 +03:00
}
B struct {
B uint `json:"b,string"`
2021-01-16 16:16:26 +03:00
}
}{},
},
// PtrHeadUintMultiFieldsNotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintMultiFieldsNotRoot",
data: &struct {
2021-01-16 16:16:26 +03:00
A struct {
A uint `json:"a"`
}
B struct {
B uint `json:"b"`
}
}{A: struct {
A uint `json:"a"`
}{A: 1}, B: struct {
B uint `json:"b"`
}{B: 2}},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintMultiFieldsNotRootOmitEmpty",
data: &struct {
2021-01-16 16:16:26 +03:00
A struct {
A uint `json:"a,omitempty"`
2021-01-16 16:16:26 +03:00
}
B struct {
B uint `json:"b,omitempty"`
2021-01-16 16:16:26 +03:00
}
}{A: struct {
A uint `json:"a,omitempty"`
}{A: 1}, B: struct {
B uint `json:"b,omitempty"`
}{B: 2}},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintMultiFieldsNotRootString",
data: &struct {
2021-01-16 16:16:26 +03:00
A struct {
A uint `json:"a,string"`
2021-01-16 16:16:26 +03:00
}
B struct {
B uint `json:"b,string"`
2021-01-16 16:16:26 +03:00
}
}{A: struct {
A uint `json:"a,string"`
}{A: 1}, B: struct {
B uint `json:"b,string"`
}{B: 2}},
2021-01-16 16:16:26 +03:00
},
// PtrHeadUintPtrMultiFieldsNotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintPtrMultiFieldsNotRoot",
2021-01-16 16:16:26 +03:00
data: &struct {
A *struct {
A *uint `json:"a"`
2021-01-16 16:16:26 +03:00
}
B *struct {
B *uint `json:"b"`
2021-01-16 16:16:26 +03:00
}
}{A: &(struct {
A *uint `json:"a"`
}{A: uptr(1)}), B: &(struct {
B *uint `json:"b"`
}{B: uptr(2)})},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintPtrMultiFieldsNotRootOmitEmpty",
2021-01-16 16:16:26 +03:00
data: &struct {
A *struct {
A *uint `json:"a,omitempty"`
}
B *struct {
B *uint `json:"b,omitempty"`
}
}{A: &(struct {
A *uint `json:"a,omitempty"`
}{A: uptr(1)}), B: &(struct {
B *uint `json:"b,omitempty"`
}{B: uptr(2)})},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintPtrMultiFieldsNotRootString",
data: &struct {
A *struct {
A *uint `json:"a,string"`
}
B *struct {
B *uint `json:"b,string"`
}
}{A: &(struct {
A *uint `json:"a,string"`
}{A: uptr(1)}), B: &(struct {
B *uint `json:"b,string"`
}{B: uptr(2)})},
},
// PtrHeadUintPtrNilMultiFieldsNotRoot
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintPtrNilMultiFieldsNotRoot",
data: &struct {
A *struct {
A *uint `json:"a"`
}
B *struct {
B *uint `json:"b"`
}
}{A: nil, B: nil},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintPtrNilMultiFieldsNotRootOmitEmpty",
data: &struct {
A *struct {
A *uint `json:"a,omitempty"`
} `json:",omitempty"`
B *struct {
B *uint `json:"b,omitempty"`
} `json:",omitempty"`
}{A: nil, B: nil},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintPtrNilMultiFieldsNotRootString",
data: &struct {
A *struct {
A *uint `json:"a,string"`
} `json:",string"`
B *struct {
B *uint `json:"b,string"`
} `json:",string"`
}{A: nil, B: nil},
},
// PtrHeadUintNilMultiFieldsNotRoot
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintNilMultiFieldsNotRoot",
data: (*struct {
A *struct {
A *uint `json:"a"`
}
B *struct {
B *uint `json:"b"`
}
})(nil),
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintNilMultiFieldsNotRootOmitEmpty",
data: (*struct {
A *struct {
A *uint `json:"a,omitempty"`
}
B *struct {
B *uint `json:"b,omitempty"`
}
})(nil),
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintNilMultiFieldsNotRootString",
data: (*struct {
A *struct {
A *uint `json:"a,string"`
}
B *struct {
B *uint `json:"b,string"`
}
})(nil),
},
// PtrHeadUintDoubleMultiFieldsNotRoot
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintDoubleMultiFieldsNotRoot",
data: &struct {
A *struct {
2021-01-16 16:16:26 +03:00
A uint `json:"a"`
B uint `json:"b"`
2021-01-16 16:16:26 +03:00
}
B *struct {
A uint `json:"a"`
2021-01-16 16:16:26 +03:00
B uint `json:"b"`
}
}{A: &(struct {
2021-01-16 16:16:26 +03:00
A uint `json:"a"`
B uint `json:"b"`
}{A: 1, B: 2}), B: &(struct {
A uint `json:"a"`
B uint `json:"b"`
}{A: 3, B: 4})},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintDoubleMultiFieldsNotRootOmitEmpty",
data: &struct {
A *struct {
A uint `json:"a,omitempty"`
B uint `json:"b,omitempty"`
}
B *struct {
A uint `json:"a,omitempty"`
B uint `json:"b,omitempty"`
}
}{A: &(struct {
A uint `json:"a,omitempty"`
B uint `json:"b,omitempty"`
}{A: 1, B: 2}), B: &(struct {
A uint `json:"a,omitempty"`
B uint `json:"b,omitempty"`
}{A: 3, B: 4})},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintDoubleMultiFieldsNotRootString",
2021-01-16 16:16:26 +03:00
data: &struct {
A *struct {
A uint `json:"a,string"`
B uint `json:"b,string"`
2021-01-16 16:16:26 +03:00
}
B *struct {
A uint `json:"a,string"`
B uint `json:"b,string"`
2021-01-16 16:16:26 +03:00
}
}{A: &(struct {
A uint `json:"a,string"`
B uint `json:"b,string"`
}{A: 1, B: 2}), B: &(struct {
A uint `json:"a,string"`
B uint `json:"b,string"`
}{A: 3, B: 4})},
2021-01-16 16:16:26 +03:00
},
// PtrHeadUintNilDoubleMultiFieldsNotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintNilDoubleMultiFieldsNotRoot",
2021-01-16 16:16:26 +03:00
data: &struct {
A *struct {
A uint `json:"a"`
B uint `json:"b"`
2021-01-16 16:16:26 +03:00
}
B *struct {
A uint `json:"a"`
B uint `json:"b"`
2021-01-16 16:16:26 +03:00
}
}{A: nil, B: nil},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintNilDoubleMultiFieldsNotRootOmitEmpty",
data: &struct {
2021-01-16 16:16:26 +03:00
A *struct {
A uint `json:"a,omitempty"`
B uint `json:"b,omitempty"`
} `json:",omitempty"`
2021-01-16 16:16:26 +03:00
B *struct {
A uint `json:"a,omitempty"`
B uint `json:"b,omitempty"`
} `json:",omitempty"`
}{A: nil, B: nil},
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintNilDoubleMultiFieldsNotRootString",
2021-01-16 16:16:26 +03:00
data: &struct {
A *struct {
A uint `json:"a,string"`
B uint `json:"b,string"`
2021-01-16 16:16:26 +03:00
}
B *struct {
A uint `json:"a,string"`
B uint `json:"b,string"`
2021-01-16 16:16:26 +03:00
}
}{A: nil, B: nil},
2021-01-16 16:16:26 +03:00
},
// PtrHeadUintNilDoubleMultiFieldsNotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintNilDoubleMultiFieldsNotRoot",
data: (*struct {
2021-01-16 16:16:26 +03:00
A *struct {
A uint `json:"a"`
B uint `json:"b"`
}
B *struct {
A uint `json:"a"`
B uint `json:"b"`
}
})(nil),
2021-01-16 16:16:26 +03:00
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintNilDoubleMultiFieldsNotRootOmitEmpty",
2021-01-16 16:16:26 +03:00
data: (*struct {
A *struct {
A uint `json:"a,omitempty"`
B uint `json:"b,omitempty"`
2021-01-16 16:16:26 +03:00
}
B *struct {
A uint `json:"a,omitempty"`
B uint `json:"b,omitempty"`
}
})(nil),
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintNilDoubleMultiFieldsNotRootString",
data: (*struct {
A *struct {
A uint `json:"a,string"`
B uint `json:"b,string"`
}
B *struct {
A uint `json:"a,string"`
B uint `json:"b,string"`
2021-01-16 16:16:26 +03:00
}
})(nil),
},
// PtrHeadUintPtrDoubleMultiFieldsNotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintPtrDoubleMultiFieldsNotRoot",
2021-01-16 16:16:26 +03:00
data: &struct {
A *struct {
A *uint `json:"a"`
B *uint `json:"b"`
}
B *struct {
A *uint `json:"a"`
B *uint `json:"b"`
}
}{A: &(struct {
A *uint `json:"a"`
B *uint `json:"b"`
}{A: uptr(1), B: uptr(2)}), B: &(struct {
A *uint `json:"a"`
B *uint `json:"b"`
}{A: uptr(3), B: uptr(4)})},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintPtrDoubleMultiFieldsNotRootOmitEmpty",
data: &struct {
A *struct {
A *uint `json:"a,omitempty"`
B *uint `json:"b,omitempty"`
}
B *struct {
A *uint `json:"a,omitempty"`
B *uint `json:"b,omitempty"`
}
}{A: &(struct {
A *uint `json:"a,omitempty"`
B *uint `json:"b,omitempty"`
}{A: uptr(1), B: uptr(2)}), B: &(struct {
A *uint `json:"a,omitempty"`
B *uint `json:"b,omitempty"`
}{A: uptr(3), B: uptr(4)})},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintPtrDoubleMultiFieldsNotRootString",
data: &struct {
A *struct {
A *uint `json:"a,string"`
B *uint `json:"b,string"`
}
B *struct {
A *uint `json:"a,string"`
B *uint `json:"b,string"`
}
}{A: &(struct {
A *uint `json:"a,string"`
B *uint `json:"b,string"`
}{A: uptr(1), B: uptr(2)}), B: &(struct {
A *uint `json:"a,string"`
B *uint `json:"b,string"`
}{A: uptr(3), B: uptr(4)})},
},
// PtrHeadUintPtrNilDoubleMultiFieldsNotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintPtrNilDoubleMultiFieldsNotRoot",
2021-01-16 16:16:26 +03:00
data: &struct {
A *struct {
A *uint `json:"a"`
B *uint `json:"b"`
}
B *struct {
A *uint `json:"a"`
B *uint `json:"b"`
}
}{A: nil, B: nil},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintPtrNilDoubleMultiFieldsNotRootOmitEmpty",
data: &struct {
A *struct {
A *uint `json:"a,omitempty"`
B *uint `json:"b,omitempty"`
} `json:",omitempty"`
B *struct {
A *uint `json:"a,omitempty"`
B *uint `json:"b,omitempty"`
} `json:",omitempty"`
}{A: nil, B: nil},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintPtrNilDoubleMultiFieldsNotRootString",
data: &struct {
A *struct {
A *uint `json:"a,string"`
B *uint `json:"b,string"`
}
B *struct {
A *uint `json:"a,string"`
B *uint `json:"b,string"`
}
}{A: nil, B: nil},
},
// PtrHeadUintPtrNilDoubleMultiFieldsNotRoot
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintPtrNilDoubleMultiFieldsNotRoot",
2021-01-16 16:16:26 +03:00
data: (*struct {
A *struct {
A *uint `json:"a"`
B *uint `json:"b"`
}
B *struct {
A *uint `json:"a"`
B *uint `json:"b"`
}
})(nil),
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintPtrNilDoubleMultiFieldsNotRootOmitEmpty",
data: (*struct {
A *struct {
A *uint `json:"a,omitempty"`
B *uint `json:"b,omitempty"`
}
B *struct {
A *uint `json:"a,omitempty"`
B *uint `json:"b,omitempty"`
}
})(nil),
},
{
2021-02-15 05:24:35 +03:00
name: "PtrHeadUintPtrNilDoubleMultiFieldsNotRootString",
data: (*struct {
A *struct {
A *uint `json:"a,string"`
B *uint `json:"b,string"`
}
B *struct {
A *uint `json:"a,string"`
B *uint `json:"b,string"`
}
})(nil),
},
// AnonymousHeadUint
{
2021-02-15 05:24:35 +03:00
name: "AnonymousHeadUint",
data: struct {
structUint
B uint `json:"b"`
}{
structUint: structUint{A: 1},
B: 2,
},
},
{
2021-02-15 05:24:35 +03:00
name: "AnonymousHeadUintOmitEmpty",
data: struct {
structUintOmitEmpty
B uint `json:"b,omitempty"`
}{
structUintOmitEmpty: structUintOmitEmpty{A: 1},
B: 2,
},
},
{
2021-02-15 05:24:35 +03:00
name: "AnonymousHeadUintString",
data: struct {
structUintString
B uint `json:"b,string"`
}{
structUintString: structUintString{A: 1},
B: 2,
},
},
// PtrAnonymousHeadUint
{
2021-02-15 05:24:35 +03:00
name: "PtrAnonymousHeadUint",
data: struct {
*structUint
B uint `json:"b"`
}{
structUint: &structUint{A: 1},
B: 2,
},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrAnonymousHeadUintOmitEmpty",
data: struct {
*structUintOmitEmpty
B uint `json:"b,omitempty"`
}{
structUintOmitEmpty: &structUintOmitEmpty{A: 1},
B: 2,
},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrAnonymousHeadUintString",
data: struct {
*structUintString
B uint `json:"b,string"`
}{
structUintString: &structUintString{A: 1},
B: 2,
},
},
// NilPtrAnonymousHeadUint
{
2021-02-15 05:24:35 +03:00
name: "NilPtrAnonymousHeadUint",
2021-01-16 16:16:26 +03:00
data: struct {
*structUint
2021-01-16 16:16:26 +03:00
B uint `json:"b"`
}{
structUint: nil,
2021-01-16 16:16:26 +03:00
B: 2,
},
},
{
2021-02-15 05:24:35 +03:00
name: "NilPtrAnonymousHeadUintOmitEmpty",
2021-01-16 16:16:26 +03:00
data: struct {
*structUintOmitEmpty
B uint `json:"b,omitempty"`
2021-01-16 16:16:26 +03:00
}{
structUintOmitEmpty: nil,
B: 2,
2021-01-16 16:16:26 +03:00
},
},
{
2021-02-15 05:24:35 +03:00
name: "NilPtrAnonymousHeadUintString",
2021-01-16 16:16:26 +03:00
data: struct {
*structUintString
B uint `json:"b,string"`
2021-01-16 16:16:26 +03:00
}{
structUintString: nil,
B: 2,
2021-01-16 16:16:26 +03:00
},
},
// AnonymousHeadUintPtr
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:24:35 +03:00
name: "AnonymousHeadUintPtr",
2021-01-16 16:16:26 +03:00
data: struct {
structUintPtr
B *uint `json:"b"`
}{
structUintPtr: structUintPtr{A: uptr(1)},
B: uptr(2),
},
},
{
2021-02-15 05:24:35 +03:00
name: "AnonymousHeadUintPtrOmitEmpty",
data: struct {
structUintPtrOmitEmpty
B *uint `json:"b,omitempty"`
}{
structUintPtrOmitEmpty: structUintPtrOmitEmpty{A: uptr(1)},
B: uptr(2),
},
},
{
2021-02-15 05:24:35 +03:00
name: "AnonymousHeadUintPtrString",
data: struct {
structUintPtrString
B *uint `json:"b,string"`
}{
structUintPtrString: structUintPtrString{A: uptr(1)},
B: uptr(2),
},
},
// AnonymousHeadUintPtrNil
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:24:35 +03:00
name: "AnonymousHeadUintPtrNil",
2021-01-16 16:16:26 +03:00
data: struct {
structUintPtr
B *uint `json:"b"`
}{
structUintPtr: structUintPtr{A: nil},
B: uptr(2),
},
},
{
2021-02-15 05:24:35 +03:00
name: "AnonymousHeadUintPtrNilOmitEmpty",
data: struct {
structUintPtrOmitEmpty
B *uint `json:"b,omitempty"`
}{
structUintPtrOmitEmpty: structUintPtrOmitEmpty{A: nil},
B: uptr(2),
},
},
{
2021-02-15 05:24:35 +03:00
name: "AnonymousHeadUintPtrNilString",
data: struct {
structUintPtrString
B *uint `json:"b,string"`
}{
structUintPtrString: structUintPtrString{A: nil},
B: uptr(2),
},
},
// PtrAnonymousHeadUintPtr
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:24:35 +03:00
name: "PtrAnonymousHeadUintPtr",
2021-01-16 16:16:26 +03:00
data: struct {
*structUintPtr
B *uint `json:"b"`
}{
structUintPtr: &structUintPtr{A: uptr(1)},
B: uptr(2),
},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrAnonymousHeadUintPtrOmitEmpty",
data: struct {
*structUintPtrOmitEmpty
B *uint `json:"b,omitempty"`
}{
structUintPtrOmitEmpty: &structUintPtrOmitEmpty{A: uptr(1)},
B: uptr(2),
},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrAnonymousHeadUintPtrString",
data: struct {
*structUintPtrString
B *uint `json:"b,string"`
}{
structUintPtrString: &structUintPtrString{A: uptr(1)},
B: uptr(2),
},
},
// NilPtrAnonymousHeadUintPtr
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:24:35 +03:00
name: "NilPtrAnonymousHeadUintPtr",
2021-01-16 16:16:26 +03:00
data: struct {
*structUintPtr
B *uint `json:"b"`
}{
structUintPtr: nil,
B: uptr(2),
},
},
{
2021-02-15 05:24:35 +03:00
name: "NilPtrAnonymousHeadUintPtrOmitEmpty",
data: struct {
*structUintPtrOmitEmpty
B *uint `json:"b,omitempty"`
}{
structUintPtrOmitEmpty: nil,
B: uptr(2),
},
},
{
2021-02-15 05:24:35 +03:00
name: "NilPtrAnonymousHeadUintPtrString",
data: struct {
*structUintPtrString
B *uint `json:"b,string"`
}{
structUintPtrString: nil,
B: uptr(2),
},
},
// AnonymousHeadUintOnly
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:24:35 +03:00
name: "AnonymousHeadUintOnly",
2021-01-16 16:16:26 +03:00
data: struct {
structUint
}{
structUint: structUint{A: 1},
},
},
{
2021-02-15 05:24:35 +03:00
name: "AnonymousHeadUintOnlyOmitEmpty",
data: struct {
structUintOmitEmpty
}{
structUintOmitEmpty: structUintOmitEmpty{A: 1},
},
},
{
2021-02-15 05:24:35 +03:00
name: "AnonymousHeadUintOnlyString",
data: struct {
structUintString
}{
structUintString: structUintString{A: 1},
},
},
// PtrAnonymousHeadUintOnly
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:24:35 +03:00
name: "PtrAnonymousHeadUintOnly",
2021-01-16 16:16:26 +03:00
data: struct {
*structUint
}{
structUint: &structUint{A: 1},
},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrAnonymousHeadUintOnlyOmitEmpty",
data: struct {
*structUintOmitEmpty
}{
structUintOmitEmpty: &structUintOmitEmpty{A: 1},
},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrAnonymousHeadUintOnlyString",
data: struct {
*structUintString
}{
structUintString: &structUintString{A: 1},
},
},
// NilPtrAnonymousHeadUintOnly
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:24:35 +03:00
name: "NilPtrAnonymousHeadUintOnly",
2021-01-16 16:16:26 +03:00
data: struct {
*structUint
}{
structUint: nil,
},
},
{
2021-02-15 05:24:35 +03:00
name: "NilPtrAnonymousHeadUintOnlyOmitEmpty",
data: struct {
*structUintOmitEmpty
}{
structUintOmitEmpty: nil,
},
},
{
2021-02-15 05:24:35 +03:00
name: "NilPtrAnonymousHeadUintOnlyString",
data: struct {
*structUintString
}{
structUintString: nil,
},
},
// AnonymousHeadUintPtrOnly
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:24:35 +03:00
name: "AnonymousHeadUintPtrOnly",
2021-01-16 16:16:26 +03:00
data: struct {
structUintPtr
}{
structUintPtr: structUintPtr{A: uptr(1)},
},
},
{
2021-02-15 05:24:35 +03:00
name: "AnonymousHeadUintPtrOnlyOmitEmpty",
data: struct {
structUintPtrOmitEmpty
}{
structUintPtrOmitEmpty: structUintPtrOmitEmpty{A: uptr(1)},
},
},
{
2021-02-15 05:24:35 +03:00
name: "AnonymousHeadUintPtrOnlyString",
data: struct {
structUintPtrString
}{
structUintPtrString: structUintPtrString{A: uptr(1)},
},
},
// AnonymousHeadUintPtrNilOnly
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:24:35 +03:00
name: "AnonymousHeadUintPtrNilOnly",
2021-01-16 16:16:26 +03:00
data: struct {
structUintPtr
}{
structUintPtr: structUintPtr{A: nil},
},
},
{
2021-02-15 05:24:35 +03:00
name: "AnonymousHeadUintPtrNilOnlyOmitEmpty",
data: struct {
structUintPtrOmitEmpty
}{
structUintPtrOmitEmpty: structUintPtrOmitEmpty{A: nil},
},
},
{
2021-02-15 05:24:35 +03:00
name: "AnonymousHeadUintPtrNilOnlyString",
data: struct {
structUintPtrString
}{
structUintPtrString: structUintPtrString{A: nil},
},
},
// PtrAnonymousHeadUintPtrOnly
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:24:35 +03:00
name: "PtrAnonymousHeadUintPtrOnly",
2021-01-16 16:16:26 +03:00
data: struct {
*structUintPtr
}{
structUintPtr: &structUintPtr{A: uptr(1)},
},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrAnonymousHeadUintPtrOnlyOmitEmpty",
data: struct {
*structUintPtrOmitEmpty
}{
structUintPtrOmitEmpty: &structUintPtrOmitEmpty{A: uptr(1)},
},
},
{
2021-02-15 05:24:35 +03:00
name: "PtrAnonymousHeadUintPtrOnlyString",
data: struct {
*structUintPtrString
}{
structUintPtrString: &structUintPtrString{A: uptr(1)},
},
},
// NilPtrAnonymousHeadUintPtrOnly
2021-01-16 16:16:26 +03:00
{
2021-02-15 05:24:35 +03:00
name: "NilPtrAnonymousHeadUintPtrOnly",
2021-01-16 16:16:26 +03:00
data: struct {
*structUintPtr
}{
structUintPtr: nil,
},
},
{
2021-02-15 05:24:35 +03:00
name: "NilPtrAnonymousHeadUintPtrOnlyOmitEmpty",
data: struct {
*structUintPtrOmitEmpty
}{
structUintPtrOmitEmpty: nil,
},
},
{
2021-02-15 05:24:35 +03:00
name: "NilPtrAnonymousHeadUintPtrOnlyString",
data: struct {
*structUintPtrString
}{
structUintPtrString: nil,
},
},
2021-01-16 16:16:26 +03:00
}
for _, test := range tests {
for _, indent := range []bool{true, false} {
for _, htmlEscape := range []bool{true, false} {
var buf bytes.Buffer
enc := json.NewEncoder(&buf)
enc.SetEscapeHTML(htmlEscape)
if indent {
enc.SetIndent("", " ")
}
if err := enc.Encode(test.data); err != nil {
2021-02-15 05:24:35 +03:00
t.Fatalf("%s(htmlEscape:%T): %+v: %s", test.name, htmlEscape, test.data, err)
2021-01-16 16:16:26 +03:00
}
stdresult := encodeByEncodingJSON(test.data, indent, htmlEscape)
if buf.String() != stdresult {
t.Errorf("%s(htmlEscape:%T): doesn't compatible with encoding/json. expected %q but got %q", test.name, htmlEscape, stdresult, buf.String())
}
2021-01-16 16:16:26 +03:00
}
}
}
}