Skip to content

Commit afaa357

Browse files
Apply suggestions from code review
Co-authored-by: Preston Vasquez <[email protected]>
1 parent 993adc4 commit afaa357

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

bson/unmarshaling_cases_test.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,26 @@ func unmarshalingTestCases() []unmarshalingTestCase {
172172
want: &valNonPtrStruct,
173173
data: docToBytes(valNonPtrStruct),
174174
},
175+
{
176+
name: "nil pointer and non-pointer type with literal null BSON",
177+
sType: reflect.TypeOf(unmarshalBehaviorTestCase{}),
178+
want: &unmarshalBehaviorTestCase{
179+
BSONValueTracker: unmarshalBSONValueCallTracker{
180+
called: true,
181+
},
182+
BSONValuePtrTracker: nil,
183+
BSONTracker: unmarshalBSONCallTracker{
184+
called: true,
185+
},
186+
BSONPtrTracker: nil,
187+
},
188+
data: docToBytes(D{
189+
{Key: "bv_tracker", Value: nil},
190+
{Key: "bv_ptr_tracker", Value: nil},
191+
{Key: "b_tracker", Value: nil},
192+
{Key: "b_ptr_tracker", Value: nil},
193+
}),
194+
},
175195
{
176196
name: "nil pointer and non-pointer type with BSON minkey",
177197
sType: reflect.TypeOf(unmarshalBehaviorTestCase{}),
@@ -342,6 +362,7 @@ func (tracker *unmarshalBSONValueCallTracker) UnmarshalBSONValue(byte, []byte) e
342362
tracker.called = true
343363
return nil
344364
}
365+
345366
func (tracker *unmarshalBSONCallTracker) UnmarshalBSON([]byte) error {
346367
tracker.called = true
347368
return nil

0 commit comments

Comments
 (0)