MCPcopy
hub / github.com/grpc/grpc-go / TestAppend

Method TestAppend

metadata/metadata_test.go:138–170  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

136}
137
138func (s) TestAppend(t *testing.T) {
139 for _, test := range []struct {
140 md MD
141 appendKey string
142 appendVals []string
143 want MD
144 }{
145 {
146 md: Pairs("My-Optional-Header", "42"),
147 appendKey: "Other-Key",
148 appendVals: []string{"1"},
149 want: Pairs("my-optional-header", "42", "other-key", "1"),
150 },
151 {
152 md: Pairs("My-Optional-Header", "42"),
153 appendKey: "my-OptIoNal-HeAder",
154 appendVals: []string{"1", "2", "3"},
155 want: Pairs("my-optional-header", "42", "my-optional-header", "1",
156 "my-optional-header", "2", "my-optional-header", "3"),
157 },
158 {
159 md: Pairs("My-Optional-Header", "42"),
160 appendKey: "my-OptIoNal-HeAder",
161 appendVals: []string{},
162 want: Pairs("my-optional-header", "42"),
163 },
164 } {
165 test.md.Append(test.appendKey, test.appendVals...)
166 if !reflect.DeepEqual(test.md, test.want) {
167 t.Errorf("value of metadata is %v, want %v", test.md, test.want)
168 }
169 }
170}
171
172func (s) TestDelete(t *testing.T) {
173 for _, test := range []struct {

Callers

nothing calls this directly

Calls 3

PairsFunction · 0.85
AppendMethod · 0.80
ErrorfMethod · 0.65

Tested by

no test coverage detected