aboutsummaryrefslogtreecommitdiff
path: root/librsync/common_test.go
blob: 35d59b1f950e06ada3fb80a291dd09066dedec11 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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
}