Skip to content

Commit fdbd456

Browse files
committed
add error checking to test
1 parent 77f109b commit fdbd456

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

bson/encode_test.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1100,16 +1100,20 @@ func TestZeoerInterfaceUsedByDecoder(t *testing.T) {
11001100

11011101
}
11021102

1103-
type timePrtStruct struct { timePtrField *time.Time }
1103+
type timePrtStruct struct { TimePtrField *time.Time }
11041104
func TestRegressionNoDereferenceNilTimePtr (t *testing.T) {
11051105
enc := &encoder{}
11061106

11071107
assert.NotPanics(t, func () {
1108-
enc.encodeStruct(reflect.ValueOf(timePrtStruct{}))
1108+
res, err := enc.encodeStruct(reflect.ValueOf(timePrtStruct{}))
1109+
assert.Len(t, res, 1)
1110+
assert.Nil(t, err)
11091111
})
11101112

11111113
assert.NotPanics(t, func () {
1112-
enc.encodeSliceAsArray(reflect.ValueOf([]*time.Time{nil, nil, nil}), false)
1114+
res, err := enc.encodeSliceAsArray(reflect.ValueOf([]*time.Time{nil, nil, nil}), false)
1115+
assert.Len(t, res, 3)
1116+
assert.Nil(t, err)
11131117
})
11141118
}
11151119

0 commit comments

Comments
 (0)