@@ -479,7 +479,7 @@ func createNestedMap(m map[string]interface{}, depth int, objectCount *int) {
479479 if depth == 0 {
480480 return
481481 }
482- for i := 0 ; i < 2 ;i ++ {
482+ for i := 0 ; i < 2 ; i ++ {
483483 nested := map [string ]interface {}{}
484484 * objectCount += 1
485485 createNestedMap (nested , depth - 1 , objectCount )
@@ -571,12 +571,12 @@ func benchmarkMatchesValueWithDeeplyNestedFields(depth int, b *testing.B) {
571571func BenchmarkMatchesValue1 (b * testing.B ) { benchmarkMatchesValueWithDeeplyNestedFields (1 , b ) }
572572func BenchmarkMatchesValue2 (b * testing.B ) { benchmarkMatchesValueWithDeeplyNestedFields (2 , b ) }
573573func BenchmarkMatchesValue3 (b * testing.B ) { benchmarkMatchesValueWithDeeplyNestedFields (3 , b ) }
574- func BenchmarkMatchesValue4 (b * testing.B ) { benchmarkMatchesValueWithDeeplyNestedFields (4 , b ) }
575- func BenchmarkMatchesValue5 (b * testing.B ) { benchmarkMatchesValueWithDeeplyNestedFields (5 , b ) }
576- func BenchmarkMatchesValue6 (b * testing.B ) { benchmarkMatchesValueWithDeeplyNestedFields (6 , b ) }
577- func BenchmarkMatchesValue7 (b * testing.B ) { benchmarkMatchesValueWithDeeplyNestedFields (7 , b ) }
578- func BenchmarkMatchesValue8 (b * testing.B ) { benchmarkMatchesValueWithDeeplyNestedFields (8 , b ) }
579- func BenchmarkMatchesValue9 (b * testing.B ) { benchmarkMatchesValueWithDeeplyNestedFields (9 , b ) }
574+ func BenchmarkMatchesValue4 (b * testing.B ) { benchmarkMatchesValueWithDeeplyNestedFields (4 , b ) }
575+ func BenchmarkMatchesValue5 (b * testing.B ) { benchmarkMatchesValueWithDeeplyNestedFields (5 , b ) }
576+ func BenchmarkMatchesValue6 (b * testing.B ) { benchmarkMatchesValueWithDeeplyNestedFields (6 , b ) }
577+ func BenchmarkMatchesValue7 (b * testing.B ) { benchmarkMatchesValueWithDeeplyNestedFields (7 , b ) }
578+ func BenchmarkMatchesValue8 (b * testing.B ) { benchmarkMatchesValueWithDeeplyNestedFields (8 , b ) }
579+ func BenchmarkMatchesValue9 (b * testing.B ) { benchmarkMatchesValueWithDeeplyNestedFields (9 , b ) }
580580func BenchmarkMatchesValue10 (b * testing.B ) { benchmarkMatchesValueWithDeeplyNestedFields (10 , b ) }
581581
582582func TestCreateMergePatchComplexRemoveAll (t * testing.T ) {
@@ -674,6 +674,12 @@ func TestMergeMergePatches(t *testing.T) {
674674 p2 : `{"del2": null}` ,
675675 exp : `{"del1": null, "del2": null}` ,
676676 },
677+ {
678+ demonstrates : "nulls are kept in complex objects" ,
679+ p1 : `{}` ,
680+ p2 : `{"request":{"object":{"complex_object_array":["value1","value2","value3"],"complex_object_map":{"key1":"value1","key2":"value2","key3":"value3"},"simple_object_bool":false,"simple_object_float":-5.5,"simple_object_int":5,"simple_object_null":null,"simple_object_string":"example"}}}` ,
681+ exp : `{"request":{"object":{"complex_object_array":["value1","value2","value3"],"complex_object_map":{"key1":"value1","key2":"value2","key3":"value3"},"simple_object_bool":false,"simple_object_float":-5.5,"simple_object_int":5,"simple_object_null":null,"simple_object_string":"example"}}}` ,
682+ },
677683 {
678684 demonstrates : "a key added then deleted is kept deleted" ,
679685 p1 : `{"add_then_delete": "atd"}` ,
0 commit comments