mirror of
https://github.com/octoleo/restic.git
synced 2024-12-22 10:58:55 +00:00
Move testing logic to test file in internal/pack
This commit is contained in:
parent
a23e9c86ba
commit
74a64c47e4
@ -25,12 +25,8 @@ type Packer struct {
|
|||||||
m sync.Mutex
|
m sync.Mutex
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewPacker returns a new Packer that can be used to pack blobs
|
// NewPacker returns a new Packer that can be used to pack blobs together.
|
||||||
// together. If wr is nil, a bytes.Buffer is used.
|
|
||||||
func NewPacker(k *crypto.Key, wr io.Writer) *Packer {
|
func NewPacker(k *crypto.Key, wr io.Writer) *Packer {
|
||||||
if wr == nil {
|
|
||||||
wr = bytes.NewBuffer(nil)
|
|
||||||
}
|
|
||||||
return &Packer{k: k, wr: wr}
|
return &Packer{k: k, wr: wr}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ func newPack(t testing.TB, k *crypto.Key, lengths []int) ([]Buf, []byte, uint) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// pack blobs
|
// pack blobs
|
||||||
p := pack.NewPacker(k, nil)
|
p := pack.NewPacker(k, new(bytes.Buffer))
|
||||||
for _, b := range bufs {
|
for _, b := range bufs {
|
||||||
p.Add(restic.TreeBlob, b.id, b.data)
|
p.Add(restic.TreeBlob, b.id, b.data)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user