"git@gfx.cafe:open/bor.git" did not exist on "175506e7fd9601b66355b5cd3f7df4256637586f"
Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package websocket
import (
"math"
"strings"
"testing"
)
func TestCloseError(t *testing.T) {
t.Parallel()
// Other parts of close error are tested by websocket_test.go right now
// with the autobahn tests.
testCases := []struct {
name string
ce CloseError
success bool
}{
{
name: "normal",
ce: CloseError{
Code: StatusNormalClosure,
Reason: strings.Repeat("x", maxControlFramePayload-2),
},
success: true,
},
{
name: "bigReason",
ce: CloseError{
Code: StatusNormalClosure,
Reason: strings.Repeat("x", maxControlFramePayload-1),
},
success: false,
},
{
name: "bigCode",
ce: CloseError{
Code: math.MaxUint16,
Reason: strings.Repeat("x", maxControlFramePayload-2),
},
success: false,
},
}
for _, tc := range testCases {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
_, err := tc.ce.bytes()
if (err == nil) != tc.success {
t.Fatalf("unexpected error value: %v", err)
}
})
}
}