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

Function TestRWFileHandleSizeCreateExisting

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

Source from the content-addressed store, hash-verified

499}
500
501func TestRWFileHandleSizeCreateExisting(t *testing.T) {
502 _, vfs, fh := rwHandleCreateFlags(t, true, "dir/file1", os.O_WRONLY|os.O_CREATE)
503
504 // check initial size after opening
505 assertSize(t, vfs, fh, "dir/file1", 16)
506
507 // write some bytes
508 n, err := fh.Write([]byte("hello"))
509 assert.NoError(t, err)
510 assert.Equal(t, 5, n)
511
512 // check size after writing
513 assertSize(t, vfs, fh, "dir/file1", 16)
514
515 // write some more bytes
516 n, err = fh.Write([]byte("helloHELLOhello"))
517 assert.NoError(t, err)
518 assert.Equal(t, 15, n)
519
520 // check size after writing
521 assertSize(t, vfs, fh, "dir/file1", 20)
522
523 // close
524 assert.NoError(t, fh.Close())
525
526 // check size after close
527 assertSize(t, vfs, nil, "dir/file1", 20)
528}
529
530func TestRWFileHandleSizeCreateNew(t *testing.T) {
531 _, vfs, fh := rwHandleCreateFlags(t, false, "file1", os.O_WRONLY|os.O_CREATE)

Callers

nothing calls this directly

Calls 5

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