(t *testing.T)
| 334 | } |
| 335 | |
| 336 | func TestBindUnmarshalText(t *testing.T) { |
| 337 | e := New() |
| 338 | req := httptest.NewRequest(http.MethodGet, "/?ts=2016-12-06T19:09:05Z&sa=one,two,three&ta=2016-12-06T19:09:05Z&ta=2016-12-06T19:09:05Z&ST=baz", nil) |
| 339 | rec := httptest.NewRecorder() |
| 340 | c := e.NewContext(req, rec) |
| 341 | result := struct { |
| 342 | T time.Time `query:"ts"` |
| 343 | ST Struct |
| 344 | TA []time.Time `query:"ta"` |
| 345 | SA StringArray `query:"sa"` |
| 346 | }{} |
| 347 | err := c.Bind(&result) |
| 348 | ts := time.Date(2016, 12, 6, 19, 9, 5, 0, time.UTC) |
| 349 | if assert.NoError(t, err) { |
| 350 | // assert.Equal(t, Timestamp(reflect.TypeOf(&Timestamp{}), time.Date(2016, 12, 6, 19, 9, 5, 0, time.UTC)), result.T) |
| 351 | assert.Equal(t, ts, result.T) |
| 352 | assert.Equal(t, StringArray([]string{"one", "two", "three"}), result.SA) |
| 353 | assert.Equal(t, []time.Time{ts, ts}, result.TA) |
| 354 | assert.Equal(t, Struct{""}, result.ST) // field in child struct does not have tag |
| 355 | } |
| 356 | } |
| 357 | |
| 358 | func TestBindUnmarshalParamPtr(t *testing.T) { |
| 359 | e := New() |
nothing calls this directly
no test coverage detected
searching dependent graphs…