MCPcopy
hub / github.com/rclone/rclone / TestRWFileHandleReleaseRead

Function TestRWFileHandleReleaseRead

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

Source from the content-addressed store, hash-verified

241}
242
243func TestRWFileHandleReleaseRead(t *testing.T) {
244 _, _, fh := rwHandleCreateReadOnly(t)
245
246 // Read data
247 buf := make([]byte, 256)
248 n, err := fh.Read(buf)
249 assert.True(t, err == io.EOF || err == nil)
250 assert.Equal(t, 16, n)
251
252 // Check Release closes file
253 err = fh.Release()
254 assert.NoError(t, err)
255 assert.True(t, fh.closed)
256
257 // Check Release does nothing if called again
258 err = fh.Release()
259 assert.NoError(t, err)
260 assert.True(t, fh.closed)
261}
262
263/// ------------------------------------------------------------
264

Callers

nothing calls this directly

Calls 4

rwHandleCreateReadOnlyFunction · 0.85
ReadMethod · 0.65
ReleaseMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…