예제 #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},
	})
}