2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-09 23:00:57 +00:00
restic/internal/file_test.go
Alexander Neumann 83d1a46526 Moves files
2017-07-23 14:19:13 +02:00

29 lines
672 B
Go

package restic
import "testing"
var handleTests = []struct {
h Handle
valid bool
}{
{Handle{Name: "foo"}, false},
{Handle{Type: "foobar"}, false},
{Handle{Type: ConfigFile, Name: ""}, true},
{Handle{Type: DataFile, Name: ""}, false},
{Handle{Type: "", Name: "x"}, false},
{Handle{Type: LockFile, Name: "010203040506"}, true},
}
func TestHandleValid(t *testing.T) {
for i, test := range handleTests {
err := test.h.Valid()
if err != nil && test.valid {
t.Errorf("test %v failed: error returned for valid handle: %v", i, err)
}
if !test.valid && err == nil {
t.Errorf("test %v failed: expected error for invalid handle not found", i)
}
}
}