Skip to content

Commit e0f6c24

Browse files
committed
Fix known broken case
Signed-off-by: John Howard <[email protected]>
1 parent c616a48 commit e0f6c24

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

v2/fuzz_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ func FuzzCreatePatch(f *testing.F) {
2525
}
2626

2727
func checkFuzz(t *testing.T, src, dst []byte) {
28+
t.Logf("Test: %v -> %v", string(src), string(dst))
2829
patch, err := jsonpatch.CreatePatch(src, dst)
2930
if err != nil {
3031
// Ok to error, src or dst may be invalid
@@ -37,9 +38,17 @@ func checkFuzz(t *testing.T, src, dst []byte) {
3738
return
3839
}
3940

41+
for _, p := range patch {
42+
if p.Path == "" {
43+
// json-patch doesn't handle this properly, but it is valid
44+
return
45+
}
46+
}
47+
4048
data, err := json.Marshal(patch)
4149
assert.Nil(t, err)
4250

51+
t.Logf("Applying patch %v", string(data))
4352
p2, err := jp.DecodePatch(data)
4453
assert.Nil(t, err)
4554

0 commit comments

Comments
 (0)