MCPcopy Index your code
hub / github.com/gobwas/ws / TestWriteHeader

Function TestWriteHeader

write_test.go:10–29  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

8)
9
10func TestWriteHeader(t *testing.T) {
11 for i, test := range RWTestCases {
12 t.Run(fmt.Sprintf("#%d", i), func(t *testing.T) {
13 buf := &bytes.Buffer{}
14 err := WriteHeader(buf, test.Header)
15 if test.Err && err == nil {
16 t.Errorf("expected error, got nil")
17 }
18 if !test.Err && err != nil {
19 t.Errorf("unexpected error: %s", err)
20 }
21 if test.Err {
22 return
23 }
24 if bts := buf.Bytes(); !bytes.Equal(bts, test.Data) {
25 t.Errorf("WriteHeader()\nwrote:\n\t%08b\nwant:\n\t%08b", bts, test.Data)
26 }
27 })
28 }
29}
30
31func BenchmarkWriteHeader(b *testing.B) {
32 for _, bench := range RWBenchCases {

Callers

nothing calls this directly

Calls 2

BytesMethod · 0.95
WriteHeaderFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…