MCPcopy Index your code
hub / github.com/coder/coder / TestReadFrameAllocatesWhenNeeded

Function TestReadFrameAllocatesWhenNeeded

agent/boundarylogproxy/codec/codec_test.go:107–121  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

105}
106
107func 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
123func TestWriteFrameDataSize(t *testing.T) {
124 t.Parallel()

Callers

nothing calls this directly

Calls 3

WriteFrameFunction · 0.92
ReadFrameFunction · 0.92
EqualMethod · 0.45

Tested by

no test coverage detected