mirror of
https://github.com/octoleo/restic.git
synced 2024-11-16 01:57:10 +00:00
691c01963b
Fixes #4449: error messages from prune were too long to fit in scroll buffers.
33 lines
678 B
Go
33 lines
678 B
Go
package restic
|
|
|
|
import (
|
|
"math/rand"
|
|
"regexp"
|
|
"testing"
|
|
|
|
rtest "github.com/restic/restic/internal/test"
|
|
)
|
|
|
|
func TestBlobSetString(t *testing.T) {
|
|
s := NewBlobSet()
|
|
|
|
rtest.Equals(t, "{}", s.String())
|
|
|
|
id, _ := ParseID(
|
|
"1111111111111111111111111111111111111111111111111111111111111111")
|
|
s.Insert(BlobHandle{ID: id, Type: TreeBlob})
|
|
rtest.Equals(t, "{<tree/11111111>}", s.String())
|
|
|
|
var h BlobHandle
|
|
for i := 0; i < 100; i++ {
|
|
h.Type = DataBlob
|
|
_, _ = rand.Read(h.ID[:])
|
|
s.Insert(h)
|
|
}
|
|
|
|
r := regexp.MustCompile(
|
|
`^{(?:<(?:data|tree)/[0-9a-f]{8}> ){10}\(90 more\)}$`)
|
|
str := s.String()
|
|
rtest.Assert(t, r.MatchString(str), "%q doesn't match pattern", str)
|
|
}
|