(t *testing.T)
| 24 | ) |
| 25 | |
| 26 | func (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 | } |
nothing calls this directly
no test coverage detected