(t *testing.T)
| 105 | } |
| 106 | |
| 107 | func TestReadFrameAllocatesWhenNeeded(t *testing.T) { |
| 108 | t.Parallel() |
| 109 | |
| 110 | var buf bytes.Buffer |
| 111 | data := []byte("this message is longer than the buffer") |
| 112 | err := codec.WriteFrame(&buf, codec.TagV1, data) |
| 113 | require.NoError(t, err) |
| 114 | |
| 115 | // Buffer with insufficient capacity triggers allocation. |
| 116 | readBuf := make([]byte, 4) |
| 117 | tag, got, err := codec.ReadFrame(&buf, readBuf) |
| 118 | require.NoError(t, err) |
| 119 | require.Equal(t, codec.TagV1, tag) |
| 120 | require.Equal(t, data, got) |
| 121 | } |
| 122 | |
| 123 | func TestWriteFrameDataSize(t *testing.T) { |
| 124 | t.Parallel() |
nothing calls this directly
no test coverage detected