aboutsummaryrefslogtreecommitdiff
path: root/librsync/common_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'librsync/common_test.go')
-rw-r--r--librsync/common_test.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/librsync/common_test.go b/librsync/common_test.go
new file mode 100644
index 0000000..35d59b1
--- /dev/null
+++ b/librsync/common_test.go
@@ -0,0 +1,24 @@
+package librsync
+
+import (
+ "fmt"
+ "io"
+ "os"
+)
+
+// Some functions to support testing
+
+func dump(r io.Reader) (string, error) {
+ path := fmt.Sprintf("%s%cgolibrsync_test", os.TempDir(), os.PathSeparator)
+ file, err := os.Create(path)
+ if err != nil {
+ return "", err
+ }
+ defer file.Close()
+
+ if _, err = io.Copy(file, r); err != nil {
+ return "", err
+ }
+
+ return path, nil
+}