1
0
mirror of https://github.com/json-iterator/go.git synced 2025-08-07 21:52:55 +02:00

check nil for interface{}

This commit is contained in:
Tao Wen
2018-02-17 22:33:09 +08:00
parent 9dafbc667f
commit ef3038593b
3 changed files with 15 additions and 4 deletions

View File

@ -251,8 +251,8 @@ func init() {
})(nil),
(*struct {
TF1 struct {
F1 withTime
F2 *withTime
F2 int
F1 *withTime
}
})(nil),
(*DeeplyNested)(nil),

View File

@ -15,7 +15,18 @@ import (
var testCases []interface{}
var asymmetricTestCases [][2]interface{}
type selectedSymmetricCase struct {
testCase interface{}
}
func Test_symmetric(t *testing.T) {
for _, testCase := range testCases {
selectedSymmetricCase, found := testCase.(selectedSymmetricCase)
if found {
testCases = []interface{}{selectedSymmetricCase.testCase}
break
}
}
for _, testCase := range testCases {
valType := reflect.TypeOf(testCase).Elem()
t.Run(valType.String(), func(t *testing.T) {