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

Function TestValueBinder_Int64s_intsValue

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

Source from the content-addressed store, hash-verified

879}
880
881func TestValueBinder_Int64s_intsValue(t *testing.T) {
882 var testCases = []struct {
883 name string
884 whenURL string
885 expectError string
886 givenBindErrors []error
887 expectValue []int64
888 givenFailFast bool
889 whenMust bool
890 }{
891 {
892 name: "ok, binds value",
893 whenURL: "/search?param=1&param=2&param=1",
894 expectValue: []int64{1, 2, 1},
895 },
896 {
897 name: "ok, params values empty, value is not changed",
898 whenURL: "/search?nope=1",
899 expectValue: []int64{99},
900 },
901 {
902 name: "nok, previous errors fail fast without binding value",
903 givenFailFast: true,
904 whenURL: "/search?param=1&param=100",
905 expectValue: []int64{99},
906 expectError: "previous error",
907 },
908 {
909 name: "nok, conversion fails, value is not changed",
910 whenURL: "/search?param=nope&param=100",
911 expectValue: []int64{99},
912 expectError: "code=400, message=failed to bind field value to int64, err=strconv.ParseInt: parsing \"nope\": invalid syntax, field=param",
913 },
914 {
915 name: "ok (must), binds value",
916 whenMust: true,
917 whenURL: "/search?param=1&param=2&param=1",
918 expectValue: []int64{1, 2, 1},
919 },
920 {
921 name: "ok (must), params values empty, returns error, value is not changed",
922 whenMust: true,
923 whenURL: "/search?nope=1",
924 expectValue: []int64{99},
925 expectError: "code=400, message=required field value is empty, field=param",
926 },
927 {
928 name: "nok (must), previous errors fail fast without binding value",
929 givenFailFast: true,
930 whenMust: true,
931 whenURL: "/search?param=1&param=100",
932 expectValue: []int64{99},
933 expectError: "previous error",
934 },
935 {
936 name: "nok (must), conversion fails, value is not changed",
937 whenMust: true,
938 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
MustInt64sMethod · 0.80
Int64sMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…