MCPcopy
hub / github.com/rclone/rclone / TestRWFileHandleFlushWrite

Function TestRWFileHandleFlushWrite

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

Source from the content-addressed store, hash-verified

421}
422
423func TestRWFileHandleFlushWrite(t *testing.T) {
424 _, _, fh := rwHandleCreateWriteOnly(t)
425
426 // Check that the file has been create and is open
427 assert.True(t, fh.opened)
428
429 // Write some data
430 n, err := fh.Write([]byte("hello"))
431 assert.NoError(t, err)
432 assert.Equal(t, 5, n)
433 assert.True(t, fh.opened)
434
435 // Check Flush does not close file if write called
436 err = fh.Flush()
437 assert.NoError(t, err)
438 assert.False(t, fh.closed)
439
440 // Check flush does nothing if called again
441 err = fh.Flush()
442 assert.NoError(t, err)
443 assert.False(t, fh.closed)
444
445 // Check that Close closes the file
446 err = fh.Close()
447 assert.NoError(t, err)
448 assert.True(t, fh.closed)
449}
450
451func TestRWFileHandleReleaseWrite(t *testing.T) {
452 _, _, fh := rwHandleCreateWriteOnly(t)

Callers

nothing calls this directly

Calls 5

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