not specific to request tests, just helper functions for testing structures that implement the encoder or decoder interfaces that needed somewhere to live
(t *testing.T, name string, in encoder, expect []byte)
| 573 | // implement the encoder or decoder interfaces that needed somewhere to live |
| 574 | |
| 575 | func testEncodable(t *testing.T, name string, in encoder, expect []byte) { |
| 576 | t.Helper() |
| 577 | packet, err := encode(in, nil) |
| 578 | if err != nil { |
| 579 | t.Error(err) |
| 580 | } else if !bytes.Equal(packet, expect) { |
| 581 | t.Error("Encoding", name, "failed\ngot ", packet, "\nwant", expect) |
| 582 | } |
| 583 | } |
| 584 | |
| 585 | func testDecodable(t *testing.T, name string, out decoder, in []byte) { |
| 586 | t.Helper() |
no test coverage detected