@@ -454,7 +454,7 @@ func createNestedMap(m map[string]interface{}, depth int, objectCount *int) {
454
454
if depth == 0 {
455
455
return
456
456
}
457
- for i := 0 ; i < 2 ;i ++ {
457
+ for i := 0 ; i < 2 ; i ++ {
458
458
nested := map [string ]interface {}{}
459
459
* objectCount += 1
460
460
createNestedMap (nested , depth - 1 , objectCount )
@@ -546,12 +546,12 @@ func benchmarkMatchesValueWithDeeplyNestedFields(depth int, b *testing.B) {
546
546
func BenchmarkMatchesValue1 (b * testing.B ) { benchmarkMatchesValueWithDeeplyNestedFields (1 , b ) }
547
547
func BenchmarkMatchesValue2 (b * testing.B ) { benchmarkMatchesValueWithDeeplyNestedFields (2 , b ) }
548
548
func BenchmarkMatchesValue3 (b * testing.B ) { benchmarkMatchesValueWithDeeplyNestedFields (3 , b ) }
549
- func BenchmarkMatchesValue4 (b * testing.B ) { benchmarkMatchesValueWithDeeplyNestedFields (4 , b ) }
550
- func BenchmarkMatchesValue5 (b * testing.B ) { benchmarkMatchesValueWithDeeplyNestedFields (5 , b ) }
551
- func BenchmarkMatchesValue6 (b * testing.B ) { benchmarkMatchesValueWithDeeplyNestedFields (6 , b ) }
552
- func BenchmarkMatchesValue7 (b * testing.B ) { benchmarkMatchesValueWithDeeplyNestedFields (7 , b ) }
553
- func BenchmarkMatchesValue8 (b * testing.B ) { benchmarkMatchesValueWithDeeplyNestedFields (8 , b ) }
554
- func BenchmarkMatchesValue9 (b * testing.B ) { benchmarkMatchesValueWithDeeplyNestedFields (9 , b ) }
549
+ func BenchmarkMatchesValue4 (b * testing.B ) { benchmarkMatchesValueWithDeeplyNestedFields (4 , b ) }
550
+ func BenchmarkMatchesValue5 (b * testing.B ) { benchmarkMatchesValueWithDeeplyNestedFields (5 , b ) }
551
+ func BenchmarkMatchesValue6 (b * testing.B ) { benchmarkMatchesValueWithDeeplyNestedFields (6 , b ) }
552
+ func BenchmarkMatchesValue7 (b * testing.B ) { benchmarkMatchesValueWithDeeplyNestedFields (7 , b ) }
553
+ func BenchmarkMatchesValue8 (b * testing.B ) { benchmarkMatchesValueWithDeeplyNestedFields (8 , b ) }
554
+ func BenchmarkMatchesValue9 (b * testing.B ) { benchmarkMatchesValueWithDeeplyNestedFields (9 , b ) }
555
555
func BenchmarkMatchesValue10 (b * testing.B ) { benchmarkMatchesValueWithDeeplyNestedFields (10 , b ) }
556
556
557
557
func TestCreateMergePatchComplexRemoveAll (t * testing.T ) {
@@ -649,6 +649,12 @@ func TestMergeMergePatches(t *testing.T) {
649
649
p2 : `{"del2": null}` ,
650
650
exp : `{"del1": null, "del2": null}` ,
651
651
},
652
+ {
653
+ demonstrates : "nulls are kept in complex objects" ,
654
+ p1 : `{}` ,
655
+ 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"}}}` ,
656
+ 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"}}}` ,
657
+ },
652
658
{
653
659
demonstrates : "a key added then deleted is kept deleted" ,
654
660
p1 : `{"add_then_delete": "atd"}` ,
0 commit comments