MCPcopy
hub / github.com/gofiber/fiber / Test_ReadContentReturnsBytes

Function Test_ReadContentReturnsBytes

helpers_test.go:117–136  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

115}
116
117func Test_ReadContentReturnsBytes(t *testing.T) {
118 t.Parallel()
119
120 content := []byte("fiber read content test")
121 tempFile, err := os.CreateTemp("", "fiber-read-content-*.txt")
122 require.NoError(t, err)
123 t.Cleanup(func() {
124 require.NoError(t, os.Remove(tempFile.Name()))
125 })
126
127 _, err = tempFile.Write(content)
128 require.NoError(t, err)
129 require.NoError(t, tempFile.Close())
130
131 var buffer bytes.Buffer
132 n, err := readContent(&buffer, tempFile.Name())
133 require.NoError(t, err)
134 require.Equal(t, int64(len(content)), n)
135 require.Equal(t, content, buffer.Bytes())
136}
137
138type wrappedListener struct {
139 net.Listener

Callers

nothing calls this directly

Calls 5

BytesMethod · 0.95
readContentFunction · 0.85
NameMethod · 0.65
WriteMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…