MCPcopy
hub / github.com/rclone/rclone / TestRWFileHandleReleaseWrite

Function TestRWFileHandleReleaseWrite

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

Source from the content-addressed store, hash-verified

449}
450
451func TestRWFileHandleReleaseWrite(t *testing.T) {
452 _, _, fh := rwHandleCreateWriteOnly(t)
453
454 // Write some data
455 n, err := fh.Write([]byte("hello"))
456 assert.NoError(t, err)
457 assert.Equal(t, 5, n)
458
459 // Check Release closes file
460 err = fh.Release()
461 assert.NoError(t, err)
462 assert.True(t, fh.closed)
463
464 // Check Release does nothing if called again
465 err = fh.Release()
466 assert.NoError(t, err)
467 assert.True(t, fh.closed)
468}
469
470// check the size of the file through the open file (if not nil) and via stat
471func assertSize(t *testing.T, vfs *VFS, fh *RWFileHandle, filepath string, size int64) {

Callers

nothing calls this directly

Calls 4

rwHandleCreateWriteOnlyFunction · 0.85
WriteMethod · 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…