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

Function assertSize

vfs/read_write_test.go:471–478  ·  view source on GitHub ↗

check the size of the file through the open file (if not nil) and via stat

(t *testing.T, vfs *VFS, fh *RWFileHandle, filepath string, size int64)

Source from the content-addressed store, hash-verified

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) {
472 if fh != nil {
473 assert.Equal(t, size, fh.Size())
474 }
475 fi, err := vfs.Stat(filepath)
476 require.NoError(t, err)
477 assert.Equal(t, size, fi.Size())
478}
479
480func TestRWFileHandleSizeTruncateExisting(t *testing.T) {
481 _, vfs, fh := rwHandleCreateFlags(t, true, "dir/file1", os.O_WRONLY|os.O_TRUNC)

Calls 3

SizeMethod · 0.65
StatMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…