MCPcopy Index your code
hub / github.com/rclone/rclone / TestRWFileHandleFlushRead

Function TestRWFileHandleFlushRead

vfs/read_write_test.go:215–241  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

213}
214
215func TestRWFileHandleFlushRead(t *testing.T) {
216 _, _, fh := rwHandleCreateReadOnly(t)
217
218 // Check Flush does nothing if read not called
219 err := fh.Flush()
220 assert.NoError(t, err)
221 assert.False(t, fh.closed)
222
223 // Read data
224 buf := make([]byte, 256)
225 n, err := fh.Read(buf)
226 assert.True(t, err == io.EOF || err == nil)
227 assert.Equal(t, 16, n)
228
229 // Check Flush does nothing if read called
230 err = fh.Flush()
231 assert.NoError(t, err)
232 assert.False(t, fh.closed)
233
234 // Check flush does nothing if called again
235 err = fh.Flush()
236 assert.NoError(t, err)
237 assert.False(t, fh.closed)
238
239 // Properly close the file
240 assert.NoError(t, fh.Close())
241}
242
243func TestRWFileHandleReleaseRead(t *testing.T) {
244 _, _, fh := rwHandleCreateReadOnly(t)

Callers

nothing calls this directly

Calls 5

rwHandleCreateReadOnlyFunction · 0.85
FlushMethod · 0.65
ReadMethod · 0.65
CloseMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…