MCPcopy
hub / github.com/labstack/echo / TestValueBinder_CustomFuncWithError

Function TestValueBinder_CustomFuncWithError

binder_test.go:248–265  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

246}
247
248func TestValueBinder_CustomFuncWithError(t *testing.T) {
249 c := createTestContext("/search?nr=en&id=1&id=101", nil, nil)
250 b := QueryParamsBinder(c)
251
252 id := int64(99)
253 givenCustomFunc := func(values []string) []error {
254 assert.Equal(t, []string{"1", "101"}, values)
255
256 return []error{
257 errors.New("first error"),
258 errors.New("second error"),
259 }
260 }
261 err := b.CustomFunc("id", givenCustomFunc).BindError()
262
263 assert.Equal(t, int64(99), id)
264 assert.EqualError(t, err, "first error")
265}
266
267func TestValueBinder_CustomFunc(t *testing.T) {
268 var testCases = []struct {

Callers

nothing calls this directly

Calls 4

createTestContextFunction · 0.85
QueryParamsBinderFunction · 0.85
BindErrorMethod · 0.80
CustomFuncMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…