(t *testing.T)
| 387 | } |
| 388 | |
| 389 | func TestWSControlFrameBetweenDataFrames(t *testing.T) { |
| 390 | mr := &fakeReader{ch: make(chan []byte, 1)} |
| 391 | defer mr.close() |
| 392 | r := wsNewReader(mr) |
| 393 | |
| 394 | p := make([]byte, 100) |
| 395 | |
| 396 | // Write a frame that will continue after the PONG |
| 397 | mr.buf.Write([]byte{2, 3}) |
| 398 | mr.buf.WriteString("ABC") |
| 399 | // Write a PONG |
| 400 | mr.buf.Write([]byte{138, 0}) |
| 401 | // Continuation of the frame |
| 402 | mr.buf.Write([]byte{0, 3}) |
| 403 | mr.buf.WriteString("DEF") |
| 404 | // Another PONG |
| 405 | mr.buf.Write([]byte{138, 0}) |
| 406 | // End of frame |
| 407 | mr.buf.Write([]byte{128, 3}) |
| 408 | mr.buf.WriteString("GHI") |
| 409 | |
| 410 | n, err := r.Read(p) |
| 411 | if err != nil { |
| 412 | t.Fatalf("Error on read: %v", err) |
| 413 | } |
| 414 | if string(p[:n]) != "ABCDEFGHI" { |
| 415 | t.Fatalf("Unexpected result: %q", p[:n]) |
| 416 | } |
| 417 | } |
| 418 | |
| 419 | func TestWSDecompressor(t *testing.T) { |
| 420 | var br *wsDecompressor |
nothing calls this directly
no test coverage detected