Add test case

This commit is contained in:
Masaaki Goshima 2021-05-07 00:55:15 +09:00
parent e12b021c70
commit 4cade6589b
1 changed files with 12 additions and 0 deletions

View File

@ -17,6 +17,9 @@ func TestCoverInt(t *testing.T) {
type structIntString struct { type structIntString struct {
A int `json:"a,string"` A int `json:"a,string"`
} }
type structIntStringOmitEmpty struct {
A int `json:"a,omitempty,string"`
}
type structIntPtr struct { type structIntPtr struct {
A *int `json:"a"` A *int `json:"a"`
@ -27,6 +30,9 @@ func TestCoverInt(t *testing.T) {
type structIntPtrString struct { type structIntPtrString struct {
A *int `json:"a,string"` A *int `json:"a,string"`
} }
type structIntPtrStringOmitEmpty struct {
A *int `json:"a,omitempty,string"`
}
tests := []struct { tests := []struct {
name string name string
@ -152,6 +158,12 @@ func TestCoverInt(t *testing.T) {
A int `json:"a,string"` A int `json:"a,string"`
}{}, }{},
}, },
{
name: "PtrHeadIntZeroStringOmitEmpty",
data: &struct {
A int `json:"a,string,omitempty"`
}{},
},
// PtrHeadInt // PtrHeadInt
{ {