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

Function TestValueBinder_Int64_intValue

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

Source from the content-addressed store, hash-verified

568}
569
570func TestValueBinder_Int64_intValue(t *testing.T) {
571 var testCases = []struct {
572 name string
573 whenURL string
574 expectError string
575 givenBindErrors []error
576 expectValue int64
577 givenFailFast bool
578 whenMust bool
579 }{
580 {
581 name: "ok, binds value",
582 whenURL: "/search?param=1&param=100",
583 expectValue: 1,
584 },
585 {
586 name: "ok, params values empty, value is not changed",
587 whenURL: "/search?nope=1",
588 expectValue: 99,
589 },
590 {
591 name: "nok, previous errors fail fast without binding value",
592 givenFailFast: true,
593 whenURL: "/search?param=1&param=100",
594 expectValue: 99,
595 expectError: "previous error",
596 },
597 {
598 name: "nok, conversion fails, value is not changed",
599 whenURL: "/search?param=nope&param=100",
600 expectValue: 99,
601 expectError: "code=400, message=failed to bind field value to int64, err=strconv.ParseInt: parsing \"nope\": invalid syntax, field=param",
602 },
603 {
604 name: "ok (must), binds value",
605 whenMust: true,
606 whenURL: "/search?param=1&param=100",
607 expectValue: 1,
608 },
609 {
610 name: "ok (must), params values empty, returns error, value is not changed",
611 whenMust: true,
612 whenURL: "/search?nope=1",
613 expectValue: 99,
614 expectError: "code=400, message=required field value is empty, field=param",
615 },
616 {
617 name: "nok (must), previous errors fail fast without binding value",
618 givenFailFast: true,
619 whenMust: true,
620 whenURL: "/search?param=1&param=100",
621 expectValue: 99,
622 expectError: "previous error",
623 },
624 {
625 name: "nok (must), conversion fails, value is not changed",
626 whenMust: true,
627 whenURL: "/search?param=nope&param=100",

Callers

nothing calls this directly

Calls 6

createTestContextFunction · 0.85
QueryParamsBinderFunction · 0.85
FailFastMethod · 0.80
BindErrorMethod · 0.80
MustInt64Method · 0.80
Int64Method · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…