MCPcopy Index your code
hub / github.com/labstack/echo / TestValueBinder_Uint64_uintValue

Function TestValueBinder_Uint64_uintValue

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

Source from the content-addressed store, hash-verified

672}
673
674func TestValueBinder_Uint64_uintValue(t *testing.T) {
675 var testCases = []struct {
676 name string
677 whenURL string
678 expectError string
679 givenBindErrors []error
680 expectValue uint64
681 givenFailFast bool
682 whenMust bool
683 }{
684 {
685 name: "ok, binds value",
686 whenURL: "/search?param=1&param=100",
687 expectValue: 1,
688 },
689 {
690 name: "ok, params values empty, value is not changed",
691 whenURL: "/search?nope=1",
692 expectValue: 99,
693 },
694 {
695 name: "nok, previous errors fail fast without binding value",
696 givenFailFast: true,
697 whenURL: "/search?param=1&param=100",
698 expectValue: 99,
699 expectError: "previous error",
700 },
701 {
702 name: "nok, conversion fails, value is not changed",
703 whenURL: "/search?param=nope&param=100",
704 expectValue: 99,
705 expectError: "code=400, message=failed to bind field value to uint64, err=strconv.ParseUint: parsing \"nope\": invalid syntax, field=param",
706 },
707 {
708 name: "ok (must), binds value",
709 whenMust: true,
710 whenURL: "/search?param=1&param=100",
711 expectValue: 1,
712 },
713 {
714 name: "ok (must), params values empty, returns error, value is not changed",
715 whenMust: true,
716 whenURL: "/search?nope=1",
717 expectValue: 99,
718 expectError: "code=400, message=required field value is empty, field=param",
719 },
720 {
721 name: "nok (must), previous errors fail fast without binding value",
722 givenFailFast: true,
723 whenMust: true,
724 whenURL: "/search?param=1&param=100",
725 expectValue: 99,
726 expectError: "previous error",
727 },
728 {
729 name: "nok (must), conversion fails, value is not changed",
730 whenMust: true,
731 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
MustUint64Method · 0.80
Uint64Method · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…