MCPcopy Index your code
hub / github.com/google/go-querystring / TestValues_CustomEncoding_Error

Function TestValues_CustomEncoding_Error

query/encode_test.go:489–512  ·  view source on GitHub ↗

One of the few ways reflectValues will return an error is if a custom encoder returns an error. Test all of the various ways that can happen.

(t *testing.T)

Source from the content-addressed store, hash-verified

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.
489func TestValues_CustomEncoding_Error(t *testing.T) {
490 type st struct {
491 V customEncodedStrings
492 }
493 tests := []struct {
494 input interface{}
495 }{
496 {
497 st{[]string{"err"}},
498 },
499 { // struct field
500 struct{ S st }{st{[]string{"err"}}},
501 },
502 { // embedded struct
503 struct{ st }{st{[]string{"err"}}},
504 },
505 }
506 for _, tt := range tests {
507 _, err := Values(tt.input)
508 if err == nil {
509 t.Errorf("Values(%q) did not return expected encoding error", tt.input)
510 }
511 }
512}
513
514// customEncodedInt is an int with a custom URL encoding
515type customEncodedInt int

Callers

nothing calls this directly

Calls 1

ValuesFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…