Exemplo n.º 1
0
func TestIsErrNotFound(t *testing.T) {
	testErrFn(t, IsErrNotFound, []errorCase{
		{nil, false},
		{errors.New("error"), false},
		{cp.NewError(cp.ErrBadPath, "bad path"), false},
		{cp.NewError(cp.ErrNoEnt, "not found"), true},
		{NewError(ErrNotFound, "not found"), true},
	})
}
Exemplo n.º 2
0
func TestIsErrInvalidPort(t *testing.T) {
	testErrFn(t, IsErrInvalidPort, []errorCase{
		{nil, false},
		{errors.New("error"), false},
		{cp.NewError(cp.ErrBadPath, "bad path"), false},
		{NewError(ErrInvalidPort, "invalid port"), true},
	})
}
Exemplo n.º 3
0
func TestIsErrInsClaimed(t *testing.T) {
	testErrFn(t, IsErrInsClaimed, []errorCase{
		{nil, false},
		{errors.New("error"), false},
		{cp.NewError(cp.ErrBadPath, "bad path"), false},
		{NewError(ErrInsClaimed, "claimed"), true},
	})
}
Exemplo n.º 4
0
func TestIsErrConflict(t *testing.T) {
	testErrFn(t, IsErrConflict, []errorCase{
		{nil, false},
		{errors.New("error"), false},
		{cp.NewError(cp.ErrBadPath, "bad path"), false},
		{NewError(ErrConflict, "conflict"), true},
	})
}
Exemplo n.º 5
0
func TestIsErrInvalidState(t *testing.T) {
	testErrFn(t, IsErrInvalidState, []errorCase{
		{nil, false},
		{errors.New("error"), false},
		{cp.NewError(cp.ErrBadPath, "bad path"), false},
		{ErrInvalidState, true},
		{NewError(ErrInvalidState, "invalid state"), true},
	})
}