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

Method TestAppendH2ToNextProtos

internal/credentials/util_test.go:26–60  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

24)
25
26func (s) TestAppendH2ToNextProtos(t *testing.T) {
27 tests := []struct {
28 name string
29 ps []string
30 want []string
31 }{
32 {
33 name: "empty",
34 ps: nil,
35 want: []string{"h2"},
36 },
37 {
38 name: "only h2",
39 ps: []string{"h2"},
40 want: []string{"h2"},
41 },
42 {
43 name: "with h2",
44 ps: []string{"alpn", "h2"},
45 want: []string{"alpn", "h2"},
46 },
47 {
48 name: "no h2",
49 ps: []string{"alpn"},
50 want: []string{"alpn", "h2"},
51 },
52 }
53 for _, tt := range tests {
54 t.Run(tt.name, func(t *testing.T) {
55 if got := AppendH2ToNextProtos(tt.ps); !reflect.DeepEqual(got, tt.want) {
56 t.Errorf("AppendH2ToNextProtos() = %v, want %v", got, tt.want)
57 }
58 })
59 }
60}

Callers

nothing calls this directly

Calls 2

AppendH2ToNextProtosFunction · 0.85
ErrorfMethod · 0.65

Tested by

no test coverage detected