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

Function TestGet

internal/metadata/metadata_test.go:32–58  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

30)
31
32func TestGet(t *testing.T) {
33 tests := []struct {
34 name string
35 addr resolver.Address
36 want metadata.MD
37 }{
38 {
39 name: "not set",
40 addr: resolver.Address{},
41 want: nil,
42 },
43 {
44 name: "not set",
45 addr: resolver.Address{
46 Attributes: attributes.New(mdKey, mdValue(metadata.Pairs("k", "v"))),
47 },
48 want: metadata.Pairs("k", "v"),
49 },
50 }
51 for _, tt := range tests {
52 t.Run(tt.name, func(t *testing.T) {
53 if got := Get(tt.addr); !cmp.Equal(got, tt.want) {
54 t.Errorf("Get() = %v, want %v", got, tt.want)
55 }
56 })
57 }
58}
59
60func TestSet(t *testing.T) {
61 tests := []struct {

Callers

nothing calls this directly

Calls 6

NewFunction · 0.92
PairsFunction · 0.92
mdValueTypeAlias · 0.85
GetFunction · 0.70
EqualMethod · 0.65
ErrorfMethod · 0.65

Tested by

no test coverage detected