Пример #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},
	})
}
Пример #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},
	})
}
Пример #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},
	})
}
Пример #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},
	})
}
Пример #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},
	})
}