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

Function TestValues_Pointers

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

Source from the content-addressed store, hash-verified

98}
99
100func TestValues_Pointers(t *testing.T) {
101 str := "s"
102 strPtr := &str
103
104 tests := []struct {
105 input interface{}
106 want url.Values
107 }{
108 // nil pointers (zero values)
109 {struct{ V *string }{}, url.Values{"V": {""}}},
110 {struct{ V *int }{}, url.Values{"V": {""}}},
111
112 // non-zero pointer values
113 {struct{ V *string }{&str}, url.Values{"V": {"s"}}},
114 {struct{ V **string }{&strPtr}, url.Values{"V": {"s"}}},
115
116 // slices of pointer values
117 {struct{ V []*string }{}, url.Values{}},
118 {struct{ V []*string }{[]*string{&str, &str}}, url.Values{"V": {"s", "s"}}},
119
120 // pointer to slice
121 {struct{ V *[]string }{}, url.Values{"V": {""}}},
122 {struct{ V *[]string }{&[]string{"a", "b"}}, url.Values{"V": {"a", "b"}}},
123
124 // pointer values for the input struct itself
125 {(*struct{})(nil), url.Values{}},
126 {&struct{}{}, url.Values{}},
127 {&struct{ V string }{}, url.Values{"V": {""}}},
128 {&struct{ V string }{"v"}, url.Values{"V": {"v"}}},
129 }
130
131 for _, tt := range tests {
132 testValue(t, tt.input, tt.want)
133 }
134}
135
136func TestValues_Slices(t *testing.T) {
137 tests := []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…