MCPcopy
hub / github.com/rclone/rclone / TestMoveOverSelf

Function TestMoveOverSelf

fs/sync/sync_test.go:675–689  ·  view source on GitHub ↗

Test moving a file over itself

(t *testing.T)

Source from the content-addressed store, hash-verified

673
674// Test moving a file over itself
675func TestMoveOverSelf(t *testing.T) {
676 ctx := context.Background()
677 r := fstest.NewRun(t)
678 file1 := r.WriteObject(ctx, "sub dir/hello world", "hello world", t1)
679 r.CheckRemoteItems(t, file1)
680 file2 := r.WriteFile("sub dir/hello world", "hello world again", t2)
681 r.CheckLocalItems(t, file2)
682
683 ctx = predictDstFromLogger(ctx)
684 err := MoveDir(ctx, r.Fremote, r.Flocal, false, false)
685 require.NoError(t, err)
686 testLoggerVsLsf(ctx, r.Fremote, r.Flocal, operations.GetLoggerOpt(ctx).JSON, t)
687 r.CheckLocalItems(t)
688 r.CheckRemoteItems(t, file2)
689}
690
691// Test server-side moving a file over itself
692func TestServerSideMoveOverSelf(t *testing.T) {

Callers

nothing calls this directly

Calls 9

WriteObjectMethod · 0.95
CheckRemoteItemsMethod · 0.95
WriteFileMethod · 0.95
CheckLocalItemsMethod · 0.95
NewRunFunction · 0.92
GetLoggerOptFunction · 0.92
predictDstFromLoggerFunction · 0.85
MoveDirFunction · 0.85
testLoggerVsLsfFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…