MCPcopy Create free account
hub / github.com/google/go-querystring / TestValues_CustomEncodingSlice

Function TestValues_CustomEncodingSlice

query/encode_test.go:449–485  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

447}
448
449func 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.

Callers

nothing calls this directly

Calls 1

testValueFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…