1
0
Fork 0
mirror of https://github.com/restic/restic.git synced 2024-12-28 10:49:02 +00:00
restic/backend/test/tests_test.go
2016-01-23 17:42:26 +01:00

37 lines
625 B
Go

package test_test
import (
"errors"
"github.com/restic/restic/backend"
"github.com/restic/restic/backend/test"
)
var be backend.Backend
//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")
}
be = backend.NewMemoryBackend()
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
}
}