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

Function TestValues_OmitEmpty

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

Source from the content-addressed store, hash-verified

330}
331
332func TestValues_OmitEmpty(t *testing.T) {
333 str := ""
334
335 tests := []struct {
336 input interface{}
337 want url.Values
338 }{
339 {struct{ v string }{}, url.Values{}}, // non-exported field
340 {
341 struct {
342 V string `url:",omitempty"`
343 }{},
344 url.Values{},
345 },
346 {
347 struct {
348 V string `url:"-"`
349 }{},
350 url.Values{},
351 },
352 {
353 struct {
354 V string `url:"omitempty"` // actually named omitempty
355 }{},
356 url.Values{"omitempty": {""}},
357 },
358 {
359 // include value for a non-nil pointer to an empty value
360 struct {
361 V *string `url:",omitempty"`
362 }{&str},
363 url.Values{"V": {""}},
364 },
365 }
366
367 for _, tt := range tests {
368 testValue(t, tt.input, tt.want)
369 }
370}
371
372func TestValues_EmbeddedStructs(t *testing.T) {
373 type Inner struct {

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…