diff --git a/cover_uint8_test.go b/cover_uint8_test.go index f463452..96c2a5f 100644 --- a/cover_uint8_test.go +++ b/cover_uint8_test.go @@ -2,7 +2,6 @@ package json_test import ( "bytes" - "strings" "testing" "github.com/goccy/go-json" @@ -30,42 +29,24 @@ func TestCoverUint8(t *testing.T) { } tests := []struct { - name string - expected string - indentExpected string - data interface{} + name string + data interface{} }{ // HeadUint8Zero { - name: "HeadUint8Zero", - expected: `{"a":0}`, - indentExpected: ` -{ - "a": 0 -} -`, + name: "HeadUint8Zero", data: struct { A uint8 `json:"a"` }{}, }, { - name: "HeadUint8ZeroOmitEmpty", - expected: `{}`, - indentExpected: ` -{} -`, + name: "HeadUint8ZeroOmitEmpty", data: struct { A uint8 `json:"a,omitempty"` }{}, }, { - name: "HeadUint8ZeroString", - expected: `{"a":"0"}`, - indentExpected: ` -{ - "a": "0" -} -`, + name: "HeadUint8ZeroString", data: struct { A uint8 `json:"a,string"` }{}, @@ -73,37 +54,19 @@ func TestCoverUint8(t *testing.T) { // HeadUint8 { - name: "HeadUint8", - expected: `{"a":1}`, - indentExpected: ` -{ - "a": 1 -} -`, + name: "HeadUint8", data: struct { A uint8 `json:"a"` }{A: 1}, }, { - name: "HeadUint8OmitEmpty", - expected: `{"a":1}`, - indentExpected: ` -{ - "a": 1 -} -`, + name: "HeadUint8OmitEmpty", data: struct { A uint8 `json:"a,omitempty"` }{A: 1}, }, { - name: "HeadUint8String", - expected: `{"a":"1"}`, - indentExpected: ` -{ - "a": "1" -} -`, + name: "HeadUint8String", data: struct { A uint8 `json:"a,string"` }{A: 1}, @@ -111,37 +74,19 @@ func TestCoverUint8(t *testing.T) { // HeadUint8Ptr { - name: "HeadUint8Ptr", - expected: `{"a":1}`, - indentExpected: ` -{ - "a": 1 -} -`, + name: "HeadUint8Ptr", data: struct { A *uint8 `json:"a"` }{A: uint8ptr(1)}, }, { - name: "HeadUint8PtrOmitEmpty", - expected: `{"a":1}`, - indentExpected: ` -{ - "a": 1 -} -`, + name: "HeadUint8PtrOmitEmpty", data: struct { A *uint8 `json:"a,omitempty"` }{A: uint8ptr(1)}, }, { - name: "HeadUint8PtrString", - expected: `{"a":"1"}`, - indentExpected: ` -{ - "a": "1" -} -`, + name: "HeadUint8PtrString", data: struct { A *uint8 `json:"a,string"` }{A: uint8ptr(1)}, @@ -149,35 +94,19 @@ func TestCoverUint8(t *testing.T) { // HeadUint8PtrNil { - name: "HeadUint8PtrNil", - expected: `{"a":null}`, - indentExpected: ` -{ - "a": null -} -`, + name: "HeadUint8PtrNil", data: struct { A *uint8 `json:"a"` }{A: nil}, }, { - name: "HeadUint8PtrNilOmitEmpty", - expected: `{}`, - indentExpected: ` -{} -`, + name: "HeadUint8PtrNilOmitEmpty", data: struct { A *uint8 `json:"a,omitempty"` }{A: nil}, }, { - name: "HeadUint8PtrNilString", - expected: `{"a":null}`, - indentExpected: ` -{ - "a": null -} -`, + name: "HeadUint8PtrNilString", data: struct { A *uint8 `json:"a,string"` }{A: nil}, @@ -185,35 +114,19 @@ func TestCoverUint8(t *testing.T) { // PtrHeadUint8Zero { - name: "PtrHeadUint8Zero", - expected: `{"a":0}`, - indentExpected: ` -{ - "a": 0 -} -`, + name: "PtrHeadUint8Zero", data: &struct { A uint8 `json:"a"` }{}, }, { - name: "PtrHeadUint8ZeroOmitEmpty", - expected: `{}`, - indentExpected: ` -{} -`, + name: "PtrHeadUint8ZeroOmitEmpty", data: &struct { A uint8 `json:"a,omitempty"` }{}, }, { - name: "PtrHeadUint8ZeroString", - expected: `{"a":"0"}`, - indentExpected: ` -{ - "a": "0" -} -`, + name: "PtrHeadUint8ZeroString", data: &struct { A uint8 `json:"a,string"` }{}, @@ -221,37 +134,19 @@ func TestCoverUint8(t *testing.T) { // PtrHeadUint8 { - name: "PtrHeadUint8", - expected: `{"a":1}`, - indentExpected: ` -{ - "a": 1 -} -`, + name: "PtrHeadUint8", data: &struct { A uint8 `json:"a"` }{A: 1}, }, { - name: "PtrHeadUint8OmitEmpty", - expected: `{"a":1}`, - indentExpected: ` -{ - "a": 1 -} -`, + name: "PtrHeadUint8OmitEmpty", data: &struct { A uint8 `json:"a,omitempty"` }{A: 1}, }, { - name: "PtrHeadUint8String", - expected: `{"a":"1"}`, - indentExpected: ` -{ - "a": "1" -} -`, + name: "PtrHeadUint8String", data: &struct { A uint8 `json:"a,string"` }{A: 1}, @@ -259,37 +154,19 @@ func TestCoverUint8(t *testing.T) { // PtrHeadUint8Ptr { - name: "PtrHeadUint8Ptr", - expected: `{"a":1}`, - indentExpected: ` -{ - "a": 1 -} -`, + name: "PtrHeadUint8Ptr", data: &struct { A *uint8 `json:"a"` }{A: uint8ptr(1)}, }, { - name: "PtrHeadUint8PtrOmitEmpty", - expected: `{"a":1}`, - indentExpected: ` -{ - "a": 1 -} -`, + name: "PtrHeadUint8PtrOmitEmpty", data: &struct { A *uint8 `json:"a,omitempty"` }{A: uint8ptr(1)}, }, { - name: "PtrHeadUint8PtrString", - expected: `{"a":"1"}`, - indentExpected: ` -{ - "a": "1" -} -`, + name: "PtrHeadUint8PtrString", data: &struct { A *uint8 `json:"a,string"` }{A: uint8ptr(1)}, @@ -297,35 +174,19 @@ func TestCoverUint8(t *testing.T) { // PtrHeadUint8PtrNil { - name: "PtrHeadUint8PtrNil", - expected: `{"a":null}`, - indentExpected: ` -{ - "a": null -} -`, + name: "PtrHeadUint8PtrNil", data: &struct { A *uint8 `json:"a"` }{A: nil}, }, { - name: "PtrHeadUint8PtrNilOmitEmpty", - expected: `{}`, - indentExpected: ` -{} -`, + name: "PtrHeadUint8PtrNilOmitEmpty", data: &struct { A *uint8 `json:"a,omitempty"` }{A: nil}, }, { - name: "PtrHeadUint8PtrNilString", - expected: `{"a":null}`, - indentExpected: ` -{ - "a": null -} -`, + name: "PtrHeadUint8PtrNilString", data: &struct { A *uint8 `json:"a,string"` }{A: nil}, @@ -333,31 +194,19 @@ func TestCoverUint8(t *testing.T) { // PtrHeadUint8Nil { - name: "PtrHeadUint8Nil", - expected: `null`, - indentExpected: ` -null -`, + name: "PtrHeadUint8Nil", data: (*struct { A *uint8 `json:"a"` })(nil), }, { - name: "PtrHeadUint8NilOmitEmpty", - expected: `null`, - indentExpected: ` -null -`, + name: "PtrHeadUint8NilOmitEmpty", data: (*struct { A *uint8 `json:"a,omitempty"` })(nil), }, { - name: "PtrHeadUint8NilString", - expected: `null`, - indentExpected: ` -null -`, + name: "PtrHeadUint8NilString", data: (*struct { A *uint8 `json:"a,string"` })(nil), @@ -365,209 +214,125 @@ null // HeadUint8ZeroMultiFields { - name: "HeadUint8ZeroMultiFields", - expected: `{"a":0,"b":0}`, - indentExpected: ` -{ - "a": 0, - "b": 0 -} -`, + name: "HeadUint8ZeroMultiFields", data: struct { A uint8 `json:"a"` B uint8 `json:"b"` + C uint8 `json:"c"` }{}, }, { - name: "HeadUint8ZeroMultiFieldsOmitEmpty", - expected: `{}`, - indentExpected: ` -{} -`, + name: "HeadUint8ZeroMultiFieldsOmitEmpty", data: struct { A uint8 `json:"a,omitempty"` B uint8 `json:"b,omitempty"` + C uint8 `json:"c,omitempty"` }{}, }, { - name: "HeadUint8ZeroMultiFields", - expected: `{"a":"0","b":"0"}`, - indentExpected: ` -{ - "a": "0", - "b": "0" -} -`, + name: "HeadUint8ZeroMultiFields", data: struct { A uint8 `json:"a,string"` B uint8 `json:"b,string"` + C uint8 `json:"c,string"` }{}, }, // HeadUint8MultiFields { - name: "HeadUint8MultiFields", - expected: `{"a":1,"b":2}`, - indentExpected: ` -{ - "a": 1, - "b": 2 -} -`, + name: "HeadUint8MultiFields", data: struct { A uint8 `json:"a"` B uint8 `json:"b"` - }{A: 1, B: 2}, + C uint8 `json:"c"` + }{A: 1, B: 2, C: 3}, }, { - name: "HeadUint8MultiFieldsOmitEmpty", - expected: `{"a":1,"b":2}`, - indentExpected: ` -{ - "a": 1, - "b": 2 -} -`, + name: "HeadUint8MultiFieldsOmitEmpty", data: struct { A uint8 `json:"a,omitempty"` B uint8 `json:"b,omitempty"` - }{A: 1, B: 2}, + C uint8 `json:"c,omitempty"` + }{A: 1, B: 2, C: 3}, }, { - name: "HeadUint8MultiFieldsString", - expected: `{"a":"1","b":"2"}`, - indentExpected: ` -{ - "a": "1", - "b": "2" -} -`, + name: "HeadUint8MultiFieldsString", data: struct { A uint8 `json:"a,string"` B uint8 `json:"b,string"` - }{A: 1, B: 2}, + C uint8 `json:"c,string"` + }{A: 1, B: 2, C: 3}, }, // HeadUint8PtrMultiFields { - name: "HeadUint8PtrMultiFields", - expected: `{"a":1,"b":2}`, - indentExpected: ` -{ - "a": 1, - "b": 2 -} -`, + name: "HeadUint8PtrMultiFields", data: struct { A *uint8 `json:"a"` B *uint8 `json:"b"` - }{A: uint8ptr(1), B: uint8ptr(2)}, + C *uint8 `json:"c"` + }{A: uint8ptr(1), B: uint8ptr(2), C: uint8ptr(3)}, }, { - name: "HeadUint8PtrMultiFieldsOmitEmpty", - expected: `{"a":1,"b":2}`, - indentExpected: ` -{ - "a": 1, - "b": 2 -} -`, + name: "HeadUint8PtrMultiFieldsOmitEmpty", data: struct { A *uint8 `json:"a,omitempty"` B *uint8 `json:"b,omitempty"` - }{A: uint8ptr(1), B: uint8ptr(2)}, + C *uint8 `json:"c,omitempty"` + }{A: uint8ptr(1), B: uint8ptr(2), C: uint8ptr(3)}, }, { - name: "HeadUint8PtrMultiFieldsString", - expected: `{"a":"1","b":"2"}`, - indentExpected: ` -{ - "a": "1", - "b": "2" -} -`, + name: "HeadUint8PtrMultiFieldsString", data: struct { A *uint8 `json:"a,string"` B *uint8 `json:"b,string"` - }{A: uint8ptr(1), B: uint8ptr(2)}, + C *uint8 `json:"c,string"` + }{A: uint8ptr(1), B: uint8ptr(2), C: uint8ptr(3)}, }, // HeadUint8PtrNilMultiFields { - name: "HeadUint8PtrNilMultiFields", - expected: `{"a":null,"b":null}`, - indentExpected: ` -{ - "a": null, - "b": null -} -`, + name: "HeadUint8PtrNilMultiFields", data: struct { A *uint8 `json:"a"` B *uint8 `json:"b"` - }{A: nil, B: nil}, + C *uint8 `json:"c"` + }{A: nil, B: nil, C: nil}, }, { - name: "HeadUint8PtrNilMultiFieldsOmitEmpty", - expected: `{}`, - indentExpected: ` -{} -`, + name: "HeadUint8PtrNilMultiFieldsOmitEmpty", data: struct { A *uint8 `json:"a,omitempty"` B *uint8 `json:"b,omitempty"` - }{A: nil, B: nil}, + C *uint8 `json:"c,omitempty"` + }{A: nil, B: nil, C: nil}, }, { - name: "HeadUint8PtrNilMultiFieldsString", - expected: `{"a":null,"b":null}`, - indentExpected: ` -{ - "a": null, - "b": null -} -`, + name: "HeadUint8PtrNilMultiFieldsString", data: struct { A *uint8 `json:"a,string"` B *uint8 `json:"b,string"` - }{A: nil, B: nil}, + C *uint8 `json:"c,string"` + }{A: nil, B: nil, C: nil}, }, // PtrHeadUint8ZeroMultiFields { - name: "PtrHeadUint8ZeroMultiFields", - expected: `{"a":0,"b":0}`, - indentExpected: ` -{ - "a": 0, - "b": 0 -} -`, + name: "PtrHeadUint8ZeroMultiFields", data: &struct { A uint8 `json:"a"` B uint8 `json:"b"` }{}, }, { - name: "PtrHeadUint8ZeroMultiFieldsOmitEmpty", - expected: `{}`, - indentExpected: ` -{} -`, + name: "PtrHeadUint8ZeroMultiFieldsOmitEmpty", data: &struct { A uint8 `json:"a,omitempty"` B uint8 `json:"b,omitempty"` }{}, }, { - name: "PtrHeadUint8ZeroMultiFieldsString", - expected: `{"a":"0","b":"0"}`, - indentExpected: ` -{ - "a": "0", - "b": "0" -} -`, + name: "PtrHeadUint8ZeroMultiFieldsString", data: &struct { A uint8 `json:"a,string"` B uint8 `json:"b,string"` @@ -576,42 +341,21 @@ null // PtrHeadUint8MultiFields { - name: "PtrHeadUint8MultiFields", - expected: `{"a":1,"b":2}`, - indentExpected: ` -{ - "a": 1, - "b": 2 -} -`, + name: "PtrHeadUint8MultiFields", data: &struct { A uint8 `json:"a"` B uint8 `json:"b"` }{A: 1, B: 2}, }, { - name: "PtrHeadUint8MultiFieldsOmitEmpty", - expected: `{"a":1,"b":2}`, - indentExpected: ` -{ - "a": 1, - "b": 2 -} -`, + name: "PtrHeadUint8MultiFieldsOmitEmpty", data: &struct { A uint8 `json:"a,omitempty"` B uint8 `json:"b,omitempty"` }{A: 1, B: 2}, }, { - name: "PtrHeadUint8MultiFieldsString", - expected: `{"a":"1","b":"2"}`, - indentExpected: ` -{ - "a": "1", - "b": "2" -} -`, + name: "PtrHeadUint8MultiFieldsString", data: &struct { A uint8 `json:"a,string"` B uint8 `json:"b,string"` @@ -620,42 +364,21 @@ null // PtrHeadUint8PtrMultiFields { - name: "PtrHeadUint8PtrMultiFields", - expected: `{"a":1,"b":2}`, - indentExpected: ` -{ - "a": 1, - "b": 2 -} -`, + name: "PtrHeadUint8PtrMultiFields", data: &struct { A *uint8 `json:"a"` B *uint8 `json:"b"` }{A: uint8ptr(1), B: uint8ptr(2)}, }, { - name: "PtrHeadUint8PtrMultiFieldsOmitEmpty", - expected: `{"a":1,"b":2}`, - indentExpected: ` -{ - "a": 1, - "b": 2 -} -`, + name: "PtrHeadUint8PtrMultiFieldsOmitEmpty", data: &struct { A *uint8 `json:"a,omitempty"` B *uint8 `json:"b,omitempty"` }{A: uint8ptr(1), B: uint8ptr(2)}, }, { - name: "PtrHeadUint8PtrMultiFieldsString", - expected: `{"a":"1","b":"2"}`, - indentExpected: ` -{ - "a": "1", - "b": "2" -} -`, + name: "PtrHeadUint8PtrMultiFieldsString", data: &struct { A *uint8 `json:"a,string"` B *uint8 `json:"b,string"` @@ -664,39 +387,21 @@ null // PtrHeadUint8PtrNilMultiFields { - name: "PtrHeadUint8PtrNilMultiFields", - expected: `{"a":null,"b":null}`, - indentExpected: ` -{ - "a": null, - "b": null -} -`, + name: "PtrHeadUint8PtrNilMultiFields", data: &struct { A *uint8 `json:"a"` B *uint8 `json:"b"` }{A: nil, B: nil}, }, { - name: "PtrHeadUint8PtrNilMultiFieldsOmitEmpty", - expected: `{}`, - indentExpected: ` -{} -`, + name: "PtrHeadUint8PtrNilMultiFieldsOmitEmpty", data: &struct { A *uint8 `json:"a,omitempty"` B *uint8 `json:"b,omitempty"` }{A: nil, B: nil}, }, { - name: "PtrHeadUint8PtrNilMultiFieldsString", - expected: `{"a":null,"b":null}`, - indentExpected: ` -{ - "a": null, - "b": null -} -`, + name: "PtrHeadUint8PtrNilMultiFieldsString", data: &struct { A *uint8 `json:"a,string"` B *uint8 `json:"b,string"` @@ -705,33 +410,21 @@ null // PtrHeadUint8NilMultiFields { - name: "PtrHeadUint8NilMultiFields", - expected: `null`, - indentExpected: ` -null -`, + name: "PtrHeadUint8NilMultiFields", data: (*struct { A *uint8 `json:"a"` B *uint8 `json:"b"` })(nil), }, { - name: "PtrHeadUint8NilMultiFieldsOmitEmpty", - expected: `null`, - indentExpected: ` -null -`, + name: "PtrHeadUint8NilMultiFieldsOmitEmpty", data: (*struct { A *uint8 `json:"a,omitempty"` B *uint8 `json:"b,omitempty"` })(nil), }, { - name: "PtrHeadUint8NilMultiFieldsString", - expected: `null`, - indentExpected: ` -null -`, + name: "PtrHeadUint8NilMultiFieldsString", data: (*struct { A *uint8 `json:"a,string"` B *uint8 `json:"b,string"` @@ -740,15 +433,7 @@ null // HeadUint8ZeroNotRoot { - name: "HeadUint8ZeroNotRoot", - expected: `{"A":{"a":0}}`, - indentExpected: ` -{ - "A": { - "a": 0 - } -} -`, + name: "HeadUint8ZeroNotRoot", data: struct { A struct { A uint8 `json:"a"` @@ -756,13 +441,7 @@ null }{}, }, { - name: "HeadUint8ZeroNotRootOmitEmpty", - expected: `{"A":{}}`, - indentExpected: ` -{ - "A": {} -} -`, + name: "HeadUint8ZeroNotRootOmitEmpty", data: struct { A struct { A uint8 `json:"a,omitempty"` @@ -770,15 +449,7 @@ null }{}, }, { - name: "HeadUint8ZeroNotRootString", - expected: `{"A":{"a":"0"}}`, - indentExpected: ` -{ - "A": { - "a": "0" - } -} -`, + name: "HeadUint8ZeroNotRootString", data: struct { A struct { A uint8 `json:"a,string"` @@ -788,15 +459,7 @@ null // HeadUint8NotRoot { - name: "HeadUint8NotRoot", - expected: `{"A":{"a":1}}`, - indentExpected: ` -{ - "A": { - "a": 1 - } -} -`, + name: "HeadUint8NotRoot", data: struct { A struct { A uint8 `json:"a"` @@ -806,15 +469,7 @@ null }{A: 1}}, }, { - name: "HeadUint8NotRootOmitEmpty", - expected: `{"A":{"a":1}}`, - indentExpected: ` -{ - "A": { - "a": 1 - } -} -`, + name: "HeadUint8NotRootOmitEmpty", data: struct { A struct { A uint8 `json:"a,omitempty"` @@ -824,15 +479,7 @@ null }{A: 1}}, }, { - name: "HeadUint8NotRootString", - expected: `{"A":{"a":"1"}}`, - indentExpected: ` -{ - "A": { - "a": "1" - } -} -`, + name: "HeadUint8NotRootString", data: struct { A struct { A uint8 `json:"a,string"` @@ -844,15 +491,7 @@ null // HeadUint8PtrNotRoot { - name: "HeadUint8PtrNotRoot", - expected: `{"A":{"a":1}}`, - indentExpected: ` -{ - "A": { - "a": 1 - } -} -`, + name: "HeadUint8PtrNotRoot", data: struct { A struct { A *uint8 `json:"a"` @@ -862,15 +501,7 @@ null }{uint8ptr(1)}}, }, { - name: "HeadUint8PtrNotRootOmitEmpty", - expected: `{"A":{"a":1}}`, - indentExpected: ` -{ - "A": { - "a": 1 - } -} -`, + name: "HeadUint8PtrNotRootOmitEmpty", data: struct { A struct { A *uint8 `json:"a,omitempty"` @@ -880,15 +511,7 @@ null }{uint8ptr(1)}}, }, { - name: "HeadUint8PtrNotRootString", - expected: `{"A":{"a":"1"}}`, - indentExpected: ` -{ - "A": { - "a": "1" - } -} -`, + name: "HeadUint8PtrNotRootString", data: struct { A struct { A *uint8 `json:"a,string"` @@ -900,15 +523,7 @@ null // HeadUint8PtrNilNotRoot { - name: "HeadUint8PtrNilNotRoot", - expected: `{"A":{"a":null}}`, - indentExpected: ` -{ - "A": { - "a": null - } -} -`, + name: "HeadUint8PtrNilNotRoot", data: struct { A struct { A *uint8 `json:"a"` @@ -916,13 +531,7 @@ null }{}, }, { - name: "HeadUint8PtrNilNotRootOmitEmpty", - expected: `{"A":{}}`, - indentExpected: ` -{ - "A": {} -} -`, + name: "HeadUint8PtrNilNotRootOmitEmpty", data: struct { A struct { A *uint8 `json:"a,omitempty"` @@ -930,15 +539,7 @@ null }{}, }, { - name: "HeadUint8PtrNilNotRootString", - expected: `{"A":{"a":null}}`, - indentExpected: ` -{ - "A": { - "a": null - } -} -`, + name: "HeadUint8PtrNilNotRootString", data: struct { A struct { A *uint8 `json:"a,string"` @@ -948,15 +549,7 @@ null // PtrHeadUint8ZeroNotRoot { - name: "PtrHeadUint8ZeroNotRoot", - expected: `{"A":{"a":0}}`, - indentExpected: ` -{ - "A": { - "a": 0 - } -} -`, + name: "PtrHeadUint8ZeroNotRoot", data: struct { A *struct { A uint8 `json:"a"` @@ -966,13 +559,7 @@ null })}, }, { - name: "PtrHeadUint8ZeroNotRootOmitEmpty", - expected: `{"A":{}}`, - indentExpected: ` -{ - "A": {} -} -`, + name: "PtrHeadUint8ZeroNotRootOmitEmpty", data: struct { A *struct { A uint8 `json:"a,omitempty"` @@ -982,15 +569,7 @@ null })}, }, { - name: "PtrHeadUint8ZeroNotRootString", - expected: `{"A":{"a":"0"}}`, - indentExpected: ` -{ - "A": { - "a": "0" - } -} -`, + name: "PtrHeadUint8ZeroNotRootString", data: struct { A *struct { A uint8 `json:"a,string"` @@ -1002,15 +581,7 @@ null // PtrHeadUint8NotRoot { - name: "PtrHeadUint8NotRoot", - expected: `{"A":{"a":1}}`, - indentExpected: ` -{ - "A": { - "a": 1 - } -} -`, + name: "PtrHeadUint8NotRoot", data: struct { A *struct { A uint8 `json:"a"` @@ -1020,15 +591,7 @@ null }{A: 1})}, }, { - name: "PtrHeadUint8NotRootOmitEmpty", - expected: `{"A":{"a":1}}`, - indentExpected: ` -{ - "A": { - "a": 1 - } -} -`, + name: "PtrHeadUint8NotRootOmitEmpty", data: struct { A *struct { A uint8 `json:"a,omitempty"` @@ -1038,15 +601,7 @@ null }{A: 1})}, }, { - name: "PtrHeadUint8NotRootString", - expected: `{"A":{"a":"1"}}`, - indentExpected: ` -{ - "A": { - "a": "1" - } -} -`, + name: "PtrHeadUint8NotRootString", data: struct { A *struct { A uint8 `json:"a,string"` @@ -1058,15 +613,7 @@ null // PtrHeadUint8PtrNotRoot { - name: "PtrHeadUint8PtrNotRoot", - expected: `{"A":{"a":1}}`, - indentExpected: ` -{ - "A": { - "a": 1 - } -} -`, + name: "PtrHeadUint8PtrNotRoot", data: struct { A *struct { A *uint8 `json:"a"` @@ -1076,15 +623,7 @@ null }{A: uint8ptr(1)})}, }, { - name: "PtrHeadUint8PtrNotRootOmitEmpty", - expected: `{"A":{"a":1}}`, - indentExpected: ` -{ - "A": { - "a": 1 - } -} -`, + name: "PtrHeadUint8PtrNotRootOmitEmpty", data: struct { A *struct { A *uint8 `json:"a,omitempty"` @@ -1094,15 +633,7 @@ null }{A: uint8ptr(1)})}, }, { - name: "PtrHeadUint8PtrNotRootString", - expected: `{"A":{"a":"1"}}`, - indentExpected: ` -{ - "A": { - "a": "1" - } -} -`, + name: "PtrHeadUint8PtrNotRootString", data: struct { A *struct { A *uint8 `json:"a,string"` @@ -1114,15 +645,7 @@ null // PtrHeadUint8PtrNilNotRoot { - name: "PtrHeadUint8PtrNilNotRoot", - expected: `{"A":{"a":null}}`, - indentExpected: ` -{ - "A": { - "a": null - } -} -`, + name: "PtrHeadUint8PtrNilNotRoot", data: struct { A *struct { A *uint8 `json:"a"` @@ -1132,13 +655,7 @@ null }{A: nil})}, }, { - name: "PtrHeadUint8PtrNilNotRootOmitEmpty", - expected: `{"A":{}}`, - indentExpected: ` -{ - "A": {} -} -`, + name: "PtrHeadUint8PtrNilNotRootOmitEmpty", data: struct { A *struct { A *uint8 `json:"a,omitempty"` @@ -1148,15 +665,7 @@ null }{A: nil})}, }, { - name: "PtrHeadUint8PtrNilNotRootString", - expected: `{"A":{"a":null}}`, - indentExpected: ` -{ - "A": { - "a": null - } -} -`, + name: "PtrHeadUint8PtrNilNotRootString", data: struct { A *struct { A *uint8 `json:"a,string"` @@ -1168,13 +677,7 @@ null // PtrHeadUint8NilNotRoot { - name: "PtrHeadUint8NilNotRoot", - expected: `{"A":null}`, - indentExpected: ` -{ - "A": null -} -`, + name: "PtrHeadUint8NilNotRoot", data: struct { A *struct { A *uint8 `json:"a"` @@ -1182,11 +685,7 @@ null }{A: nil}, }, { - name: "PtrHeadUint8NilNotRootOmitEmpty", - expected: `{}`, - indentExpected: ` -{} -`, + name: "PtrHeadUint8NilNotRootOmitEmpty", data: struct { A *struct { A *uint8 `json:"a,omitempty"` @@ -1194,13 +693,7 @@ null }{A: nil}, }, { - name: "PtrHeadUint8NilNotRootString", - expected: `{"A":null}`, - indentExpected: ` -{ - "A": null -} -`, + name: "PtrHeadUint8NilNotRootString", data: struct { A *struct { A *uint8 `json:"a,string"` @@ -1210,18 +703,7 @@ null // HeadUint8ZeroMultiFieldsNotRoot { - name: "HeadUint8ZeroMultiFieldsNotRoot", - expected: `{"A":{"a":0},"B":{"b":0}}`, - indentExpected: ` -{ - "A": { - "a": 0 - }, - "B": { - "b": 0 - } -} -`, + name: "HeadUint8ZeroMultiFieldsNotRoot", data: struct { A struct { A uint8 `json:"a"` @@ -1232,14 +714,7 @@ null }{}, }, { - name: "HeadUint8ZeroMultiFieldsNotRootOmitEmpty", - expected: `{"A":{},"B":{}}`, - indentExpected: ` -{ - "A": {}, - "B": {} -} -`, + name: "HeadUint8ZeroMultiFieldsNotRootOmitEmpty", data: struct { A struct { A uint8 `json:"a,omitempty"` @@ -1250,18 +725,7 @@ null }{}, }, { - name: "HeadUint8ZeroMultiFieldsNotRootString", - expected: `{"A":{"a":"0"},"B":{"b":"0"}}`, - indentExpected: ` -{ - "A": { - "a": "0" - }, - "B": { - "b": "0" - } -} -`, + name: "HeadUint8ZeroMultiFieldsNotRootString", data: struct { A struct { A uint8 `json:"a,string"` @@ -1274,18 +738,7 @@ null // HeadUint8MultiFieldsNotRoot { - name: "HeadUint8MultiFieldsNotRoot", - expected: `{"A":{"a":1},"B":{"b":2}}`, - indentExpected: ` -{ - "A": { - "a": 1 - }, - "B": { - "b": 2 - } -} -`, + name: "HeadUint8MultiFieldsNotRoot", data: struct { A struct { A uint8 `json:"a"` @@ -1300,18 +753,7 @@ null }{B: 2}}, }, { - name: "HeadUint8MultiFieldsNotRootOmitEmpty", - expected: `{"A":{"a":1},"B":{"b":2}}`, - indentExpected: ` -{ - "A": { - "a": 1 - }, - "B": { - "b": 2 - } -} -`, + name: "HeadUint8MultiFieldsNotRootOmitEmpty", data: struct { A struct { A uint8 `json:"a,omitempty"` @@ -1326,18 +768,7 @@ null }{B: 2}}, }, { - name: "HeadUint8MultiFieldsNotRootString", - expected: `{"A":{"a":"1"},"B":{"b":"2"}}`, - indentExpected: ` -{ - "A": { - "a": "1" - }, - "B": { - "b": "2" - } -} -`, + name: "HeadUint8MultiFieldsNotRootString", data: struct { A struct { A uint8 `json:"a,string"` @@ -1354,18 +785,7 @@ null // HeadUint8PtrMultiFieldsNotRoot { - name: "HeadUint8PtrMultiFieldsNotRoot", - expected: `{"A":{"a":1},"B":{"b":2}}`, - indentExpected: ` -{ - "A": { - "a": 1 - }, - "B": { - "b": 2 - } -} -`, + name: "HeadUint8PtrMultiFieldsNotRoot", data: struct { A struct { A *uint8 `json:"a"` @@ -1380,18 +800,7 @@ null }{B: uint8ptr(2)}}, }, { - name: "HeadUint8PtrMultiFieldsNotRootOmitEmpty", - expected: `{"A":{"a":1},"B":{"b":2}}`, - indentExpected: ` -{ - "A": { - "a": 1 - }, - "B": { - "b": 2 - } -} -`, + name: "HeadUint8PtrMultiFieldsNotRootOmitEmpty", data: struct { A struct { A *uint8 `json:"a,omitempty"` @@ -1406,18 +815,7 @@ null }{B: uint8ptr(2)}}, }, { - name: "HeadUint8PtrMultiFieldsNotRootString", - expected: `{"A":{"a":"1"},"B":{"b":"2"}}`, - indentExpected: ` -{ - "A": { - "a": "1" - }, - "B": { - "b": "2" - } -} -`, + name: "HeadUint8PtrMultiFieldsNotRootString", data: struct { A struct { A *uint8 `json:"a,string"` @@ -1434,18 +832,7 @@ null // HeadUint8PtrNilMultiFieldsNotRoot { - name: "HeadUint8PtrNilMultiFieldsNotRoot", - expected: `{"A":{"a":null},"B":{"b":null}}`, - indentExpected: ` -{ - "A": { - "a": null - }, - "B": { - "b": null - } -} -`, + name: "HeadUint8PtrNilMultiFieldsNotRoot", data: struct { A struct { A *uint8 `json:"a"` @@ -1460,14 +847,7 @@ null }{B: nil}}, }, { - name: "HeadUint8PtrNilMultiFieldsNotRootOmitEmpty", - expected: `{"A":{},"B":{}}`, - indentExpected: ` -{ - "A": {}, - "B": {} -} -`, + name: "HeadUint8PtrNilMultiFieldsNotRootOmitEmpty", data: struct { A struct { A *uint8 `json:"a,omitempty"` @@ -1482,18 +862,7 @@ null }{B: nil}}, }, { - name: "HeadUint8PtrNilMultiFieldsNotRootString", - expected: `{"A":{"a":null},"B":{"b":null}}`, - indentExpected: ` -{ - "A": { - "a": null - }, - "B": { - "b": null - } -} -`, + name: "HeadUint8PtrNilMultiFieldsNotRootString", data: struct { A struct { A *uint8 `json:"a,string"` @@ -1510,18 +879,7 @@ null // PtrHeadUint8ZeroMultiFieldsNotRoot { - name: "PtrHeadUint8ZeroMultiFieldsNotRoot", - expected: `{"A":{"a":0},"B":{"b":0}}`, - indentExpected: ` -{ - "A": { - "a": 0 - }, - "B": { - "b": 0 - } -} -`, + name: "PtrHeadUint8ZeroMultiFieldsNotRoot", data: &struct { A struct { A uint8 `json:"a"` @@ -1532,14 +890,7 @@ null }{}, }, { - name: "PtrHeadUint8ZeroMultiFieldsNotRootOmitEmpty", - expected: `{"A":{},"B":{}}`, - indentExpected: ` -{ - "A": {}, - "B": {} -} -`, + name: "PtrHeadUint8ZeroMultiFieldsNotRootOmitEmpty", data: &struct { A struct { A uint8 `json:"a,omitempty"` @@ -1550,18 +901,7 @@ null }{}, }, { - name: "PtrHeadUint8ZeroMultiFieldsNotRootString", - expected: `{"A":{"a":"0"},"B":{"b":"0"}}`, - indentExpected: ` -{ - "A": { - "a": "0" - }, - "B": { - "b": "0" - } -} -`, + name: "PtrHeadUint8ZeroMultiFieldsNotRootString", data: &struct { A struct { A uint8 `json:"a,string"` @@ -1574,18 +914,7 @@ null // PtrHeadUint8MultiFieldsNotRoot { - name: "PtrHeadUint8MultiFieldsNotRoot", - expected: `{"A":{"a":1},"B":{"b":2}}`, - indentExpected: ` -{ - "A": { - "a": 1 - }, - "B": { - "b": 2 - } -} -`, + name: "PtrHeadUint8MultiFieldsNotRoot", data: &struct { A struct { A uint8 `json:"a"` @@ -1600,18 +929,7 @@ null }{B: 2}}, }, { - name: "PtrHeadUint8MultiFieldsNotRootOmitEmpty", - expected: `{"A":{"a":1},"B":{"b":2}}`, - indentExpected: ` -{ - "A": { - "a": 1 - }, - "B": { - "b": 2 - } -} -`, + name: "PtrHeadUint8MultiFieldsNotRootOmitEmpty", data: &struct { A struct { A uint8 `json:"a,omitempty"` @@ -1626,18 +944,7 @@ null }{B: 2}}, }, { - name: "PtrHeadUint8MultiFieldsNotRootString", - expected: `{"A":{"a":"1"},"B":{"b":"2"}}`, - indentExpected: ` -{ - "A": { - "a": "1" - }, - "B": { - "b": "2" - } -} -`, + name: "PtrHeadUint8MultiFieldsNotRootString", data: &struct { A struct { A uint8 `json:"a,string"` @@ -1654,18 +961,7 @@ null // PtrHeadUint8PtrMultiFieldsNotRoot { - name: "PtrHeadUint8PtrMultiFieldsNotRoot", - expected: `{"A":{"a":1},"B":{"b":2}}`, - indentExpected: ` -{ - "A": { - "a": 1 - }, - "B": { - "b": 2 - } -} -`, + name: "PtrHeadUint8PtrMultiFieldsNotRoot", data: &struct { A *struct { A *uint8 `json:"a"` @@ -1680,18 +976,7 @@ null }{B: uint8ptr(2)})}, }, { - name: "PtrHeadUint8PtrMultiFieldsNotRootOmitEmpty", - expected: `{"A":{"a":1},"B":{"b":2}}`, - indentExpected: ` -{ - "A": { - "a": 1 - }, - "B": { - "b": 2 - } -} -`, + name: "PtrHeadUint8PtrMultiFieldsNotRootOmitEmpty", data: &struct { A *struct { A *uint8 `json:"a,omitempty"` @@ -1706,18 +991,7 @@ null }{B: uint8ptr(2)})}, }, { - name: "PtrHeadUint8PtrMultiFieldsNotRootString", - expected: `{"A":{"a":"1"},"B":{"b":"2"}}`, - indentExpected: ` -{ - "A": { - "a": "1" - }, - "B": { - "b": "2" - } -} -`, + name: "PtrHeadUint8PtrMultiFieldsNotRootString", data: &struct { A *struct { A *uint8 `json:"a,string"` @@ -1734,14 +1008,7 @@ null // PtrHeadUint8PtrNilMultiFieldsNotRoot { - name: "PtrHeadUint8PtrNilMultiFieldsNotRoot", - expected: `{"A":null,"B":null}`, - indentExpected: ` -{ - "A": null, - "B": null -} -`, + name: "PtrHeadUint8PtrNilMultiFieldsNotRoot", data: &struct { A *struct { A *uint8 `json:"a"` @@ -1752,11 +1019,7 @@ null }{A: nil, B: nil}, }, { - name: "PtrHeadUint8PtrNilMultiFieldsNotRootOmitEmpty", - expected: `{}`, - indentExpected: ` -{} -`, + name: "PtrHeadUint8PtrNilMultiFieldsNotRootOmitEmpty", data: &struct { A *struct { A *uint8 `json:"a,omitempty"` @@ -1767,14 +1030,7 @@ null }{A: nil, B: nil}, }, { - name: "PtrHeadUint8PtrNilMultiFieldsNotRootString", - expected: `{"A":null,"B":null}`, - indentExpected: ` -{ - "A": null, - "B": null -} -`, + name: "PtrHeadUint8PtrNilMultiFieldsNotRootString", data: &struct { A *struct { A *uint8 `json:"a,string"` @@ -1787,11 +1043,7 @@ null // PtrHeadUint8NilMultiFieldsNotRoot { - name: "PtrHeadUint8NilMultiFieldsNotRoot", - expected: `null`, - indentExpected: ` -null -`, + name: "PtrHeadUint8NilMultiFieldsNotRoot", data: (*struct { A *struct { A *uint8 `json:"a"` @@ -1802,11 +1054,7 @@ null })(nil), }, { - name: "PtrHeadUint8NilMultiFieldsNotRootOmitEmpty", - expected: `null`, - indentExpected: ` -null -`, + name: "PtrHeadUint8NilMultiFieldsNotRootOmitEmpty", data: (*struct { A *struct { A *uint8 `json:"a,omitempty"` @@ -1817,11 +1065,7 @@ null })(nil), }, { - name: "PtrHeadUint8NilMultiFieldsNotRootString", - expected: `null`, - indentExpected: ` -null -`, + name: "PtrHeadUint8NilMultiFieldsNotRootString", data: (*struct { A *struct { A *uint8 `json:"a,string"` @@ -1834,20 +1078,7 @@ null // PtrHeadUint8DoubleMultiFieldsNotRoot { - name: "PtrHeadUint8DoubleMultiFieldsNotRoot", - expected: `{"A":{"a":1,"b":2},"B":{"a":3,"b":4}}`, - indentExpected: ` -{ - "A": { - "a": 1, - "b": 2 - }, - "B": { - "a": 3, - "b": 4 - } -} -`, + name: "PtrHeadUint8DoubleMultiFieldsNotRoot", data: &struct { A *struct { A uint8 `json:"a"` @@ -1866,20 +1097,7 @@ null }{A: 3, B: 4})}, }, { - name: "PtrHeadUint8DoubleMultiFieldsNotRootOmitEmpty", - expected: `{"A":{"a":1,"b":2},"B":{"a":3,"b":4}}`, - indentExpected: ` -{ - "A": { - "a": 1, - "b": 2 - }, - "B": { - "a": 3, - "b": 4 - } -} -`, + name: "PtrHeadUint8DoubleMultiFieldsNotRootOmitEmpty", data: &struct { A *struct { A uint8 `json:"a,omitempty"` @@ -1898,20 +1116,7 @@ null }{A: 3, B: 4})}, }, { - name: "PtrHeadUint8DoubleMultiFieldsNotRootString", - expected: `{"A":{"a":"1","b":"2"},"B":{"a":"3","b":"4"}}`, - indentExpected: ` -{ - "A": { - "a": "1", - "b": "2" - }, - "B": { - "a": "3", - "b": "4" - } -} -`, + name: "PtrHeadUint8DoubleMultiFieldsNotRootString", data: &struct { A *struct { A uint8 `json:"a,string"` @@ -1932,14 +1137,7 @@ null // PtrHeadUint8NilDoubleMultiFieldsNotRoot { - name: "PtrHeadUint8NilDoubleMultiFieldsNotRoot", - expected: `{"A":null,"B":null}`, - indentExpected: ` -{ - "A": null, - "B": null -} -`, + name: "PtrHeadUint8NilDoubleMultiFieldsNotRoot", data: &struct { A *struct { A uint8 `json:"a"` @@ -1952,11 +1150,7 @@ null }{A: nil, B: nil}, }, { - name: "PtrHeadUint8NilDoubleMultiFieldsNotRootOmitEmpty", - expected: `{}`, - indentExpected: ` -{} -`, + name: "PtrHeadUint8NilDoubleMultiFieldsNotRootOmitEmpty", data: &struct { A *struct { A uint8 `json:"a,omitempty"` @@ -1969,14 +1163,7 @@ null }{A: nil, B: nil}, }, { - name: "PtrHeadUint8NilDoubleMultiFieldsNotRootString", - expected: `{"A":null,"B":null}`, - indentExpected: ` -{ - "A": null, - "B": null -} -`, + name: "PtrHeadUint8NilDoubleMultiFieldsNotRootString", data: &struct { A *struct { A uint8 `json:"a,string"` @@ -1991,11 +1178,7 @@ null // PtrHeadUint8NilDoubleMultiFieldsNotRoot { - name: "PtrHeadUint8NilDoubleMultiFieldsNotRoot", - expected: `null`, - indentExpected: ` -null -`, + name: "PtrHeadUint8NilDoubleMultiFieldsNotRoot", data: (*struct { A *struct { A uint8 `json:"a"` @@ -2008,11 +1191,7 @@ null })(nil), }, { - name: "PtrHeadUint8NilDoubleMultiFieldsNotRootOmitEmpty", - expected: `null`, - indentExpected: ` -null -`, + name: "PtrHeadUint8NilDoubleMultiFieldsNotRootOmitEmpty", data: (*struct { A *struct { A uint8 `json:"a,omitempty"` @@ -2025,11 +1204,7 @@ null })(nil), }, { - name: "PtrHeadUint8NilDoubleMultiFieldsNotRootString", - expected: `null`, - indentExpected: ` -null -`, + name: "PtrHeadUint8NilDoubleMultiFieldsNotRootString", data: (*struct { A *struct { A uint8 `json:"a,string"` @@ -2044,20 +1219,7 @@ null // PtrHeadUint8PtrDoubleMultiFieldsNotRoot { - name: "PtrHeadUint8PtrDoubleMultiFieldsNotRoot", - expected: `{"A":{"a":1,"b":2},"B":{"a":3,"b":4}}`, - indentExpected: ` -{ - "A": { - "a": 1, - "b": 2 - }, - "B": { - "a": 3, - "b": 4 - } -} -`, + name: "PtrHeadUint8PtrDoubleMultiFieldsNotRoot", data: &struct { A *struct { A *uint8 `json:"a"` @@ -2076,20 +1238,7 @@ null }{A: uint8ptr(3), B: uint8ptr(4)})}, }, { - name: "PtrHeadUint8PtrDoubleMultiFieldsNotRootOmitEmpty", - expected: `{"A":{"a":1,"b":2},"B":{"a":3,"b":4}}`, - indentExpected: ` -{ - "A": { - "a": 1, - "b": 2 - }, - "B": { - "a": 3, - "b": 4 - } -} -`, + name: "PtrHeadUint8PtrDoubleMultiFieldsNotRootOmitEmpty", data: &struct { A *struct { A *uint8 `json:"a,omitempty"` @@ -2108,20 +1257,7 @@ null }{A: uint8ptr(3), B: uint8ptr(4)})}, }, { - name: "PtrHeadUint8PtrDoubleMultiFieldsNotRootString", - expected: `{"A":{"a":"1","b":"2"},"B":{"a":"3","b":"4"}}`, - indentExpected: ` -{ - "A": { - "a": "1", - "b": "2" - }, - "B": { - "a": "3", - "b": "4" - } -} -`, + name: "PtrHeadUint8PtrDoubleMultiFieldsNotRootString", data: &struct { A *struct { A *uint8 `json:"a,string"` @@ -2142,14 +1278,7 @@ null // PtrHeadUint8PtrNilDoubleMultiFieldsNotRoot { - name: "PtrHeadUint8PtrNilDoubleMultiFieldsNotRoot", - expected: `{"A":null,"B":null}`, - indentExpected: ` -{ - "A": null, - "B": null -} -`, + name: "PtrHeadUint8PtrNilDoubleMultiFieldsNotRoot", data: &struct { A *struct { A *uint8 `json:"a"` @@ -2162,11 +1291,7 @@ null }{A: nil, B: nil}, }, { - name: "PtrHeadUint8PtrNilDoubleMultiFieldsNotRootOmitEmpty", - expected: `{}`, - indentExpected: ` -{} -`, + name: "PtrHeadUint8PtrNilDoubleMultiFieldsNotRootOmitEmpty", data: &struct { A *struct { A *uint8 `json:"a,omitempty"` @@ -2179,14 +1304,7 @@ null }{A: nil, B: nil}, }, { - name: "PtrHeadUint8PtrNilDoubleMultiFieldsNotRootString", - expected: `{"A":null,"B":null}`, - indentExpected: ` -{ - "A": null, - "B": null -} -`, + name: "PtrHeadUint8PtrNilDoubleMultiFieldsNotRootString", data: &struct { A *struct { A *uint8 `json:"a,string"` @@ -2201,11 +1319,7 @@ null // PtrHeadUint8PtrNilDoubleMultiFieldsNotRoot { - name: "PtrHeadUint8PtrNilDoubleMultiFieldsNotRoot", - expected: `null`, - indentExpected: ` -null -`, + name: "PtrHeadUint8PtrNilDoubleMultiFieldsNotRoot", data: (*struct { A *struct { A *uint8 `json:"a"` @@ -2218,11 +1332,7 @@ null })(nil), }, { - name: "PtrHeadUint8PtrNilDoubleMultiFieldsNotRootOmitEmpty", - expected: `null`, - indentExpected: ` -null -`, + name: "PtrHeadUint8PtrNilDoubleMultiFieldsNotRootOmitEmpty", data: (*struct { A *struct { A *uint8 `json:"a,omitempty"` @@ -2235,11 +1345,7 @@ null })(nil), }, { - name: "PtrHeadUint8PtrNilDoubleMultiFieldsNotRootString", - expected: `null`, - indentExpected: ` -null -`, + name: "PtrHeadUint8PtrNilDoubleMultiFieldsNotRootString", data: (*struct { A *struct { A *uint8 `json:"a,string"` @@ -2254,14 +1360,7 @@ null // AnonymousHeadUint8 { - name: "AnonymousHeadUint8", - expected: `{"a":1,"b":2}`, - indentExpected: ` -{ - "a": 1, - "b": 2 -} -`, + name: "AnonymousHeadUint8", data: struct { structUint8 B uint8 `json:"b"` @@ -2271,14 +1370,7 @@ null }, }, { - name: "AnonymousHeadUint8OmitEmpty", - expected: `{"a":1,"b":2}`, - indentExpected: ` -{ - "a": 1, - "b": 2 -} -`, + name: "AnonymousHeadUint8OmitEmpty", data: struct { structUint8OmitEmpty B uint8 `json:"b,omitempty"` @@ -2288,14 +1380,7 @@ null }, }, { - name: "AnonymousHeadUint8String", - expected: `{"a":"1","b":"2"}`, - indentExpected: ` -{ - "a": "1", - "b": "2" -} -`, + name: "AnonymousHeadUint8String", data: struct { structUint8String B uint8 `json:"b,string"` @@ -2307,14 +1392,7 @@ null // PtrAnonymousHeadUint8 { - name: "PtrAnonymousHeadUint8", - expected: `{"a":1,"b":2}`, - indentExpected: ` -{ - "a": 1, - "b": 2 -} -`, + name: "PtrAnonymousHeadUint8", data: struct { *structUint8 B uint8 `json:"b"` @@ -2324,14 +1402,7 @@ null }, }, { - name: "PtrAnonymousHeadUint8OmitEmpty", - expected: `{"a":1,"b":2}`, - indentExpected: ` -{ - "a": 1, - "b": 2 -} -`, + name: "PtrAnonymousHeadUint8OmitEmpty", data: struct { *structUint8OmitEmpty B uint8 `json:"b,omitempty"` @@ -2341,14 +1412,7 @@ null }, }, { - name: "PtrAnonymousHeadUint8String", - expected: `{"a":"1","b":"2"}`, - indentExpected: ` -{ - "a": "1", - "b": "2" -} -`, + name: "PtrAnonymousHeadUint8String", data: struct { *structUint8String B uint8 `json:"b,string"` @@ -2360,13 +1424,7 @@ null // NilPtrAnonymousHeadUint8 { - name: "NilPtrAnonymousHeadUint8", - expected: `{"b":2}`, - indentExpected: ` -{ - "b": 2 -} -`, + name: "NilPtrAnonymousHeadUint8", data: struct { *structUint8 B uint8 `json:"b"` @@ -2376,13 +1434,7 @@ null }, }, { - name: "NilPtrAnonymousHeadUint8OmitEmpty", - expected: `{"b":2}`, - indentExpected: ` -{ - "b": 2 -} -`, + name: "NilPtrAnonymousHeadUint8OmitEmpty", data: struct { *structUint8OmitEmpty B uint8 `json:"b,omitempty"` @@ -2392,13 +1444,7 @@ null }, }, { - name: "NilPtrAnonymousHeadUint8String", - expected: `{"b":"2"}`, - indentExpected: ` -{ - "b": "2" -} -`, + name: "NilPtrAnonymousHeadUint8String", data: struct { *structUint8String B uint8 `json:"b,string"` @@ -2410,14 +1456,7 @@ null // AnonymousHeadUint8Ptr { - name: "AnonymousHeadUint8Ptr", - expected: `{"a":1,"b":2}`, - indentExpected: ` -{ - "a": 1, - "b": 2 -} -`, + name: "AnonymousHeadUint8Ptr", data: struct { structUint8Ptr B *uint8 `json:"b"` @@ -2427,14 +1466,7 @@ null }, }, { - name: "AnonymousHeadUint8PtrOmitEmpty", - expected: `{"a":1,"b":2}`, - indentExpected: ` -{ - "a": 1, - "b": 2 -} -`, + name: "AnonymousHeadUint8PtrOmitEmpty", data: struct { structUint8PtrOmitEmpty B *uint8 `json:"b,omitempty"` @@ -2444,14 +1476,7 @@ null }, }, { - name: "AnonymousHeadUint8PtrString", - expected: `{"a":"1","b":"2"}`, - indentExpected: ` -{ - "a": "1", - "b": "2" -} -`, + name: "AnonymousHeadUint8PtrString", data: struct { structUint8PtrString B *uint8 `json:"b,string"` @@ -2463,14 +1488,7 @@ null // AnonymousHeadUint8PtrNil { - name: "AnonymousHeadUint8PtrNil", - expected: `{"a":null,"b":2}`, - indentExpected: ` -{ - "a": null, - "b": 2 -} -`, + name: "AnonymousHeadUint8PtrNil", data: struct { structUint8Ptr B *uint8 `json:"b"` @@ -2480,13 +1498,7 @@ null }, }, { - name: "AnonymousHeadUint8PtrNilOmitEmpty", - expected: `{"b":2}`, - indentExpected: ` -{ - "b": 2 -} -`, + name: "AnonymousHeadUint8PtrNilOmitEmpty", data: struct { structUint8PtrOmitEmpty B *uint8 `json:"b,omitempty"` @@ -2496,14 +1508,7 @@ null }, }, { - name: "AnonymousHeadUint8PtrNilString", - expected: `{"a":null,"b":"2"}`, - indentExpected: ` -{ - "a": null, - "b": "2" -} -`, + name: "AnonymousHeadUint8PtrNilString", data: struct { structUint8PtrString B *uint8 `json:"b,string"` @@ -2515,14 +1520,7 @@ null // PtrAnonymousHeadUint8Ptr { - name: "PtrAnonymousHeadUint8Ptr", - expected: `{"a":1,"b":2}`, - indentExpected: ` -{ - "a": 1, - "b": 2 -} -`, + name: "PtrAnonymousHeadUint8Ptr", data: struct { *structUint8Ptr B *uint8 `json:"b"` @@ -2532,14 +1530,7 @@ null }, }, { - name: "PtrAnonymousHeadUint8PtrOmitEmpty", - expected: `{"a":1,"b":2}`, - indentExpected: ` -{ - "a": 1, - "b": 2 -} -`, + name: "PtrAnonymousHeadUint8PtrOmitEmpty", data: struct { *structUint8PtrOmitEmpty B *uint8 `json:"b,omitempty"` @@ -2549,14 +1540,7 @@ null }, }, { - name: "PtrAnonymousHeadUint8PtrString", - expected: `{"a":"1","b":"2"}`, - indentExpected: ` -{ - "a": "1", - "b": "2" -} -`, + name: "PtrAnonymousHeadUint8PtrString", data: struct { *structUint8PtrString B *uint8 `json:"b,string"` @@ -2568,13 +1552,7 @@ null // NilPtrAnonymousHeadUint8Ptr { - name: "NilPtrAnonymousHeadUint8Ptr", - expected: `{"b":2}`, - indentExpected: ` -{ - "b": 2 -} -`, + name: "NilPtrAnonymousHeadUint8Ptr", data: struct { *structUint8Ptr B *uint8 `json:"b"` @@ -2584,13 +1562,7 @@ null }, }, { - name: "NilPtrAnonymousHeadUint8PtrOmitEmpty", - expected: `{"b":2}`, - indentExpected: ` -{ - "b": 2 -} -`, + name: "NilPtrAnonymousHeadUint8PtrOmitEmpty", data: struct { *structUint8PtrOmitEmpty B *uint8 `json:"b,omitempty"` @@ -2600,13 +1572,7 @@ null }, }, { - name: "NilPtrAnonymousHeadUint8PtrString", - expected: `{"b":"2"}`, - indentExpected: ` -{ - "b": "2" -} -`, + name: "NilPtrAnonymousHeadUint8PtrString", data: struct { *structUint8PtrString B *uint8 `json:"b,string"` @@ -2618,13 +1584,7 @@ null // AnonymousHeadUint8Only { - name: "AnonymousHeadUint8Only", - expected: `{"a":1}`, - indentExpected: ` -{ - "a": 1 -} -`, + name: "AnonymousHeadUint8Only", data: struct { structUint8 }{ @@ -2632,13 +1592,7 @@ null }, }, { - name: "AnonymousHeadUint8OnlyOmitEmpty", - expected: `{"a":1}`, - indentExpected: ` -{ - "a": 1 -} -`, + name: "AnonymousHeadUint8OnlyOmitEmpty", data: struct { structUint8OmitEmpty }{ @@ -2646,13 +1600,7 @@ null }, }, { - name: "AnonymousHeadUint8OnlyString", - expected: `{"a":"1"}`, - indentExpected: ` -{ - "a": "1" -} -`, + name: "AnonymousHeadUint8OnlyString", data: struct { structUint8String }{ @@ -2662,13 +1610,7 @@ null // PtrAnonymousHeadUint8Only { - name: "PtrAnonymousHeadUint8Only", - expected: `{"a":1}`, - indentExpected: ` -{ - "a": 1 -} -`, + name: "PtrAnonymousHeadUint8Only", data: struct { *structUint8 }{ @@ -2676,13 +1618,7 @@ null }, }, { - name: "PtrAnonymousHeadUint8OnlyOmitEmpty", - expected: `{"a":1}`, - indentExpected: ` -{ - "a": 1 -} -`, + name: "PtrAnonymousHeadUint8OnlyOmitEmpty", data: struct { *structUint8OmitEmpty }{ @@ -2690,13 +1626,7 @@ null }, }, { - name: "PtrAnonymousHeadUint8OnlyString", - expected: `{"a":"1"}`, - indentExpected: ` -{ - "a": "1" -} -`, + name: "PtrAnonymousHeadUint8OnlyString", data: struct { *structUint8String }{ @@ -2706,11 +1636,7 @@ null // NilPtrAnonymousHeadUint8Only { - name: "NilPtrAnonymousHeadUint8Only", - expected: `{}`, - indentExpected: ` -{} -`, + name: "NilPtrAnonymousHeadUint8Only", data: struct { *structUint8 }{ @@ -2718,11 +1644,7 @@ null }, }, { - name: "NilPtrAnonymousHeadUint8OnlyOmitEmpty", - expected: `{}`, - indentExpected: ` -{} -`, + name: "NilPtrAnonymousHeadUint8OnlyOmitEmpty", data: struct { *structUint8OmitEmpty }{ @@ -2730,11 +1652,7 @@ null }, }, { - name: "NilPtrAnonymousHeadUint8OnlyString", - expected: `{}`, - indentExpected: ` -{} -`, + name: "NilPtrAnonymousHeadUint8OnlyString", data: struct { *structUint8String }{ @@ -2744,13 +1662,7 @@ null // AnonymousHeadUint8PtrOnly { - name: "AnonymousHeadUint8PtrOnly", - expected: `{"a":1}`, - indentExpected: ` -{ - "a": 1 -} -`, + name: "AnonymousHeadUint8PtrOnly", data: struct { structUint8Ptr }{ @@ -2758,13 +1670,7 @@ null }, }, { - name: "AnonymousHeadUint8PtrOnlyOmitEmpty", - expected: `{"a":1}`, - indentExpected: ` -{ - "a": 1 -} -`, + name: "AnonymousHeadUint8PtrOnlyOmitEmpty", data: struct { structUint8PtrOmitEmpty }{ @@ -2772,13 +1678,7 @@ null }, }, { - name: "AnonymousHeadUint8PtrOnlyString", - expected: `{"a":"1"}`, - indentExpected: ` -{ - "a": "1" -} -`, + name: "AnonymousHeadUint8PtrOnlyString", data: struct { structUint8PtrString }{ @@ -2788,13 +1688,7 @@ null // AnonymousHeadUint8PtrNilOnly { - name: "AnonymousHeadUint8PtrNilOnly", - expected: `{"a":null}`, - indentExpected: ` -{ - "a": null -} -`, + name: "AnonymousHeadUint8PtrNilOnly", data: struct { structUint8Ptr }{ @@ -2802,11 +1696,7 @@ null }, }, { - name: "AnonymousHeadUint8PtrNilOnlyOmitEmpty", - expected: `{}`, - indentExpected: ` -{} -`, + name: "AnonymousHeadUint8PtrNilOnlyOmitEmpty", data: struct { structUint8PtrOmitEmpty }{ @@ -2814,13 +1704,7 @@ null }, }, { - name: "AnonymousHeadUint8PtrNilOnlyString", - expected: `{"a":null}`, - indentExpected: ` -{ - "a": null -} -`, + name: "AnonymousHeadUint8PtrNilOnlyString", data: struct { structUint8PtrString }{ @@ -2830,13 +1714,7 @@ null // PtrAnonymousHeadUint8PtrOnly { - name: "PtrAnonymousHeadUint8PtrOnly", - expected: `{"a":1}`, - indentExpected: ` -{ - "a": 1 -} -`, + name: "PtrAnonymousHeadUint8PtrOnly", data: struct { *structUint8Ptr }{ @@ -2844,13 +1722,7 @@ null }, }, { - name: "PtrAnonymousHeadUint8PtrOnlyOmitEmpty", - expected: `{"a":1}`, - indentExpected: ` -{ - "a": 1 -} -`, + name: "PtrAnonymousHeadUint8PtrOnlyOmitEmpty", data: struct { *structUint8PtrOmitEmpty }{ @@ -2858,13 +1730,7 @@ null }, }, { - name: "PtrAnonymousHeadUint8PtrOnlyString", - expected: `{"a":"1"}`, - indentExpected: ` -{ - "a": "1" -} -`, + name: "PtrAnonymousHeadUint8PtrOnlyString", data: struct { *structUint8PtrString }{ @@ -2874,11 +1740,7 @@ null // NilPtrAnonymousHeadUint8PtrOnly { - name: "NilPtrAnonymousHeadUint8PtrOnly", - expected: `{}`, - indentExpected: ` -{} -`, + name: "NilPtrAnonymousHeadUint8PtrOnly", data: struct { *structUint8Ptr }{ @@ -2886,11 +1748,7 @@ null }, }, { - name: "NilPtrAnonymousHeadUint8PtrOnlyOmitEmpty", - expected: `{}`, - indentExpected: ` -{} -`, + name: "NilPtrAnonymousHeadUint8PtrOnlyOmitEmpty", data: struct { *structUint8PtrOmitEmpty }{ @@ -2898,11 +1756,7 @@ null }, }, { - name: "NilPtrAnonymousHeadUint8PtrOnlyString", - expected: `{}`, - indentExpected: ` -{} -`, + name: "NilPtrAnonymousHeadUint8PtrOnlyString", data: struct { *structUint8PtrString }{ @@ -2920,22 +1774,12 @@ null enc.SetIndent("", " ") } if err := enc.Encode(test.data); err != nil { - t.Fatalf("%s(htmlEscape:%T): %s: %s", test.name, htmlEscape, test.expected, err) + t.Fatalf("%s(htmlEscape:%T): %+v: %s", test.name, htmlEscape, test.data, err) } 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()) } - if indent { - got := "\n" + buf.String() - if got != test.indentExpected { - t.Fatalf("%s(htmlEscape:%T): expected %q but got %q", test.name, htmlEscape, test.indentExpected, got) - } - } else { - if strings.TrimRight(buf.String(), "\n") != test.expected { - t.Fatalf("%s(htmlEscape:%T): expected %q but got %q", test.name, htmlEscape, test.expected, buf.String()) - } - } } } }