(t *testing.T)
| 447 | } |
| 448 | |
| 449 | func TestValues_CustomEncodingSlice(t *testing.T) { |
| 450 | tests := []struct { |
| 451 | input interface{} |
| 452 | want url.Values |
| 453 | }{ |
| 454 | { |
| 455 | struct { |
| 456 | V customEncodedStrings `url:"v"` |
| 457 | }{}, |
| 458 | url.Values{}, |
| 459 | }, |
| 460 | { |
| 461 | struct { |
| 462 | V customEncodedStrings `url:"v"` |
| 463 | }{[]string{"a", "b"}}, |
| 464 | url.Values{"v.0": {"a"}, "v.1": {"b"}}, |
| 465 | }, |
| 466 | |
| 467 | // pointers to custom encoded types |
| 468 | { |
| 469 | struct { |
| 470 | V *customEncodedStrings `url:"v"` |
| 471 | }{}, |
| 472 | url.Values{}, |
| 473 | }, |
| 474 | { |
| 475 | struct { |
| 476 | V *customEncodedStrings `url:"v"` |
| 477 | }{(*customEncodedStrings)(&[]string{"a", "b"})}, |
| 478 | url.Values{"v.0": {"a"}, "v.1": {"b"}}, |
| 479 | }, |
| 480 | } |
| 481 | |
| 482 | for _, tt := range tests { |
| 483 | testValue(t, tt.input, tt.want) |
| 484 | } |
| 485 | } |
| 486 | |
| 487 | // One of the few ways reflectValues will return an error is if a custom |
| 488 | // encoder returns an error. Test all of the various ways that can happen. |
nothing calls this directly
no test coverage detected
searching dependent graphs…