(t *testing.T)
| 63 | } |
| 64 | |
| 65 | func TestPathValuesBinder(t *testing.T) { |
| 66 | c := createTestContext("/api/user/999", nil, map[string]string{ |
| 67 | "id": "1", |
| 68 | "nr": "2", |
| 69 | "slice": "3", |
| 70 | }) |
| 71 | b := PathValuesBinder(c) |
| 72 | |
| 73 | id := int64(99) |
| 74 | nr := int64(88) |
| 75 | var slice = make([]int64, 0) |
| 76 | var notExisting = make([]int64, 0) |
| 77 | err := b.Int64("id", &id). |
| 78 | Int64("nr", &nr). |
| 79 | Int64s("slice", &slice). |
| 80 | Int64s("not_existing", ¬Existing). |
| 81 | BindError() |
| 82 | |
| 83 | assert.NoError(t, err) |
| 84 | assert.Equal(t, int64(1), id) |
| 85 | assert.Equal(t, int64(2), nr) |
| 86 | assert.Equal(t, []int64{3}, slice) // binding params to slice does not make sense but it should not panic either |
| 87 | assert.Equal(t, []int64{}, notExisting) // binding params to slice does not make sense but it should not panic either |
| 88 | } |
| 89 | |
| 90 | func TestQueryParamsBinder_FailFast(t *testing.T) { |
| 91 | var testCases = []struct { |
nothing calls this directly
no test coverage detected
searching dependent graphs…