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

Function TestValues_CustomEncodingInt

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

Source from the content-addressed store, hash-verified

521}
522
523func TestValues_CustomEncodingInt(t *testing.T) {
524 var zero customEncodedInt = 0
525 var one customEncodedInt = 1
526 tests := []struct {
527 input interface{}
528 want url.Values
529 }{
530 {
531 struct {
532 V customEncodedInt `url:"v"`
533 }{},
534 url.Values{"v": {"_0"}},
535 },
536 {
537 struct {
538 V customEncodedInt `url:"v,omitempty"`
539 }{zero},
540 url.Values{},
541 },
542 {
543 struct {
544 V customEncodedInt `url:"v"`
545 }{one},
546 url.Values{"v": {"_1"}},
547 },
548
549 // pointers to custom encoded types
550 {
551 struct {
552 V *customEncodedInt `url:"v"`
553 }{},
554 url.Values{"v": {"_0"}},
555 },
556 {
557 struct {
558 V *customEncodedInt `url:"v,omitempty"`
559 }{},
560 url.Values{},
561 },
562 {
563 struct {
564 V *customEncodedInt `url:"v,omitempty"`
565 }{&zero},
566 url.Values{"v": {"_0"}},
567 },
568 {
569 struct {
570 V *customEncodedInt `url:"v"`
571 }{&one},
572 url.Values{"v": {"_1"}},
573 },
574 }
575
576 for _, tt := range tests {
577 testValue(t, tt.input, tt.want)
578 }
579}
580

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…