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

Function TestHeadTailBuffer_SmallOutput

agent/agentproc/headtail_test.go:27–41  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

25}
26
27func TestHeadTailBuffer_SmallOutput(t *testing.T) {
28 t.Parallel()
29
30 buf := agentproc.NewHeadTailBuffer()
31 data := "hello world\n"
32 n, err := buf.Write([]byte(data))
33 require.NoError(t, err)
34 require.Equal(t, len(data), n)
35
36 out, info := buf.Output()
37 require.Equal(t, data, out)
38 require.Nil(t, info, "small output should not be truncated")
39 require.Equal(t, len(data), buf.Len())
40 require.Equal(t, len(data), buf.TotalWritten())
41}
42
43func TestHeadTailBuffer_ExactlyHeadSize(t *testing.T) {
44 t.Parallel()

Callers

nothing calls this directly

Calls 6

WriteMethod · 0.95
OutputMethod · 0.95
LenMethod · 0.95
TotalWrittenMethod · 0.95
NewHeadTailBufferFunction · 0.92
EqualMethod · 0.45

Tested by

no test coverage detected