2
2
mirror of https://github.com/octoleo/restic.git synced 2024-12-29 05:13:09 +00:00
restic/backend/mem/mem_backend_test.go

39 lines
647 B
Go
Raw Normal View History

2016-01-23 18:19:26 +00:00
package mem_test
import (
"errors"
"github.com/restic/restic/backend"
2016-01-23 18:19:26 +00:00
"github.com/restic/restic/backend/mem"
"github.com/restic/restic/backend/test"
)
var be backend.Backend
2016-01-23 18:19:26 +00:00
//go:generate go run ../test/generate_backend_tests.go
func init() {
test.CreateFn = func() (backend.Backend, error) {
if be != nil {
return nil, errors.New("temporary memory backend dir already exists")
}
2016-01-23 18:19:26 +00:00
be = mem.New()
return be, nil
}
test.OpenFn = func() (backend.Backend, error) {
if be == nil {
return nil, errors.New("repository not initialized")
}
return be, nil
}
test.CleanupFn = func() error {
be = nil
return nil
}
}