MCPcopy
hub / github.com/rclone/rclone / TestDirForgetAll

Function TestDirForgetAll

vfs/dir_test.go:86–111  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

84}
85
86func TestDirForgetAll(t *testing.T) {
87 _, vfs, dir, file1 := dirCreate(t)
88
89 // Make sure / and dir are in cache
90 _, err := vfs.Stat(file1.Path)
91 require.NoError(t, err)
92
93 root, err := vfs.Root()
94 require.NoError(t, err)
95
96 assert.Equal(t, 1, len(root.items))
97 assert.Equal(t, 1, len(dir.items))
98 assert.False(t, root.read.IsZero())
99 assert.False(t, dir.read.IsZero())
100
101 dir.ForgetAll()
102 assert.Equal(t, 1, len(root.items))
103 assert.Equal(t, 0, len(dir.items))
104 assert.False(t, root.read.IsZero())
105 assert.True(t, dir.read.IsZero())
106
107 root.ForgetAll()
108 assert.Equal(t, 0, len(root.items))
109 assert.Equal(t, 0, len(dir.items))
110 assert.True(t, root.read.IsZero())
111}
112
113func TestDirForgetPath(t *testing.T) {
114 _, vfs, dir, file1 := dirCreate(t)

Callers

nothing calls this directly

Calls 6

dirCreateFunction · 0.85
IsZeroMethod · 0.80
ForgetAllMethod · 0.80
StatMethod · 0.65
RootMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…