diff options
author | Kevin Chabowski <kevin@kch42.de> | 2013-03-27 14:18:35 +0100 |
---|---|---|
committer | Kevin Chabowski <kevin@kch42.de> | 2013-03-27 14:18:35 +0100 |
commit | ba81e091aac2efe014111f64164d54ec92e8e549 (patch) | |
tree | 9bdca77a5f1c92f2891eff3decbebf7f35974690 /librsync/signature_test.go | |
parent | 2d56d29ba5c20a582119c1bbfa48f2dbcbb07aaf (diff) | |
download | golibrsync-ba81e091aac2efe014111f64164d54ec92e8e549.tar.gz golibrsync-ba81e091aac2efe014111f64164d54ec92e8e549.tar.bz2 golibrsync-ba81e091aac2efe014111f64164d54ec92e8e549.zip |
Implemented patching
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) + } + } } |