Add test case for int type

This commit is contained in:
Masaaki Goshima 2021-05-07 01:39:58 +09:00
parent 87b93ad8a4
commit 40f049d8a1
1 changed files with 511 additions and 1 deletions

View File

@ -184,6 +184,12 @@ func TestCoverInt(t *testing.T) {
A int `json:"a,string"` A int `json:"a,string"`
}{A: -1}, }{A: -1},
}, },
{
name: "PtrHeadIntStringOmitEmpty",
data: &struct {
A int `json:"a,string,omitempty"`
}{A: -1},
},
// PtrHeadIntPtr // PtrHeadIntPtr
{ {
@ -204,6 +210,12 @@ func TestCoverInt(t *testing.T) {
A *int `json:"a,string"` A *int `json:"a,string"`
}{A: intptr(-1)}, }{A: intptr(-1)},
}, },
{
name: "PtrHeadIntPtrStringOmitEmpty",
data: &struct {
A *int `json:"a,string,omitempty"`
}{A: intptr(-1)},
},
// PtrHeadIntPtrNil // PtrHeadIntPtrNil
{ {
@ -224,6 +236,12 @@ func TestCoverInt(t *testing.T) {
A *int `json:"a,string"` A *int `json:"a,string"`
}{A: nil}, }{A: nil},
}, },
{
name: "PtrHeadIntPtrNilStringOmitEmpty",
data: &struct {
A *int `json:"a,string,omitempty"`
}{A: nil},
},
// PtrHeadIntNil // PtrHeadIntNil
{ {
@ -244,6 +262,12 @@ func TestCoverInt(t *testing.T) {
A *int `json:"a,string"` A *int `json:"a,string"`
})(nil), })(nil),
}, },
{
name: "PtrHeadIntNilStringOmitEmpty",
data: (*struct {
A *int `json:"a,string,omitempty"`
})(nil),
},
// HeadIntZeroMultiFields // HeadIntZeroMultiFields
{ {
@ -263,13 +287,21 @@ func TestCoverInt(t *testing.T) {
}{}, }{},
}, },
{ {
name: "HeadIntZeroMultiFields", name: "HeadIntZeroMultiFieldsString",
data: struct { data: struct {
A int `json:"a,string"` A int `json:"a,string"`
B int `json:"b,string"` B int `json:"b,string"`
C int `json:"c,string"` C int `json:"c,string"`
}{}, }{},
}, },
{
name: "HeadIntZeroMultiFieldsStringOmitEmpty",
data: struct {
A int `json:"a,string,omitempty"`
B int `json:"b,string,omitempty"`
C int `json:"c,string,omitempty"`
}{},
},
// HeadIntMultiFields // HeadIntMultiFields
{ {
@ -296,6 +328,14 @@ func TestCoverInt(t *testing.T) {
C int `json:"c,string"` C int `json:"c,string"`
}{A: -1, B: 2, C: 3}, }{A: -1, B: 2, C: 3},
}, },
{
name: "HeadIntMultiFieldsStringOmitEmpty",
data: struct {
A int `json:"a,string,omitempty"`
B int `json:"b,string,omitempty"`
C int `json:"c,string,omitempty"`
}{A: -1, B: 2, C: 3},
},
// HeadIntPtrMultiFields // HeadIntPtrMultiFields
{ {
@ -322,6 +362,14 @@ func TestCoverInt(t *testing.T) {
C *int `json:"c,string"` C *int `json:"c,string"`
}{A: intptr(-1), B: intptr(2), C: intptr(3)}, }{A: intptr(-1), B: intptr(2), C: intptr(3)},
}, },
{
name: "HeadIntPtrMultiFieldsStringOmitEmpty",
data: struct {
A *int `json:"a,string,omitempty"`
B *int `json:"b,string,omitempty"`
C *int `json:"c,string,omitempty"`
}{A: intptr(-1), B: intptr(2), C: intptr(3)},
},
// HeadIntPtrNilMultiFields // HeadIntPtrNilMultiFields
{ {
@ -348,6 +396,14 @@ func TestCoverInt(t *testing.T) {
C *int `json:"c,string"` C *int `json:"c,string"`
}{A: nil, B: nil, C: nil}, }{A: nil, B: nil, C: nil},
}, },
{
name: "HeadIntPtrNilMultiFieldsStringOmitEmpty",
data: struct {
A *int `json:"a,string,omitempty"`
B *int `json:"b,string,omitempty"`
C *int `json:"c,string,omitempty"`
}{A: nil, B: nil, C: nil},
},
// PtrHeadIntZeroMultiFields // PtrHeadIntZeroMultiFields
{ {
@ -371,6 +427,13 @@ func TestCoverInt(t *testing.T) {
B int `json:"b,string"` B int `json:"b,string"`
}{}, }{},
}, },
{
name: "PtrHeadIntZeroMultiFieldsStringOmitEmpty",
data: &struct {
A int `json:"a,string,omitempty"`
B int `json:"b,string,omitempty"`
}{},
},
// PtrHeadIntMultiFields // PtrHeadIntMultiFields
{ {
@ -394,6 +457,13 @@ func TestCoverInt(t *testing.T) {
B int `json:"b,string"` B int `json:"b,string"`
}{A: -1, B: 2}, }{A: -1, B: 2},
}, },
{
name: "PtrHeadIntMultiFieldsStringOmitEmpty",
data: &struct {
A int `json:"a,string,omitempty"`
B int `json:"b,string,omitempty"`
}{A: -1, B: 2},
},
// PtrHeadIntPtrMultiFields // PtrHeadIntPtrMultiFields
{ {
@ -417,6 +487,13 @@ func TestCoverInt(t *testing.T) {
B *int `json:"b,string"` B *int `json:"b,string"`
}{A: intptr(-1), B: intptr(2)}, }{A: intptr(-1), B: intptr(2)},
}, },
{
name: "PtrHeadIntPtrMultiFieldsStringOmitEmpty",
data: &struct {
A *int `json:"a,string,omitempty"`
B *int `json:"b,string,omitempty"`
}{A: intptr(-1), B: intptr(2)},
},
// PtrHeadIntPtrNilMultiFields // PtrHeadIntPtrNilMultiFields
{ {
@ -440,6 +517,13 @@ func TestCoverInt(t *testing.T) {
B *int `json:"b,string"` B *int `json:"b,string"`
}{A: nil, B: nil}, }{A: nil, B: nil},
}, },
{
name: "PtrHeadIntPtrNilMultiFieldsStringOmitEmpty",
data: &struct {
A *int `json:"a,string,omitempty"`
B *int `json:"b,string,omitempty"`
}{A: nil, B: nil},
},
// PtrHeadIntNilMultiFields // PtrHeadIntNilMultiFields
{ {
@ -463,6 +547,13 @@ func TestCoverInt(t *testing.T) {
B *int `json:"b,string"` B *int `json:"b,string"`
})(nil), })(nil),
}, },
{
name: "PtrHeadIntNilMultiFieldsStringOmitEmpty",
data: (*struct {
A *int `json:"a,string,omitempty"`
B *int `json:"b,string,omitempty"`
})(nil),
},
// HeadIntZeroNotRoot // HeadIntZeroNotRoot
{ {
@ -489,6 +580,14 @@ func TestCoverInt(t *testing.T) {
} }
}{}, }{},
}, },
{
name: "HeadIntZeroNotRootStringOmitEmpty",
data: struct {
A struct {
A int `json:"a,string,omitempty"`
}
}{},
},
// HeadIntNotRoot // HeadIntNotRoot
{ {
@ -521,6 +620,16 @@ func TestCoverInt(t *testing.T) {
A int `json:"a,string"` A int `json:"a,string"`
}{A: -1}}, }{A: -1}},
}, },
{
name: "HeadIntNotRootStringOmitEmpty",
data: struct {
A struct {
A int `json:"a,string,omitempty"`
}
}{A: struct {
A int `json:"a,string,omitempty"`
}{A: -1}},
},
// HeadIntPtrNotRoot // HeadIntPtrNotRoot
{ {
@ -553,6 +662,16 @@ func TestCoverInt(t *testing.T) {
A *int `json:"a,string"` A *int `json:"a,string"`
}{intptr(-1)}}, }{intptr(-1)}},
}, },
{
name: "HeadIntPtrNotRootStringOmitEmpty",
data: struct {
A struct {
A *int `json:"a,string,omitempty"`
}
}{A: struct {
A *int `json:"a,string,omitempty"`
}{intptr(-1)}},
},
// HeadIntPtrNilNotRoot // HeadIntPtrNilNotRoot
{ {
@ -579,6 +698,14 @@ func TestCoverInt(t *testing.T) {
} }
}{}, }{},
}, },
{
name: "HeadIntPtrNilNotRootStringOmitEmpty",
data: struct {
A struct {
A *int `json:"a,string,omitempty"`
}
}{},
},
// PtrHeadIntZeroNotRoot // PtrHeadIntZeroNotRoot
{ {
@ -611,6 +738,16 @@ func TestCoverInt(t *testing.T) {
A int `json:"a,string"` A int `json:"a,string"`
})}, })},
}, },
{
name: "PtrHeadIntZeroNotRootStringOmitEmpty",
data: struct {
A *struct {
A int `json:"a,string,omitempty"`
}
}{A: new(struct {
A int `json:"a,string,omitempty"`
})},
},
// PtrHeadIntNotRoot // PtrHeadIntNotRoot
{ {
@ -643,6 +780,16 @@ func TestCoverInt(t *testing.T) {
A int `json:"a,string"` A int `json:"a,string"`
}{A: -1})}, }{A: -1})},
}, },
{
name: "PtrHeadIntNotRootStringOmitEmpty",
data: struct {
A *struct {
A int `json:"a,string,omitempty"`
}
}{A: &(struct {
A int `json:"a,string,omitempty"`
}{A: -1})},
},
// PtrHeadIntPtrNotRoot // PtrHeadIntPtrNotRoot
{ {
@ -675,6 +822,16 @@ func TestCoverInt(t *testing.T) {
A *int `json:"a,string"` A *int `json:"a,string"`
}{A: intptr(-1)})}, }{A: intptr(-1)})},
}, },
{
name: "PtrHeadIntPtrNotRootStringOmitEmpty",
data: struct {
A *struct {
A *int `json:"a,string,omitempty"`
}
}{A: &(struct {
A *int `json:"a,string,omitempty"`
}{A: intptr(-1)})},
},
// PtrHeadIntPtrNilNotRoot // PtrHeadIntPtrNilNotRoot
{ {
@ -707,6 +864,16 @@ func TestCoverInt(t *testing.T) {
A *int `json:"a,string"` A *int `json:"a,string"`
}{A: nil})}, }{A: nil})},
}, },
{
name: "PtrHeadIntPtrNilNotRootStringOmitEmpty",
data: struct {
A *struct {
A *int `json:"a,string,omitempty"`
}
}{A: &(struct {
A *int `json:"a,string,omitempty"`
}{A: nil})},
},
// PtrHeadIntNilNotRoot // PtrHeadIntNilNotRoot
{ {
@ -733,6 +900,14 @@ func TestCoverInt(t *testing.T) {
} `json:",string"` } `json:",string"`
}{A: nil}, }{A: nil},
}, },
{
name: "PtrHeadIntNilNotRootStringOmitEmpty",
data: struct {
A *struct {
A *int `json:"a,string,omitempty"`
} `json:",string,omitempty"`
}{A: nil},
},
// HeadIntZeroMultiFieldsNotRoot // HeadIntZeroMultiFieldsNotRoot
{ {
@ -768,6 +943,17 @@ func TestCoverInt(t *testing.T) {
} }
}{}, }{},
}, },
{
name: "HeadIntZeroMultiFieldsNotRootStringOmitEmpty",
data: struct {
A struct {
A int `json:"a,string,omitempty"`
}
B struct {
B int `json:"b,string,omitempty"`
}
}{},
},
// HeadIntMultiFieldsNotRoot // HeadIntMultiFieldsNotRoot
{ {
@ -815,6 +1001,21 @@ func TestCoverInt(t *testing.T) {
B int `json:"b,string"` B int `json:"b,string"`
}{B: 2}}, }{B: 2}},
}, },
{
name: "HeadIntMultiFieldsNotRootStringOmitEmpty",
data: struct {
A struct {
A int `json:"a,string,omitempty"`
}
B struct {
B int `json:"b,string,omitempty"`
}
}{A: struct {
A int `json:"a,string,omitempty"`
}{A: -1}, B: struct {
B int `json:"b,string,omitempty"`
}{B: 2}},
},
// HeadIntPtrMultiFieldsNotRoot // HeadIntPtrMultiFieldsNotRoot
{ {
@ -862,6 +1063,21 @@ func TestCoverInt(t *testing.T) {
B *int `json:"b,string"` B *int `json:"b,string"`
}{B: intptr(2)}}, }{B: intptr(2)}},
}, },
{
name: "HeadIntPtrMultiFieldsNotRootStringOmitEmpty",
data: struct {
A struct {
A *int `json:"a,string,omitempty"`
}
B struct {
B *int `json:"b,string,omitempty"`
}
}{A: struct {
A *int `json:"a,string,omitempty"`
}{A: intptr(-1)}, B: struct {
B *int `json:"b,string,omitempty"`
}{B: intptr(2)}},
},
// HeadIntPtrNilMultiFieldsNotRoot // HeadIntPtrNilMultiFieldsNotRoot
{ {
@ -909,6 +1125,21 @@ func TestCoverInt(t *testing.T) {
B *int `json:"b,string"` B *int `json:"b,string"`
}{B: nil}}, }{B: nil}},
}, },
{
name: "HeadIntPtrNilMultiFieldsNotRootStringOmitEmpty",
data: struct {
A struct {
A *int `json:"a,string,omitempty"`
}
B struct {
B *int `json:"b,string,omitempty"`
}
}{A: struct {
A *int `json:"a,string,omitempty"`
}{A: nil}, B: struct {
B *int `json:"b,string,omitempty"`
}{B: nil}},
},
// PtrHeadIntZeroMultiFieldsNotRoot // PtrHeadIntZeroMultiFieldsNotRoot
{ {
@ -944,6 +1175,17 @@ func TestCoverInt(t *testing.T) {
} }
}{}, }{},
}, },
{
name: "PtrHeadIntZeroMultiFieldsNotRootStringOmitEmpty",
data: &struct {
A struct {
A int `json:"a,string,omitempty"`
}
B struct {
B int `json:"b,string,omitempty"`
}
}{},
},
// PtrHeadIntMultiFieldsNotRoot // PtrHeadIntMultiFieldsNotRoot
{ {
@ -991,6 +1233,21 @@ func TestCoverInt(t *testing.T) {
B int `json:"b,string"` B int `json:"b,string"`
}{B: 2}}, }{B: 2}},
}, },
{
name: "PtrHeadIntMultiFieldsNotRootStringOmitEmpty",
data: &struct {
A struct {
A int `json:"a,string,omitempty"`
}
B struct {
B int `json:"b,string,omitempty"`
}
}{A: struct {
A int `json:"a,string,omitempty"`
}{A: -1}, B: struct {
B int `json:"b,string,omitempty"`
}{B: 2}},
},
// PtrHeadIntPtrMultiFieldsNotRoot // PtrHeadIntPtrMultiFieldsNotRoot
{ {
@ -1038,6 +1295,21 @@ func TestCoverInt(t *testing.T) {
B *int `json:"b,string"` B *int `json:"b,string"`
}{B: intptr(2)})}, }{B: intptr(2)})},
}, },
{
name: "PtrHeadIntPtrMultiFieldsNotRootStringOmitEmpty",
data: &struct {
A *struct {
A *int `json:"a,string,omitempty"`
}
B *struct {
B *int `json:"b,string,omitempty"`
}
}{A: &(struct {
A *int `json:"a,string,omitempty"`
}{A: intptr(-1)}), B: &(struct {
B *int `json:"b,string,omitempty"`
}{B: intptr(2)})},
},
// PtrHeadIntPtrNilMultiFieldsNotRoot // PtrHeadIntPtrNilMultiFieldsNotRoot
{ {
@ -1073,6 +1345,17 @@ func TestCoverInt(t *testing.T) {
} `json:",string"` } `json:",string"`
}{A: nil, B: nil}, }{A: nil, B: nil},
}, },
{
name: "PtrHeadIntPtrNilMultiFieldsNotRootStringOmitEmpty",
data: &struct {
A *struct {
A *int `json:"a,string,omitempty"`
} `json:",string,omitempty"`
B *struct {
B *int `json:"b,string,omitempty"`
} `json:",string,omitempty"`
}{A: nil, B: nil},
},
// PtrHeadIntNilMultiFieldsNotRoot // PtrHeadIntNilMultiFieldsNotRoot
{ {
@ -1108,6 +1391,17 @@ func TestCoverInt(t *testing.T) {
} }
})(nil), })(nil),
}, },
{
name: "PtrHeadIntNilMultiFieldsNotRootStringOmitEmpty",
data: (*struct {
A *struct {
A *int `json:"a,string,omitempty"`
}
B *struct {
B *int `json:"b,string,omitempty"`
}
})(nil),
},
// PtrHeadIntDoubleMultiFieldsNotRoot // PtrHeadIntDoubleMultiFieldsNotRoot
{ {
@ -1167,6 +1461,25 @@ func TestCoverInt(t *testing.T) {
B int `json:"b,string"` B int `json:"b,string"`
}{A: 3, B: 4})}, }{A: 3, B: 4})},
}, },
{
name: "PtrHeadIntDoubleMultiFieldsNotRootStringOmitEmpty",
data: &struct {
A *struct {
A int `json:"a,string,omitempty"`
B int `json:"b,string,omitempty"`
}
B *struct {
A int `json:"a,string,omitempty"`
B int `json:"b,string,omitempty"`
}
}{A: &(struct {
A int `json:"a,string,omitempty"`
B int `json:"b,string,omitempty"`
}{A: -1, B: 2}), B: &(struct {
A int `json:"a,string,omitempty"`
B int `json:"b,string,omitempty"`
}{A: 3, B: 4})},
},
// PtrHeadIntNilDoubleMultiFieldsNotRoot // PtrHeadIntNilDoubleMultiFieldsNotRoot
{ {
@ -1208,6 +1521,19 @@ func TestCoverInt(t *testing.T) {
} }
}{A: nil, B: nil}, }{A: nil, B: nil},
}, },
{
name: "PtrHeadIntNilDoubleMultiFieldsNotRootStringOmitEmpty",
data: &struct {
A *struct {
A int `json:"a,string,omitempty"`
B int `json:"b,string,omitempty"`
}
B *struct {
A int `json:"a,string,omitempty"`
B int `json:"b,string,omitempty"`
}
}{A: nil, B: nil},
},
// PtrHeadIntNilDoubleMultiFieldsNotRoot // PtrHeadIntNilDoubleMultiFieldsNotRoot
{ {
@ -1249,6 +1575,19 @@ func TestCoverInt(t *testing.T) {
} }
})(nil), })(nil),
}, },
{
name: "PtrHeadIntNilDoubleMultiFieldsNotRootStringOmitEmpty",
data: (*struct {
A *struct {
A int `json:"a,string,omitempty"`
B int `json:"b,string,omitempty"`
}
B *struct {
A int `json:"a,string,omitempty"`
B int `json:"b,string,omitempty"`
}
})(nil),
},
// PtrHeadIntPtrDoubleMultiFieldsNotRoot // PtrHeadIntPtrDoubleMultiFieldsNotRoot
{ {
@ -1308,6 +1647,25 @@ func TestCoverInt(t *testing.T) {
B *int `json:"b,string"` B *int `json:"b,string"`
}{A: intptr(3), B: intptr(4)})}, }{A: intptr(3), B: intptr(4)})},
}, },
{
name: "PtrHeadIntPtrDoubleMultiFieldsNotRootStringOmitEmpty",
data: &struct {
A *struct {
A *int `json:"a,string,omitempty"`
B *int `json:"b,string,omitempty"`
}
B *struct {
A *int `json:"a,string,omitempty"`
B *int `json:"b,string,omitempty"`
}
}{A: &(struct {
A *int `json:"a,string,omitempty"`
B *int `json:"b,string,omitempty"`
}{A: intptr(-1), B: intptr(2)}), B: &(struct {
A *int `json:"a,string,omitempty"`
B *int `json:"b,string,omitempty"`
}{A: intptr(3), B: intptr(4)})},
},
// PtrHeadIntPtrNilDoubleMultiFieldsNotRoot // PtrHeadIntPtrNilDoubleMultiFieldsNotRoot
{ {
@ -1349,6 +1707,19 @@ func TestCoverInt(t *testing.T) {
} }
}{A: nil, B: nil}, }{A: nil, B: nil},
}, },
{
name: "PtrHeadIntPtrNilDoubleMultiFieldsNotRootStringOmitEmpty",
data: &struct {
A *struct {
A *int `json:"a,string,omitempty"`
B *int `json:"b,string,omitempty"`
}
B *struct {
A *int `json:"a,string,omitempty"`
B *int `json:"b,string,omitempty"`
}
}{A: nil, B: nil},
},
// PtrHeadIntPtrNilDoubleMultiFieldsNotRoot // PtrHeadIntPtrNilDoubleMultiFieldsNotRoot
{ {
@ -1390,6 +1761,19 @@ func TestCoverInt(t *testing.T) {
} }
})(nil), })(nil),
}, },
{
name: "PtrHeadIntPtrNilDoubleMultiFieldsNotRootStringOmitEmpty",
data: (*struct {
A *struct {
A *int `json:"a,string,omitempty"`
B *int `json:"b,string,omitempty"`
}
B *struct {
A *int `json:"a,string,omitempty"`
B *int `json:"b,string,omitempty"`
}
})(nil),
},
// AnonymousHeadInt // AnonymousHeadInt
{ {
@ -1422,6 +1806,16 @@ func TestCoverInt(t *testing.T) {
B: 2, B: 2,
}, },
}, },
{
name: "AnonymousHeadIntStringOmitEmpty",
data: struct {
structIntStringOmitEmpty
B int `json:"b,string,omitempty"`
}{
structIntStringOmitEmpty: structIntStringOmitEmpty{A: -1},
B: 2,
},
},
// PtrAnonymousHeadInt // PtrAnonymousHeadInt
{ {
@ -1454,6 +1848,16 @@ func TestCoverInt(t *testing.T) {
B: 2, B: 2,
}, },
}, },
{
name: "PtrAnonymousHeadIntStringOmitEmpty",
data: struct {
*structIntStringOmitEmpty
B int `json:"b,string,omitempty"`
}{
structIntStringOmitEmpty: &structIntStringOmitEmpty{A: -1},
B: 2,
},
},
// NilPtrAnonymousHeadInt // NilPtrAnonymousHeadInt
{ {
@ -1486,6 +1890,16 @@ func TestCoverInt(t *testing.T) {
B: 2, B: 2,
}, },
}, },
{
name: "NilPtrAnonymousHeadIntStringOmitEmpty",
data: struct {
*structIntStringOmitEmpty
B int `json:"b,string,omitempty"`
}{
structIntStringOmitEmpty: nil,
B: 2,
},
},
// AnonymousHeadIntPtr // AnonymousHeadIntPtr
{ {
@ -1518,6 +1932,16 @@ func TestCoverInt(t *testing.T) {
B: intptr(2), B: intptr(2),
}, },
}, },
{
name: "AnonymousHeadIntPtrStringOmitEmpty",
data: struct {
structIntPtrStringOmitEmpty
B *int `json:"b,string,omitempty"`
}{
structIntPtrStringOmitEmpty: structIntPtrStringOmitEmpty{A: intptr(-1)},
B: intptr(2),
},
},
// AnonymousHeadIntPtrNil // AnonymousHeadIntPtrNil
{ {
@ -1550,6 +1974,16 @@ func TestCoverInt(t *testing.T) {
B: intptr(2), B: intptr(2),
}, },
}, },
{
name: "AnonymousHeadIntPtrNilStringOmitEmpty",
data: struct {
structIntPtrStringOmitEmpty
B *int `json:"b,string,omitempty"`
}{
structIntPtrStringOmitEmpty: structIntPtrStringOmitEmpty{A: nil},
B: intptr(2),
},
},
// PtrAnonymousHeadIntPtr // PtrAnonymousHeadIntPtr
{ {
@ -1582,6 +2016,16 @@ func TestCoverInt(t *testing.T) {
B: intptr(2), B: intptr(2),
}, },
}, },
{
name: "PtrAnonymousHeadIntPtrStringOmitEmpty",
data: struct {
*structIntPtrStringOmitEmpty
B *int `json:"b,string,omitempty"`
}{
structIntPtrStringOmitEmpty: &structIntPtrStringOmitEmpty{A: intptr(-1)},
B: intptr(2),
},
},
// NilPtrAnonymousHeadIntPtr // NilPtrAnonymousHeadIntPtr
{ {
@ -1614,6 +2058,16 @@ func TestCoverInt(t *testing.T) {
B: intptr(2), B: intptr(2),
}, },
}, },
{
name: "NilPtrAnonymousHeadIntPtrStringOmitEmpty",
data: struct {
*structIntPtrStringOmitEmpty
B *int `json:"b,string,omitempty"`
}{
structIntPtrStringOmitEmpty: nil,
B: intptr(2),
},
},
// AnonymousHeadIntOnly // AnonymousHeadIntOnly
{ {
@ -1640,6 +2094,14 @@ func TestCoverInt(t *testing.T) {
structIntString: structIntString{A: -1}, structIntString: structIntString{A: -1},
}, },
}, },
{
name: "AnonymousHeadIntOnlyStringOmitEmpty",
data: struct {
structIntStringOmitEmpty
}{
structIntStringOmitEmpty: structIntStringOmitEmpty{A: -1},
},
},
// PtrAnonymousHeadIntOnly // PtrAnonymousHeadIntOnly
{ {
@ -1666,6 +2128,14 @@ func TestCoverInt(t *testing.T) {
structIntString: &structIntString{A: -1}, structIntString: &structIntString{A: -1},
}, },
}, },
{
name: "PtrAnonymousHeadIntOnlyStringOmitEmpty",
data: struct {
*structIntStringOmitEmpty
}{
structIntStringOmitEmpty: &structIntStringOmitEmpty{A: -1},
},
},
// NilPtrAnonymousHeadIntOnly // NilPtrAnonymousHeadIntOnly
{ {
@ -1692,6 +2162,14 @@ func TestCoverInt(t *testing.T) {
structIntString: nil, structIntString: nil,
}, },
}, },
{
name: "NilPtrAnonymousHeadIntOnlyStringOmitEmpty",
data: struct {
*structIntStringOmitEmpty
}{
structIntStringOmitEmpty: nil,
},
},
// AnonymousHeadIntPtrOnly // AnonymousHeadIntPtrOnly
{ {
@ -1718,6 +2196,14 @@ func TestCoverInt(t *testing.T) {
structIntPtrString: structIntPtrString{A: intptr(-1)}, structIntPtrString: structIntPtrString{A: intptr(-1)},
}, },
}, },
{
name: "AnonymousHeadIntPtrOnlyStringOmitEmpty",
data: struct {
structIntPtrStringOmitEmpty
}{
structIntPtrStringOmitEmpty: structIntPtrStringOmitEmpty{A: intptr(-1)},
},
},
// AnonymousHeadIntPtrNilOnly // AnonymousHeadIntPtrNilOnly
{ {
@ -1744,6 +2230,14 @@ func TestCoverInt(t *testing.T) {
structIntPtrString: structIntPtrString{A: nil}, structIntPtrString: structIntPtrString{A: nil},
}, },
}, },
{
name: "AnonymousHeadIntPtrNilOnlyStringOmitEmpty",
data: struct {
structIntPtrStringOmitEmpty
}{
structIntPtrStringOmitEmpty: structIntPtrStringOmitEmpty{A: nil},
},
},
// PtrAnonymousHeadIntPtrOnly // PtrAnonymousHeadIntPtrOnly
{ {
@ -1770,6 +2264,14 @@ func TestCoverInt(t *testing.T) {
structIntPtrString: &structIntPtrString{A: intptr(-1)}, structIntPtrString: &structIntPtrString{A: intptr(-1)},
}, },
}, },
{
name: "PtrAnonymousHeadIntPtrOnlyStringOmitEmpty",
data: struct {
*structIntPtrStringOmitEmpty
}{
structIntPtrStringOmitEmpty: &structIntPtrStringOmitEmpty{A: intptr(-1)},
},
},
// NilPtrAnonymousHeadIntPtrOnly // NilPtrAnonymousHeadIntPtrOnly
{ {
@ -1796,6 +2298,14 @@ func TestCoverInt(t *testing.T) {
structIntPtrString: nil, structIntPtrString: nil,
}, },
}, },
{
name: "NilPtrAnonymousHeadIntPtrOnlyStringOmitEmpty",
data: struct {
*structIntPtrStringOmitEmpty
}{
structIntPtrStringOmitEmpty: nil,
},
},
} }
for _, test := range tests { for _, test := range tests {
for _, indent := range []bool{true, false} { for _, indent := range []bool{true, false} {