diff options
Diffstat (limited to 'librsync/signature_test.go')
-rw-r--r-- | librsync/signature_test.go | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/librsync/signature_test.go b/librsync/signature_test.go index 152fd12..e0fd50f 100644 --- a/librsync/signature_test.go +++ b/librsync/signature_test.go @@ -76,5 +76,23 @@ func TestSignatureDeltaPatch(t *testing.T) { } } - // TODO: Test patching + // Apply Patch + patchres := new(bytes.Buffer) + patcher, err := NewPatcher(deltabuf, orig) + if err != nil { + t.Fatalf("could not create a patcher: %s", err) + } + defer patcher.Close() + + if _, err = io.Copy(patchres, patcher); err != nil { + t.Fatalf("Applying the patch failed: %s", err) + } + + if !bytes.Equal(patchres.Bytes(), testdata.Mutation()) { + if path, err := dump(patchres); err == nil { + t.Fatalf("patch result and mutation are not equal. Result dumped to %s", path) + } else { + t.Fatalf("patch result and mutation are not equal. Could not dump result: %s", err) + } + } } |